Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Pierre-Yves Kerembellec authored and pyke369 committed Sep 16, 2011
0 parents commit 27825cb
Show file tree
Hide file tree
Showing 9 changed files with 263 additions and 0 deletions.
103 changes: 103 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
PROJECT(ffmpeg)

CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
INCLUDE(ExternalProject)
INCLUDE_DIRECTORIES(BEFORE ${CMAKE_BINARY_DIR}/include)
LINK_DIRECTORIES(${CMAKE_BINARY_DIR}/lib)

EXTERNALPROJECT_ADD(
z
URL http://zlib.net/zlib-1.2.5.tar.gz
PATCH_COMMAND patch Makefile.in ${CMAKE_SOURCE_DIR}/vendor/zlib-1.2.5-static.patch
CONFIGURE_COMMAND ./configure --prefix=${CMAKE_BINARY_DIR} --static
BUILD_IN_SOURCE 1
)
EXTERNALPROJECT_ADD(
openssl
URL http://www.openssl.org/source/openssl-1.0.0d.tar.gz
CONFIGURE_COMMAND ./config no-shared no-idea no-mdc2 no-rc5 --prefix=${CMAKE_BINARY_DIR}
BUILD_COMMAND make depend && make
BUILD_IN_SOURCE 1
)
EXTERNALPROJECT_ADD(
opencore
URL http://downloads.sourceforge.net/project/opencore-amr/opencore-amr/0.1.2/opencore-amr-0.1.2.tar.gz
CONFIGURE_COMMAND ./configure --prefix=${CMAKE_BINARY_DIR} --disable-shared
BUILD_IN_SOURCE 1
)
EXTERNALPROJECT_ADD(
faac
URL http://downloads.sourceforge.net/project/faac/faac-src/faac-1.28/faac-1.28.tar.gz
CONFIGURE_COMMAND ./configure --prefix=${CMAKE_BINARY_DIR} --disable-shared --without-mp4v2
BUILD_IN_SOURCE 1
)
EXTERNALPROJECT_ADD(
mp3lame
URL http://downloads.sourceforge.net/project/lame/lame/3.98.4/lame-3.98.4.tar.gz
CONFIGURE_COMMAND ./configure --prefix=${CMAKE_BINARY_DIR} --disable-shared
BUILD_IN_SOURCE 1
)
EXTERNALPROJECT_ADD(
ogg
URL http://downloads.xiph.org/releases/ogg/libogg-1.2.2.tar.gz
CONFIGURE_COMMAND ./configure --prefix=${CMAKE_BINARY_DIR} --disable-shared
BUILD_IN_SOURCE 1
)
EXTERNALPROJECT_ADD(
speex
DEPENDS ogg
URL http://downloads.xiph.org/releases/speex/speex-1.2rc1.tar.gz
CONFIGURE_COMMAND ./configure --prefix=${CMAKE_BINARY_DIR} --disable-shared --enable-sse --disable-oggtest --with-ogg=${CMAKE_BINARY_DIR}
BUILD_IN_SOURCE 1
)
EXTERNALPROJECT_ADD(
vorbis
DEPENDS ogg
URL http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.2.tar.gz
CONFIGURE_COMMAND ./configure --prefix=${CMAKE_BINARY_DIR} --disable-shared --disable-oggtest
BUILD_IN_SOURCE 1
)
EXTERNALPROJECT_ADD(
theora
DEPENDS ogg
URL http://downloads.xiph.org/releases/theora/libtheora-1.2.0alpha1.tar.gz
CONFIGURE_COMMAND ./configure --prefix=${CMAKE_BINARY_DIR} --disable-shared --disable-oggtest --disable-examples --with-ogg=${CMAKE_BINARY_DIR}
BUILD_IN_SOURCE 1
)
EXTERNALPROJECT_ADD(
xvidcore
URL http://downloads.xvid.org/downloads/xvidcore-1.3.2.tar.gz
CONFIGURE_COMMAND cd build/generic && ./configure --prefix=${CMAKE_BINARY_DIR}
BUILD_COMMAND cd build/generic && make
INSTALL_COMMAND cd build/generic && make install
BUILD_IN_SOURCE 1
)
EXTERNALPROJECT_ADD(
x264
URL ftp://ftp.videolan.org/pub/x264/snapshots/last_x264.tar.bz2
CONFIGURE_COMMAND ./configure --prefix=${CMAKE_BINARY_DIR} --enable-static
BUILD_IN_SOURCE 1
)
EXTERNALPROJECT_ADD(
vpx
URL http://webm.googlecode.com/files/libvpx-v0.9.6.tar.bz2
CONFIGURE_COMMAND ./configure --prefix=${CMAKE_BINARY_DIR} --disable-shared
BUILD_IN_SOURCE 1
)
EXTERNALPROJECT_ADD(
rtmp
DEPENDS z openssl
URL http://rtmpdump.mplayerhq.hu/download/rtmpdump-2.3.tgz
PATCH_COMMAND patch -p1 < ${CMAKE_SOURCE_DIR}/vendor/rtmpdump-2.3-prefix.patch
CONFIGURE_COMMAND ""
BUILD_COMMAND make PREFIX=${CMAKE_BINARY_DIR} SHARED= XCFLAGS=-I${CMAKE_BINARY_DIR}/include XLDFLAGS=-L${CMAKE_BINARY_DIR}/lib XLIBS=-ldl
INSTALL_COMMAND make PREFIX=${CMAKE_BINARY_DIR} SHARED= install
BUILD_IN_SOURCE 1
)
EXTERNALPROJECT_ADD(
ffmpeg
DEPENDS opencore faac mp3lame ogg speex vorbis theora xvidcore x264 vpx rtmp
URL http://www.ffmpeg.org/releases/ffmpeg-snapshot-git.tar.bz2
CONFIGURE_COMMAND PKG_CONFIG_PATH=${CMAKE_BINARY_DIR}/lib/pkgconfig ./configure --prefix=${CMAKE_BINARY_DIR} --datadir=${CMAKE_BINARY_DIR}/etc --disable-shared --enable-static --enable-gpl --enable-version3 --enable-nonfree --disable-doc --disable-debug --disable-ffplay --disable-ffserver --disable-avdevice --disable-indevs --disable-outdevs --enable-runtime-cpudetect --enable-memalign-hack --extra-cflags=-I${CMAKE_BINARY_DIR}/include\ --static --extra-ldflags=-L${CMAKE_BINARY_DIR}/lib\ -static --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libfaac --enable-libmp3lame --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid --enable-libvpx --enable-librtmp
BUILD_IN_SOURCE 1
)
17 changes: 17 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
sffmpeg:
@mkdir -p build && \
cd build && \
cmake -DCMAKE_BUILD_TYPE=Release .. && \
make

