1 | #!/bin/bash
|
---|
2 |
|
---|
3 | package=chromaprint
|
---|
4 | version=-v1.5.0
|
---|
5 |
|
---|
6 | progname=$0
|
---|
7 |
|
---|
8 | source ../cascade-make/lib/cascade-lib.bash GEXT_MARS ../.. $*
|
---|
9 |
|
---|
10 | prefix=$GEXT_MARS_INSTALLED
|
---|
11 |
|
---|
12 | #export CFLAGS="$CFLAGS -fPIC"
|
---|
13 | #export CXXFLAGS="$CXXFLAGS -fPIC"
|
---|
14 | #export LDFLAGS="$LDFLAGS -fPIC"
|
---|
15 |
|
---|
16 | export CFLAGS="$CFLAGS -I$GEXT_MARS_INSTALLED/include"
|
---|
17 | #export CPPFLAGS="$CPPFLAGS -I$GEXT_MARS_INSTALLED/include"
|
---|
18 | export CXXFLAGS="$CXXFLAGS -I$GEXT_MARS_INSTALLED/include"
|
---|
19 | export LDFLAGS="$LDFLAGS -L$GEXT_MARS_INSTALLED/lib"
|
---|
20 | #export LD_LIBRARY_PATH="$GEXT_MARS_INSTALLED/lib"
|
---|
21 |
|
---|
22 |
|
---|
23 | # The following is a workaround that lets 'fpcalc' (the final executable generate) to compile.
|
---|
24 | #
|
---|
25 | # In theory this shouldn't be needed, but it would appear the 'cmake' rule to Chromaprint
|
---|
26 | # don't correctly work out that linking in a static -lavcodec means that -lz also need to be present.
|
---|
27 | # Awkward to try and change the rule within cmake, so the decision was made to include it through
|
---|
28 | # the LDFLAGS environment variable, even though that means it's presented to all the linking
|
---|
29 | # commands in the project.
|
---|
30 |
|
---|
31 | # How did we get here?
|
---|
32 | #
|
---|
33 | # The fix is considered a small price to pay in working through a more complicated sequence of
|
---|
34 | # errors we had been getting.
|
---|
35 | #
|
---|
36 | # 1. With default params, chromaprint generates both static and shared libraries. However, compilation
|
---|
37 | # failed trying to generate the shared library, as it could not link against the static
|
---|
38 | # libavcodec.a (-fPIC issue).
|
---|
39 | # 2. So, next we went back to 'ffmpeg' and changed its configure statement to enable shared libraries.
|
---|
40 | # However, this lead to a new linking error to do with 'inflate' (in libz) not being found.
|
---|
41 | # (It wasn't clear at that point which libz it should be looking for. It was thought that it
|
---|
42 | # was probably a system-wide installed one, and perhaps one that was perhaps just the .so file)
|
---|
43 | # 3. The decision at that point was made to bundle a version of libz within the 'devel' folder
|
---|
44 | # to this extension, and point packages known to need it explicity at that.
|
---|
45 | #
|
---|
46 | # Step 3 resulted in successful compilation, notwithstanding, the little bugbear that 'fpcalc'
|
---|
47 | # fails to include -lz in its linking command (hence the workaround used here!)
|
---|
48 |
|
---|
49 | export LDFLAGS="$LDFLAGS -lz"
|
---|
50 |
|
---|
51 | if [ "x$PKG_CONFIG_PATH" = "x" ] ; then
|
---|
52 | export PKG_CONFIG_PATH="$GEXT_MARS_INSTALLED/lib/pkgconfig"
|
---|
53 | else
|
---|
54 | export PKG_CONFIG_PATH="$GEXT_MARS_INSTALLED/lib/pkgconfig:$PKG_CONFIG_PATH"
|
---|
55 |
|
---|
56 | fi
|
---|
57 |
|
---|
58 | opt_run_untar $force_untar $auto_untar $package $version
|
---|
59 |
|
---|
60 | #opt_run_configure $force_config $auto_config $package $version $prefix
|
---|
61 | if [ $force_config = "1" ] ; then
|
---|
62 | echo "[pushd $package$version]"
|
---|
63 | cd $package$version ;
|
---|
64 |
|
---|
65 | if [ ! -f Makefile ] ; then \
|
---|
66 | #cmake -D CMAKE_BUILD_TYPE=RELEASE \
|
---|
67 | # -D CMAKE_INSTALL_PREFIX=$prefix ..;
|
---|
68 | cmake -DCMAKE_BUILD_TYPE=Release \
|
---|
69 | -DCMAKE_INSTALL_PREFIX=$prefix \
|
---|
70 | -DBUILD_TOOLS=ON . \
|
---|
71 | -DBUILD_SHARED_LIBS=OFF \
|
---|
72 | -DCMAKE_C_FLAGS="$CFLAGS" \
|
---|
73 | -DCMAKE_CXX_FLAGS="$CXXFLAGS" \
|
---|
74 | -DCMAKE_EXE_LINKER_FLAGS="$LDFLAGS"
|
---|
75 |
|
---|
76 | fi ;
|
---|
77 | cd ..
|
---|
78 |
|
---|
79 | fi
|
---|
80 |
|
---|
81 | opt_run_make $compile $package $version
|
---|
82 | opt_run_make $install $package $version "install"
|
---|
83 |
|
---|
84 | opt_run_make $clean $package $version "clean"
|
---|
85 | opt_run_make $distclean $package $version "distclean"
|
---|
86 |
|
---|
87 | opt_run_tarclean $tarclean $package $version
|
---|