Split out build environment setup to a separate file.

This commit is contained in:
Simon Howard 2016-02-16 23:34:05 -05:00
parent 10f650eb58
commit 9162916169
3 changed files with 26 additions and 22 deletions

19
buildenv.sh Normal file
View file

@ -0,0 +1,19 @@
# The compiler that will be used to build packages for the target system.
# Change this to cross-compile, etc.
CC=gcc
CXX=g++
export CC CXX
# On OS X, we must set additional options: build 32-bit binaries, and the
# target API version.
if [ $(uname) = "Darwin" ]; then
CC="gcc -m32"
CXX="g++ -m32"
LDFLAGS="-lobjc ${LDFLAGS:-}"
MACOSX_DEPLOYMENT_TARGET=10.7
export MACOSX_DEPLOYMENT_TARGET
else
LDFLAGS="-Wl,-rpath -Wl,$INSTALL_DIR/lib ${LDFLAGS:-}"
fi

View file

@ -104,26 +104,15 @@ fetch_package() {
}
setup_build_environment() {
CPPFLAGS="-I$INSTALL_DIR/include -I$INSTALL_DIR/include/SDL"
LDFLAGS="-L$INSTALL_DIR/lib $LDFLAGS"
ACLOCAL_PATH="$INSTALL_DIR/share/aclocal:$ACLOCAL_PATH"
export CPPFLAGS LDFLAGS ACLOCAL_PATH
. "$CHOCPKG_ROOT/buildenv.sh"
if [ $(uname) = "Darwin" ]; then
CC="gcc -m32"
CXX="g++ -m32"
LDFLAGS="-lobjc $LDFLAGS"
MACOSX_DEPLOYMENT_TARGET=10.5
export CC CXX MACOSX_DEPLOYMENT_TARGET
else
LDFLAGS="-Wl,-rpath -Wl,$INSTALL_DIR/lib $LDFLAGS"
fi
CPPFLAGS="-I$INSTALL_DIR/include"
LDFLAGS="-L$INSTALL_DIR/lib ${LDFLAGS:-}"
ACLOCAL_PATH="$INSTALL_DIR/share/aclocal:${ACLOCAL_PATH:-}"
export CPPFLAGS LDFLAGS ACLOCAL_PATH
}
build_package() {
if [ "$PACKAGE_NAME" != "pkg-config" ]; then
chocpkg install pkg-config
fi
for dep in $DEPENDENCIES; do
chocpkg install "$dep"
done
@ -134,6 +123,7 @@ build_package() {
echo =======================================================
echo
cd "$PACKAGE_BUILD_DIR"
setup_build_environment
if ! prebuild_setup; then
error_exit "Failed pre-build setup step for $PACKAGE_NAME."

View file

@ -4,11 +4,6 @@ GIT_BRANCH=sdl2-branch
DEPENDENCIES="SDL2 SDL2_mixer SDL2_net"
prebuild_setup() {
mkdir -p autotools
aclocal -I "$INSTALL_DIR/share/aclocal"
autoheader
automake -a -c
autoconf
automake
bash ./autogen.sh
}