Tuesday, April 02, 2019

Building and Packaging FFmpeg on Solaris 11.4

FFmpeg is a suite of libraries and programs for handling video, audio and for a Solaris 11 desktop user it is required for video in your Firefox. At the moment it does not come with Solaris you will need to build it yourself.

This guide will take you through building FFmpeg, creating a Package and then installing it. There has been a recent blog entry about  building Opensource on Solaris (by Chris Beal), which use the github.com/oracle/solaris-userland as the base, but I will not follow this example at this time. May be at a later date.

  • Download ffmpeg-4.1.tar.bz2 from https://www.ffmpeg.org/download.html
  • Need to use GNU sed over Solaris sed
  • Packages required: gcc/gcc-c-7 text/gnu-sed
  • Location of files for IPS build: /var/tmp/pkgs/proto

# cd /var/tmp/src/ffmpeg
# bzip2 -dc  ffmpeg-4.1.tar.bz | tar xf - 
# echo $PATH
/usr/bin:/usr/sbin:/opt/developerstudio12.6/bin:/usr/gnu/bin

# gsed  -i 's/(sed /(gsed /; s/ sed / gsed /g'  ffmpeg-4.1/configure

# CC=gcc CFLAGS=-m64 CXXFLAGS=-m64 LDFLAGS=-m64 ./configure --prefix=/var/tmp/pkgs/proto \
--enable-shared --libdir=/var/tmp/pkgs/proto/usr/lib/amd64 --datadir=/var/tmp/pkgs/proto/usr/share/ffmpeg \
--docdir=/var/tmp/pkgs/proto/usr/share/doc/ffmpeg \
--mandir=/var/tmp/pkgs/proto/usr/share/man \
--strip=gstrip --disable-x86asm

# gmake

# gmake install

Now it has been built we will now create a package so that we can install it it via IPS.
  •  FFmeg was installed in /var/tmp/pkgs/proto
  • "<transform" used to alter the package file.
    • change location ie. /include to /usr/include
    • remove(drop) duplications which exist in other packages i.e. path=/usr/bin
  • You can remove the "<transform" lines if you like to see the possible errors
# cd /var/tmp/pkgs
# cat > ffpmeg.mog 
set name=pkg.fmri value=video/ffmpeg@4.1,0.1
set name=pkg.summary value="A very fast video and audio converter"
set name=variant.arch value=i386
set name=info.classification value="org.opensolaris.category.2008:System/Multimedia Libraries"
set name=pkg.human-version value="4.1"
<transform dir path=include -> edit path include usr/include>
<transform file -> edit path include usr/include>
<transform file -> edit path bin usr/bin>
<transform dir path=bin .* -> drop>
<transform dir path=usr .* -> drop>
<transform dir path=usr/bin .* -> drop>
<transform dir path=usr/include .* -> drop>
<transform dir path=usr/lib .* -> drop>
<transform dir path=usr/lib/amd64/pkgconfig .* -> drop>
<transform dir path=usr/share .* -> drop>
<transform dir path=usr/share/doc .* -> drop>
EOF

# pkgsend generate proto | pkgfmt > ffpmeg.p5m.1
# pkgmogrify -DARCH=`uname -p` ffpmeg.p5m.1 ffpmeg.mog | pkgfmt > ffpmeg.p5m.2
# pkgdepend generate -md proto ffpmeg.p5m.2 | pkgfmt > ffpmeg.p5m.3
# pkgdepend resolve -m ffpmeg.p5m.3

# pkglint -c ./lint-cache  ffpmeg.p5m.3.res

Note: Create a repository if one does not exists already (next 2 lines only once)
 # pkgrepo create my-repository
 # pkgrepo -s my-repository set publisher/prefix=mypublisher

# pkgsend -s my-repository publish -d proto ffpmeg.p5m.3.res
pkg://mypublisher/video/ffmpeg@4.1,0.1:20190402T141334Z
PUBLISHED

# pkgrepo info -s my-repository
PUBLISHER   PACKAGES STATUS           UPDATED
mypublisher 1        online           2019-04-02T14:15:25.653321Z

# pkg list -g my-repository
NAME (PUBLISHER)                                  VERSION                    IFO
video/ffmpeg (mypublisher)                        4.1                        i--

# pkgsign -s my-repository -a sha256 '*'
Signed pkg://mypublisher/video/ffmpeg@4.1:20190304T172716Z

# pkg set-publisher -p my-repository

# pkg publisher
PUBLISHER                   TYPE     STATUS P LOCATION
localhosts12                origin   online F http://sfe.opencsw.org/localhosts12/
solaris                     origin   online F http://ips.bbk.ac.uk/
solarisstudio               origin   online F https://pkg.oracle.com/solarisstudio/release/
mypublisher                 origin   online F file:///var/tmp/pkgs/my-repository/

# pkg install pkg://mypublisher/video/ffmpeg
Formatting: I now use http://codeformatter.blogspot.co.uk for code formatting.

No comments: