Navigation Menu

Skip to content

Commit

Permalink
buildscripts: Stop misusing --prefix
Browse files Browse the repository at this point in the history
This makes local build paths end up in pkg-config files, preventing
e.g. transferring the "prefix" dir to another environment.
Instead, provide DESTDIR on installation and use the
sysroot feature of pkg-config.
  • Loading branch information
sfan5 committed Dec 22, 2017
1 parent 078ce24 commit 5b5b4ed
Show file tree
Hide file tree
Showing 10 changed files with 27 additions and 23 deletions.
7 changes: 7 additions & 0 deletions buildscripts/buildall.sh
Expand Up @@ -45,6 +45,13 @@ loadarch () {
else
export CC=$ndk_triple-gcc
fi

if [ ! -d "./prefix$dir_suffix" ]; then
mkdir "prefix$dir_suffix"
# enforce flat structure (/usr/local -> /)
ln -s . "./prefix$dir_suffix/usr"
ln -s . "./prefix$dir_suffix/local"
fi
}

build () {
Expand Down
6 changes: 6 additions & 0 deletions buildscripts/path.sh
Expand Up @@ -12,5 +12,11 @@ if [ "$os" == "macosx" ]; then
export SED=gsed
fi

# configure pkg-config paths if inside buildscripts
if [ -n "$ndk_triple" ]; then
export PKG_CONFIG_SYSROOT_DIR="$PWD/../../prefix$dir_suffix"
export PKG_CONFIG_LIBDIR="$PKG_CONFIG_SYSROOT_DIR/lib/pkgconfig"
fi

export PATH="$DIR/sdk/ndk-toolchain$ndk_suffix/bin:$DIR/sdk/android-ndk-r16b:$DIR/sdk/android-sdk-$os/tools:$PATH"
export ANDROID_HOME="$DIR/sdk/android-sdk-$os"
5 changes: 2 additions & 3 deletions buildscripts/scripts/ffmpeg.sh
Expand Up @@ -22,13 +22,12 @@ cpuflags="-ftree-vectorize"
[[ "$ndk_triple" == "arm"* ]] && cpuflags="$cpuflags -mfpu=neon -mcpu=cortex-a8"

prefix="`pwd`/../../../prefix$dir_suffix"
PKG_CONFIG_LIBDIR="$prefix/lib/pkgconfig" \
../configure \
--target-os=android --enable-cross-compile --cross-prefix=$ndk_triple- --cc=$CC \
--arch=${ndk_triple%%-*} --cpu=$cpu --enable-{jni,mediacodec,gmp,gnutls} \
--extra-cflags="-I$prefix/include $cpuflags" --extra-ldflags="-L$prefix/lib" \
--disable-static --enable-shared --enable-version3 \
--prefix="$prefix" --pkg-config=pkg-config --disable-{debug,doc}
--pkg-config=pkg-config --disable-{debug,doc}

make -j6
make install
make DESTDIR="$prefix" install
5 changes: 2 additions & 3 deletions buildscripts/scripts/freetype2.sh
Expand Up @@ -20,8 +20,7 @@ PKG_CONFIG=/bin/false \
../configure \
--host=$ndk_triple \
--enable-static --disable-shared \
--with-png=no \
--prefix="`pwd`/../../../prefix$dir_suffix"
--with-png=no

make -j6
make install
make DESTDIR="`pwd`/../../../prefix$dir_suffix" install
5 changes: 2 additions & 3 deletions buildscripts/scripts/fribidi.sh
Expand Up @@ -19,8 +19,7 @@ cd _build$dir_suffix
PKG_CONFIG=/bin/false \
../configure \
--host=$ndk_triple \
--enable-static --disable-shared \
--prefix="`pwd`/../../../prefix$dir_suffix"
--enable-static --disable-shared

make -j6
make install
make DESTDIR="`pwd`/../../../prefix$dir_suffix" install
6 changes: 2 additions & 4 deletions buildscripts/scripts/gnutls.sh
Expand Up @@ -18,16 +18,14 @@ extra=
[[ "$ndk_triple" == "aarch64"* && "$CC" == *"clang" ]] \
&& extra="--disable-hardware-acceleration"

PKG_CONFIG_LIBDIR="`pwd`/../../../prefix$dir_suffix/lib/pkgconfig" \
../configure \
--host=$ndk_triple $extra \
--enable-static --disable-shared \
--with-nettle-mini --with-included-{libtasn1,unistring} \
--disable-{doc,tools,cxx,tests} --without-p11-kit \
--prefix="`pwd`/../../../prefix$dir_suffix"
--disable-{doc,tools,cxx,tests} --without-p11-kit

make -j6
make install
make DESTDIR="`pwd`/../../../prefix$dir_suffix" install
# fix linking (pkg-config seems to ignore Requires.private)
${SED:-sed} '/^Libs:/ s|$| -lnettle -lhogweed|' -i \
../../../prefix$dir_suffix/lib/pkgconfig/gnutls.pc
6 changes: 2 additions & 4 deletions buildscripts/scripts/libass.sh
Expand Up @@ -16,12 +16,10 @@ fi
mkdir -p _build$dir_suffix
cd _build$dir_suffix

PKG_CONFIG_LIBDIR="`pwd`/../../../prefix$dir_suffix/lib/pkgconfig" \
../configure \
--host=$ndk_triple \
--enable-static --disable-shared \
--disable-require-system-font-provider \
--prefix="`pwd`/../../../prefix$dir_suffix"
--disable-require-system-font-provider

make -j6
make install
make DESTDIR="`pwd`/../../../prefix$dir_suffix" install
2 changes: 1 addition & 1 deletion buildscripts/scripts/lua.sh
Expand Up @@ -26,7 +26,7 @@ make INSTALL=${INSTALL:-install} INSTALL_TOP=`pwd`/../../prefix$dir_suffix TO_BI

# make pc only generates a partial pkg-config file because ????
mkdir -p ../../prefix$dir_suffix/lib/pkgconfig
make INSTALL_TOP=`pwd`/../../prefix pc > ../../prefix$dir_suffix/lib/pkgconfig/lua.pc
make pc > ../../prefix$dir_suffix/lib/pkgconfig/lua.pc
cat >>../../prefix$dir_suffix/lib/pkgconfig/lua.pc <<'EOF'
Name: Lua
Description:
Expand Down
3 changes: 1 addition & 2 deletions buildscripts/scripts/mpv.sh
Expand Up @@ -16,12 +16,11 @@ fi
extrald=
[[ "$ndk_triple" == "aarch64"* ]] && extrald="-fuse-ld=gold"

PKG_CONFIG_LIBDIR="`pwd`/../../prefix$dir_suffix/lib/pkgconfig" \
LDFLAGS="$extrald" \
./waf configure \
--disable-iconv --lua=52 \
--enable-libmpv-shared \
--prefix=/ --disable-manpage-build \
--disable-manpage-build \
-o "`pwd`/_build$dir_suffix"

./waf build -p -j6
Expand Down
5 changes: 2 additions & 3 deletions buildscripts/scripts/nettle.sh
Expand Up @@ -16,11 +16,10 @@ cd _build$dir_suffix

../configure \
--host=$ndk_triple \
--enable-mini-gmp --disable-shared \
--prefix="`pwd`/../../../prefix$dir_suffix"
--enable-mini-gmp --disable-shared

make -j6
make install
make DESTDIR="`pwd`/../../../prefix$dir_suffix" install
# for ffmpeg:
cat >../../../prefix$dir_suffix/include/gmp.h <<'EOF'
#include <nettle/mini-gmp.h>
Expand Down

0 comments on commit 5b5b4ed

Please sign in to comment.