--- /dev/null
+#!/bin/bash -x
+
+TOPDIR=`pwd`
+THIRDPARTY=$TOPDIR/thirdparty
+echo "TOPDIR=$TOPDIR" > global_config
+echo "THIRDPARTY=$TOPDIR/thirdparty" >> global_config
+
+cpus=`grep -c "^proc" /proc/cpuinfo`
+( cd $THIRDPARTY; ./configure cv; \
+ export CFG_VARS='CFLAGS+=" -fPIC"'; \
+ export MAK_VARS='CFLAGS+=" -fPIC"'; \
+ export CFG_PARAMS="--with-pic --enable-pic --disable-asm"; \
+ make -j$cpus >& log )
+
+static_libs=`make -C $THIRDPARTY -s val-static_libraries`
+static_includes=`make -C $THIRDPARTY -s val-static_includes`
+
+export LDFLAGS=`for f in $static_libs; do
+ if [ ! -f "$f" ]; then continue; fi;
+ ls $f
+done | sed -e 's;/[^/]*$;;' | \
+sort -u | while read d; do
+ echo -n " -L$d";
+done`
+
+export LIBS=`for f in $static_libs; do
+ if [ ! -f "$f" ]; then continue; fi;
+ ls $f
+done | sed -e 's;.*/;;' -e 's;lib\(.*\)\.a$;\1;' | \
+sort -u | while read a; do
+ echo -n " -l$a";
+done`
+
+export CFLAGS="$static_includes"
+export CXXFLAGS="$static_includes"
+
+if [ ! -f configure ]; then
+ ./autogen.sh
+fi
+sed -e 's/^LIBX264_LIBS=""/#LIBX264_LIBS=""/' -i configure
+
+export MJPEG_LIBS="-L$THIRDPARTY/mjpegtools-2.1.0/utils/.libs -lmjpegutils \
+ -L$THIRDPARTY/mjpegtools-2.1.0/lavtools/.libs -llavfile \
+ -L$THIRDPARTY/mjpegtools-2.1.0/lavtools/.libs -llavjpeg \
+ -L$THIRDPARTY/mjpegtools-2.1.0/mpeg2enc/.libs -lmpeg2encpp \
+ -L$THIRDPARTY/mjpegtools-2.1.0/mplex/.libs -lmplex2"
+export MJPEG_CFLAGS="-I$THIRDPARTY/mjpegtools-2.1.0/. \
+ -I$THIRDPARTY/mjpegtools-2.1.0/lavtools \
+ -I$THIRDPARTY/mjpegtools-2.1.0/utils"
+
+export LIBX264_CFLAGS="-I$THIRDPARTY/x264-20151229/."
+export LIBX264_LIBS="-L$THIRDPARTY/x264-20151229/. -lx264"
+
+for f in $MJPEG_LIBS $LIBX264_LIBS; do
+ LIBS=`echo "$LIBS" | sed -e "s/[ ]*\<$f\>[ ]*/ /"`
+done
+
+echo LDFLAGS=$LDFLAGS
+echo LIBS=$LIBS
+echo CFLAGS=$CFLAGS
+
+./configure
+
$(call pkg-config,$(1)): $(call pkg-source,$(1)) $(foreach dep,$(2),$(call bld_depends,$(dep)))
@echo "CONFIGURING $(1)"
cd $(1)* && \
- $($(1).cfg_vars) ./configure $($(1).cfg_params)
+ $($(1).cfg_vars) $(CFG_VARS) ./configure $($(1).cfg_params) $(CFG_PARAMS)
touch $$@
$(call pkg-built,$(1)): $(call pkg-config,$(1))
- +$($(1).mak_vars) make -C $(1)* $($(1).mak_params)
+ +$($(1).mak_vars) $(MAK_VARS) make -C $(1)* $($(1).mak_params) $(MAK_PARAMS)
touch $$@
endef
-ldl $(EXTRA_LIBS)" \
--extra-ldflags="-ldl"
+a52dec.mak_params= ; cd $(call bld_path,a52dec,include); ln -sf . a52dec
audiofile.cfg_params=--enable-shared=no
audiofile.mak_params=LIBS="-lm -lstdc++"
flac.cfg_params= --enable-shared=no
giflib.cfg_params=--enable-shared=no
ilmbase.cfg_params=--prefix=$(call bld_path,ilmbase,usr)
ilmbase.mak_params=; make -C ilmbase* install; cd $(call bld_path,ilmbase); ln -sf lib64 usr/lib
-lame.cfg_vars= CFLAGS=-O
+lame.cfg_vars= CFLAGS+=" -O"
lame.cfg_params=--enable-shared=no
lame.mak_params= ; cd $(call bld_path,lame,include); ln -sf . lame
mjpegtools.cflags="$(call inc_path,libjpeg) $(call ld_path,libjpeg,.libs)"
rules=$(eval $(1))
endif
+$(call rules,$(call std-build,a52dec))
$(call rules,$(call std-build,audiofile))
$(call rules,$(call std-build,encore))
$(call rules,$(call std-build,esound,audiofile))
STATIC_LIBRARIES="y"
elif [ "$1" = "shared" ]; then
STATIC_LIBRARIES="n"
+elif [ "$1" = "cv" ]; then
+ STATIC_LIBRARIES="n"
+ libs="libogg libtheora libvorbis openexr libdv libjpeg tiff x264 mjpegtools a52dec lame libsndfile faac faad2"
+ forced_libs="mjpegtools x264"
else
- echo "usage: $0 <static | shared>"
+ echo "usage: $0 <static | shared | cv>"
exit 1
fi
append $sta_lib $@
}
+inc_a52dec="include"
+add_library a52dec \
+ liba52/.libs/liba52.a
inc_audiofile="."
add_library audiofile \
libaudiofile/.libs/libaudiofile.a \
add_library libvpx \
libvpx.a \
+echo ""
+if [ -n "$libs" ]; then
+ LIBS="$libs"
+fi
+
n=0
for lib in $LIBS; do
echo -n " $lib"
# dynamic library paths
probe() {
+ if ! `echo $LIBS | grep -qw $1`; then return 0; fi
local name="$1"
local headers="$2"
local func="$3"
}
# test for shared libs/header files
+probe a52dec "a52.h" a52_init -la52
probe audiofile "audiofile.h" afOpenFile -laudiofile
probe faac "stdint.h faac.h" faacEncGetVersion -lfaac
probe faad2 "faad.h" NeAACDecInit -lfaad
probe x264 "stdint.h x264.h" x264_encoder_encode -lx264
probe x265 "x265.h" x265_encoder_encode -lx265
-echo ""
+if [ -n "$forced_libs" ]; then
+ forced_libs="encore ffmpeg giflib libuuid"
+fi
+
# for ffmpeg link/broken disto libs
-forced_libs="encore ffmpeg giflib libuuid"
for name in $LIBS; do
if is_in $name $forced_libs; then
set - ${!name}