distclean:
@rm -rf build

clean:

deb:
@debuild -i -us -uc -b

debclean:
@debuild clean

59 changes: 59 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
`sffmpeg` is a simple cmake-based full-featured FFmpeg static build helper.

It currently works on Linux, OpenBSD, FreeBSD, and MacOSX. It has been tested the most heavily on Linux/x86_64 (Ubuntu 11.04).
The helper will grab the latest versions of most FFmpeg dependencies, providing a way to effectively build, test and compare
multiple static builds of FFmpeg on the same host.

Requirements
------------

`sffmpeg` requires:

- a POSIX-compliant system (virtually any system today).
- a working C compiler (preferably [gcc](http://gcc.gnu.org/)) and assembler (preferably [yasm](http://yasm.tortall.net/)).
- a recent [cmake](http://www.cmake.org/) version (2.8+).
- the [pkg-config](http://www.freedesktop.org/wiki/Software/pkg-config) utility.

Usage
-----

Just type the following commands at the shell prompt:

$ git clone [email protected]/pyke369/sffmpeg
$ cd sffmpeg
$ make

Then go grab a coffee (or maybe two). The helper will download and compile all FFmpeg dependencies for you.
Once done, you should get a static system-independent FFmpeg binary in the `build/bin` directory.

$ ./build/bin/ffmpeg
ffmpeg version N-31627-g9c2651a, Copyright (c) 2000-2011 the FFmpeg developers
built on Jul 23 2011 19:37:59 with gcc 4.5.2
libavutil 51. 11. 0 / 51. 11. 0
libavcodec 53. 9. 0 / 53. 9. 0
libavformat 53. 6. 0 / 53. 6. 0
libavfilter 2. 27. 3 / 2. 27. 3
libswscale 2. 0. 0 / 2. 0. 0
libpostproc 51. 2. 0 / 51. 2. 0
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...

$ ldd ./build/bin/ffmpeg
not a dynamic executable

From there, you may use the binary immediately or build a Debian package for later deployment (see below).

Packaging
---------

You may optionally build a Debian package by typing the following command at the shell prompt:

$ make deb

All binaries and support files will be installed by the package in the `/usr/local` directory.

$ sudo dpkg -i sffmpeg_1.0.0_amd64.deb
Selecting previously deselected package sffmpeg.
(Reading database ... 60348 files and directories currently installed.)
Unpacking sffmpeg (from sffmpeg_1.0.0_amd64.deb) ...
Setting up sffmpeg (1.0.0) ...
5 changes: 5 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
sffmpeg (1.0.0) stable; urgency=low

* Initial package

-- Pierre-Yves Kerembellec <[email protected]> Sat, 16 Jul 2011 21:42:31 +0200
1 change: 1 addition & 0 deletions debian/compat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
5
8 changes: 8 additions & 0 deletions debian/control
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Source: sffmpeg
Priority: optional
Maintainer: Pierre-Yves Kerembellec <[email protected]>
Standards-Version: 3.7.2

Package: sffmpeg
Architecture: any
Description: Static build of the latest FFmpeg binaries
39 changes: 39 additions & 0 deletions debian/rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/usr/bin/make -f

build: build-stamp

build-stamp:
dh_testdir
$(MAKE)
touch build-stamp

clean:
dh_testdir
dh_testroot
rm -f build-stamp
$(MAKE) clean
dh_clean

install: build
dh_testdir
dh_testroot
dh_prep
dh_installdirs
dh_install build/bin/ffmpeg /usr/local/bin
dh_install build/bin/ffprobe /usr/local/bin
dh_install build/etc/*.ffpreset /usr/local/etc

binary-indep: build install

binary-arch: build install
dh_testdir
dh_testroot
dh_installinit
dh_fixperms
dh_installdeb
dh_gencontrol
dh_md5sums
dh_builddeb

binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install
22 changes: 22 additions & 0 deletions vendor/rtmpdump-2.3-prefix.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
diff -Naur rtmpdump-2.3/librtmp/Makefile rtmpdump-2.3-prefix/librtmp/Makefile
--- rtmpdump-2.3/librtmp/Makefile 2010-06-30 22:01:28.000000000 +0200
+++ rtmpdump-2.3-prefix/librtmp/Makefile 2011-07-21 19:32:54.031962047 +0200
@@ -1,6 +1,6 @@
VERSION=v2.3

-prefix=/usr/local
+prefix=$(PREFIX)

CC=$(CROSS_COMPILE)gcc
LD=$(CROSS_COMPILE)ld
diff -Naur rtmpdump-2.3/Makefile rtmpdump-2.3-prefix/Makefile
--- rtmpdump-2.3/Makefile 2010-06-30 21:58:35.000000000 +0200
+++ rtmpdump-2.3-prefix/Makefile 2011-07-21 19:32:40.401962576 +0200
@@ -1,6 +1,6 @@
VERSION=v2.3

-prefix=/usr/local
+prefix=$(PREFIX)

CC=$(CROSS_COMPILE)gcc
LD=$(CROSS_COMPILE)ld
9 changes: 9 additions & 0 deletions vendor/zlib-1.2.5-static.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
@@ -168,7 +168,7 @@
-@if [ ! -d $(DESTDIR)$(man3dir) ]; then mkdir -p $(DESTDIR)$(man3dir); fi
-@if [ ! -d $(DESTDIR)$(pkgconfigdir) ]; then mkdir -p $(DESTDIR)$(pkgconfigdir); fi
cp $(STATICLIB) $(DESTDIR)$(libdir)
- cp $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir)
+ if test "$(SHAREDLIBV)"; then cp $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir); fi
cd $(DESTDIR)$(libdir); chmod u=rw,go=r $(STATICLIB)
-@(cd $(DESTDIR)$(libdir); $(RANLIB) libz.a || true) >/dev/null 2>&1
-@cd $(DESTDIR)$(sharedlibdir); if test "$(SHAREDLIBV)" -a -f $(SHAREDLIBV); then \

0 comments on commit 27825cb

Please sign in to comment.