Skip to content

Instantly share code, notes, and snippets.

@fkei
Last active November 8, 2017 02:07
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fkei/57d171ee060472161295 to your computer and use it in GitHub Desktop.
Save fkei/57d171ee060472161295 to your computer and use it in GitHub Desktop.
ffmpeg/imagemagick compile script (include libx264/ffmpeg,ffprobe/convert only/arch=x86_64 only/not doc/static library)
__os=$(shell uname)
__wget=$(shell which wget)
__tar=$(shell which tar)
__make=$(shell which make)
__mkdir=$(shell which mkdir)
__cp=$(shell which cp)
__rm=$(shell which rm)
__prefix=$(shell pwd)/build
__include=$(__prefix)/include
__lib=$(__prefix)/lib
__pkgconfig=$(__lib)/pkgconfig
__ffmpeg_url=https://github.com/FFmpeg/FFmpeg/releases/download/n3.0/ffmpeg-3.0.tar.gz
__ffmpeg_src=ffmpeg-3.0
__ffmpeg_tar_gz=$(__ffmpeg_src).tar.gz
__x264_git=https://git.videolan.org/git/x264.git
__x264_src=x264
__imagemagick_url=http://www.imagemagick.org/download/ImageMagick-6.9.3-10.tar.gz
__imagemagick_src=ImageMagick-6.9.3-10
__imagemagick_tar_gz=$(__imagemagick_src).tar.gz
dist=dist
all: clean x264-build ffmpeg-build imagemagick-build
clean:
$(__rm) -rf $(__ffmpeg_src) $(__ffmpeg_tar_gz) $(dist) $(__prefix) $(__x264_src) $(__imagemagick_url) $(__imagemagick_src) $(__imagemagick_tar_gz)
pre:
$(__mkdir) -p $(__prefix)
$(__mkdir) -p $(dist)
x264-build: pre
@if [ ! -d $(__x264_src) ]; then git clone $(__x264_git); fi
cd $(__x264_src); \
./configure --prefix=$(__prefix) --enable-static; \
$(__make); \
$(__make) install
ffmpeg-build: pre
@if [ ! -f $(__ffmpeg_tar_gz) ]; then $(__wget) $(__ffmpeg_url); $(__tar) xzvf $(__ffmpeg_tar_gz); fi
cd $(__ffmpeg_src); \
PKG_CONFIG_PATH="$(__pkgconfig)" \
./configure \
--prefix=$(__prefix) \
--extra-cflags="-I$(__include)" \
--extra-ldflags="-L$(__lib)" \
--pkg-config-flags="--static" \
--enable-gpl \
--disable-ffplay --disable-ffserver \
--disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages \
--arch=x86_64 \
--enable-libx264; \
$(__make)
$(__cp) -f $(__ffmpeg_src)/ffmpeg $(dist)
$(__cp) -f $(__ffmpeg_src)/ffprobe $(dist)
@echo "output ffmpeg binary's -> dist"
imagemagick-build: pre
@if [ ! -f $(__imagemagick_tar_gz) ]; then $(__wget) $(__imagemagick_url); $(__tar) xzvf $(__imagemagick_tar_gz); fi
cd $(__imagemagick_src); \
./configure \
--prefix=$(__prefix) \
--enable-shared=no \
--enable-static=yes \
--disable-openmp \
--with-modules \
--with-x \
--with-threads \
--with-magick_plus_plus \
--with-gslib \
--with-wmf \
--with-lcms2 \
--without-rsvg \
--with-xml \
--without-dps \
--without-included-ltdl \
--with-ltdl-include=/usr/include \
--with-ltdl-lib=/usr/lib64; \
$(__make)
$(__cp) -f $(__imagemagick_src)/utilities/convert $(dist)
.PHONY: all clean pre x264-build ffmpeg-build imagemagick-build
@fkei
Copy link
Author

fkei commented Mar 8, 2016

  • Test Build
    • OS X El Capitan‎
    • AWS Lambda Server (ami-678b8a09)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment