mirror of
https://github.com/chocolate-doom/chocpkg.git
synced 2024-11-10 07:11:39 +00:00
Add separate install path for native tools.
We need to distinguish between tools we compile to use as part of the build process, and things we build for the eventual target. Install these into separate install directories; for now, pkg-config is the only one of these.
This commit is contained in:
parent
9162916169
commit
cb4b2cbdd6
5 changed files with 42 additions and 11 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,3 +1,4 @@
|
|||
build
|
||||
install
|
||||
install.native
|
||||
packages
|
||||
|
|
|
@ -9,9 +9,10 @@ basic_setup() {
|
|||
exit -1
|
||||
fi
|
||||
INSTALL_DIR="$CHOCPKG_ROOT/install"
|
||||
NATIVE_INSTALL_DIR="$CHOCPKG_ROOT/install.native"
|
||||
PACKAGES_DIR="$CHOCPKG_ROOT/packages"
|
||||
BUILD_DIR="$CHOCPKG_ROOT/build"
|
||||
mkdir -p "$INSTALL_DIR" "$PACKAGES_DIR" "$BUILD_DIR"
|
||||
mkdir -p "$INSTALL_DIR" "$NATIVE_INSTALL_DIR" "$PACKAGES_DIR" "$BUILD_DIR"
|
||||
}
|
||||
|
||||
basic_setup
|
||||
|
@ -49,14 +50,15 @@ configure_for_package() {
|
|||
fi
|
||||
# Defaults for package unless overridden:
|
||||
PACKAGE_NAME=$package
|
||||
PACKAGE_TYPE=fetch
|
||||
PACKAGE_SOURCE_TYPE=fetch
|
||||
PACKAGE_TYPE=target
|
||||
PACKAGE_CONFIGURE_OPTS=""
|
||||
DEPENDENCIES=""
|
||||
GIT_BRANCH=master
|
||||
. "$pkg_file"
|
||||
|
||||
# After reading the package file, configure a few more variables:
|
||||
case "$PACKAGE_TYPE" in
|
||||
case "$PACKAGE_SOURCE_TYPE" in
|
||||
fetch)
|
||||
PACKAGE_FILENAME="$PACKAGE_NAME-$PACKAGE_VERSION.tar.gz"
|
||||
PACKAGE_BUILD_DIR="$BUILD_DIR/$PACKAGE_NAME-$PACKAGE_VERSION"
|
||||
|
@ -64,10 +66,29 @@ configure_for_package() {
|
|||
git)
|
||||
PACKAGE_BUILD_DIR="$BUILD_DIR/$PACKAGE_NAME"
|
||||
;;
|
||||
*)
|
||||
error_exit "Unknown package source type $PACKAGE_SOURCE_TYPE"
|
||||
;;
|
||||
esac
|
||||
|
||||
# We set up build differently depending on the package type: some packages
|
||||
# are for the target we're building for; others are native tools to run on
|
||||
# the build machine as part of the build process.
|
||||
case "$PACKAGE_TYPE" in
|
||||
target)
|
||||
PACKAGE_INSTALL_DIR="$INSTALL_DIR"
|
||||
;;
|
||||
native)
|
||||
PACKAGE_INSTALL_DIR="$NATIVE_INSTALL_DIR"
|
||||
;;
|
||||
*)
|
||||
error_exit "Unknown package type $PACKAGE_TYPE"
|
||||
;;
|
||||
esac
|
||||
|
||||
# We must set PKG_CONFIG_PATH now so we know where to look for packages.
|
||||
PKG_CONFIG_PATH="$PACKAGE_INSTALL_DIR/lib/pkgconfig:${PKG_CONFIG_PATH:-}"
|
||||
export PKG_CONFIG_PATH
|
||||
}
|
||||
|
||||
download_package_file() {
|
||||
|
@ -90,7 +111,7 @@ extract_package_file() {
|
|||
}
|
||||
|
||||
fetch_package() {
|
||||
case "$PACKAGE_TYPE" in
|
||||
case "$PACKAGE_SOURCE_TYPE" in
|
||||
fetch)
|
||||
download_package_file
|
||||
extract_package_file
|
||||
|
@ -104,12 +125,19 @@ fetch_package() {
|
|||
}
|
||||
|
||||
setup_build_environment() {
|
||||
. "$CHOCPKG_ROOT/buildenv.sh"
|
||||
if [ "$PACKAGE_TYPE" = "target" ]; then
|
||||
. "$CHOCPKG_ROOT/buildenv.sh"
|
||||
fi
|
||||
|
||||
CPPFLAGS="-I$INSTALL_DIR/include"
|
||||
LDFLAGS="-L$INSTALL_DIR/lib ${LDFLAGS:-}"
|
||||
CPPFLAGS="-I$PACKAGE_INSTALL_DIR/include"
|
||||
LDFLAGS="-L$PACKAGE_INSTALL_DIR/lib ${LDFLAGS:-}"
|
||||
export CPPFLAGS LDFLAGS
|
||||
|
||||
# ACLOCAL_PATH is a special case: we include the aclocal paths from both
|
||||
# target and native, so that it is possible to get the pkg-config macros.
|
||||
ACLOCAL_PATH="$INSTALL_DIR/share/aclocal:${ACLOCAL_PATH:-}"
|
||||
export CPPFLAGS LDFLAGS ACLOCAL_PATH
|
||||
ACLOCAL_PATH="$NATIVE_INSTALL_DIR/share/aclocal:$ACLOCAL_PATH"
|
||||
export ACLOCAL_PATH
|
||||
}
|
||||
|
||||
build_package() {
|
||||
|
@ -123,13 +151,14 @@ 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."
|
||||
fi
|
||||
|
||||
./configure --prefix="$INSTALL_DIR" $PACKAGE_CONFIGURE_OPTS || (
|
||||
./configure --prefix="$PACKAGE_INSTALL_DIR" $PACKAGE_CONFIGURE_OPTS || (
|
||||
error_exit "Failed to configure package $PACKAGE_NAME for build."
|
||||
)
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
PACKAGE_TYPE=git
|
||||
PACKAGE_SOURCE_TYPE=git
|
||||
GIT_URL=https://github.com/fragglet/chocolate-doom.git
|
||||
GIT_BRANCH=sdl2-branch
|
||||
DEPENDENCIES="SDL2 SDL2_mixer SDL2_net"
|
||||
|
|
|
@ -2,4 +2,5 @@ PACKAGE_VERSION=0.28
|
|||
PACKAGE_URL=https://pkgconfig.freedesktop.org/releases/pkg-config-${PACKAGE_VERSION}.tar.gz
|
||||
PACKAGE_INSTALLED_TOOL=pkg-config
|
||||
PACKAGE_CONFIGURE_OPTS="--with-internal-glib"
|
||||
PACKAGE_TYPE=native
|
||||
|
||||
|
|
2
setup.sh
2
setup.sh
|
@ -20,5 +20,5 @@ exit -1
|
|||
esac
|
||||
|
||||
# Set up various environment variables:
|
||||
PATH="$CHOCPKG_ROOT/chocpkg:$CHOCPKG_ROOT/install/bin:$PATH"
|
||||
PATH="$CHOCPKG_ROOT/chocpkg:$CHOCPKG_ROOT/install.native/bin:$PATH"
|
||||
|
||||
|
|
Loading…
Reference in a new issue