forked from x42/harvid
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathx-static.sh
executable file
·118 lines (106 loc) · 2.48 KB
/
x-static.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
#!/bin/bash
## compile a statically linked version of harvid for linux
## this requires a static build of ffmpeg; see x-pbuildstatic.sh
##
#path to the static ffmpeg installation
: ${PFX=$HOME/local}
#path to output directory -- /harvid*.tgz will end up there
: ${RESULT=/tmp}
VERSION=$(git describe --tags HEAD || echo "X.X.X")
TRIPLET=$(gcc -print-multiarch)
OUTFN=harvid-$TRIPLET-$VERSION
LIBF=$PFX/lib
BINF=$PFX/bin
export PKG_CONFIG_PATH=${LIBF}/pkgconfig
# ffmpeg needs this libs
LIBDEPS=" \
libpng12.a \
libjpeg.a \
libmp3lame.a \
libspeex.a \
libtheoraenc.a \
libtheoradec.a \
libogg.a \
libvorbis.a \
libvorbisenc.a \
libvorbisfile.a \
libschroedinger-1.0.a \
liborc-0.4.a \
libgsm.a \
libbluray.a \
libxvidcore.a \
libopus.a \
libbz2.a \
libvpx.a \
libopenjpeg.a \
libx264.a \
libz.a \
"
if test "`hostname`" == "soyuz"; then
LIBDEPS="$LIBDEPS \
libX11.a \
libxcb.a \
libXau.a \
libXdmcp.a \
"
fi
# resolve paths to static libs on the system
SLIBS=""
for SLIB in $LIBDEPS; do
echo "searching $SLIB.."
SL=`find /usr/lib -name "$SLIB"`
if test -z "$SL"; then
echo "not found."
exit 1
fi
SLIBS="$SLIBS $SL"
done
LIBHARVID_SRC=" \
libharvid/decoder_ctrl.c \
libharvid/ffdecoder.c \
libharvid/frame_cache.c \
libharvid/image_cache.c \
libharvid/timecode.c \
libharvid/vinfo.c \
"
# compile harvid
make -C src clean logo.o seek.o
mkdir -p tmp
gcc -DNDEBUG -DICSARCH=\"Linux\" -DICSVERSION=\"${VERSION}\" \
-Wall -O2 \
-o tmp/$OUTFN -Ilibharvid src/*.c ${LIBHARVID_SRC} src/logo.o src/seek.o \
`pkg-config --cflags libavcodec libavformat libavutil libpng libswscale` \
${CFLAGS} \
${LIBF}/libavformat.a \
${LIBF}/libavcodec.a \
${LIBF}/libswscale.a \
${LIBF}/libavdevice.a \
${LIBF}/libavutil.a \
\
$SLIBS \
-lm -ldl -pthread -lstdc++ \
|| exit 1
strip tmp/$OUTFN
ls -lh tmp/$OUTFN
ldd tmp/$OUTFN
# give any arg to disable bundle
test -n "$1" && exit 1
# build .tgz bundle
rm -rf $RESULT/$OUTFN $RESULT/$OUTFN.tgz
mkdir $RESULT/$OUTFN
cp tmp/$OUTFN $RESULT/$OUTFN/harvid
cp README.md $RESULT/$OUTFN/README
cp doc/harvid.1 $RESULT/$OUTFN/harvid.1
if test -f $BINF/ffmpeg_s; then
cp $BINF/ffmpeg_s $RESULT/$OUTFN/ffmpeg_harvid
fi
if test -f $BINF/ffprobe_s; then
cp $BINF/ffprobe_s $RESULT/$OUTFN/ffprobe_harvid
fi
cd $RESULT/ ; tar czf $RESULT/$OUTFN.tgz $OUTFN ; cd -
rm -rf $RESULT/$OUTFN
ls -lh $RESULT/$OUTFN.tgz
# ..and copy the bundle to the local gh-pages branch
test -d site/releases/ || exit
mv $RESULT/$OUTFN.tgz site/releases/
ls -lh site/releases/$OUTFN.tgz