summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorLucio Andrés Illanes Albornoz <lucio@lucioillanes.de>2020-05-15 09:48:40 +0100
committerLucio Andrés Illanes Albornoz <lucio@lucioillanes.de>2020-05-15 09:48:40 +0100
commit8a4e16ff3484e7395112e1a8888ee7c8eb176987 (patch)
tree3ba4e90cec38dd65bfe4d4a0b37893d887957aa8
parentdd9b89b3fafe8cb08c184fc74b5c2133cc658b6b (diff)
downloadmidipix_build-8a4e16ff3484e7395112e1a8888ee7c8eb176987.tar.bz2
midipix_build-8a4e16ff3484e7395112e1a8888ee7c8eb176987.tar.xz
Optionally install ${PKG_DESTDIR_HOST} into ${PREFIX}.
vars/libxslt.vars:pkg_libxslt_install_make_post(): install ${PREFIX}/bin/xslt-config into ${PKG_DESTDIR_HOST}/bin.
-rw-r--r--etc/README.md35
-rw-r--r--midipix.env20
-rw-r--r--subr/ex_pkg_env.subr1
-rw-r--r--subr/ex_pkg_exec.subr2
-rw-r--r--subr/pkg_clean.subr3
-rw-r--r--subr/pkg_install.subr50
-rw-r--r--vars/libxslt.vars8
7 files changed, 66 insertions, 53 deletions
diff --git a/etc/README.md b/etc/README.md
index 128ba181..eb0f5f97 100644
--- a/etc/README.md
+++ b/etc/README.md
@@ -445,22 +445,22 @@ Build step status is tracked on a per-package basis by state files beneath
``${BUILD_WORKDIR}`` following the format ``.<package name>.<build step>``;
package build completion corresponds to the pseudo-build step ``finish``.
-| Name | Description |
-| ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| fetch_download | Download package archive & verify w/ SHA-256 message digest and/or clone Git repository/ies |
-| fetch_extract | Extract package archive, if any |
-| configure_patch_pre | Apply ``chainport`` patches and/or patches beneath ``patches/`` prior to (GNU autotools or similar) configuration |
-| configure_autotools | Bootstrap (GNU autools or similar) environment, and install ``config.sub`` and ``config.cache`` |
-| configure_patch | Apply patches beneath ``patches/`` and/or set in ``${PKG_PATCHES_EXTRA}`` after (GNU autotools or similar) configuration |
-| configure | Perform package (GNU autools or similar) configuration w/ configuration-time set of environment variables |
-| build | Call ``make(1)`` w/ build-time set of make variables |
-| install_subdirs | Create default directory hierarchy in ``${PKG_DESTDIR}``, optionally amended w/ ``${PKG_INSTALL_FILES_DESTDIR_EXTRA}`` |
-| install_make | Call ``make(1)`` w/ ``${PKG_INSTALL_TARGET}`` (defaults to ``install``) and installation-time set of make variables |
-| install_files | Install ``${PKG_INSTALL_FILES}``, ``pkgconf(1)`` package files, and/or stripped binaries within ``${PKG_DESTDIR}`` |
-| install_libs | Purge libtool ``.la`` files and install shared objects within ``${PKG_DESTDIR}`` w/ ``perk`` and corresponding symbolic links |
-| install | Fix directory and file mode bits within ``${PKG_DESTDIR}``, install into ``${PKG_PREFIX}`` under mutex, and add package to ``${PREFIX}/pkglist.${PKG_BUILD_TYPE}`` (unless inhibited) |
-| install_rpm | Build package RPM w/ auto-generated specifiation file based on ``etc/package.spec`` beneath ``${PREFIX_RPM}`` |
-| clean | Clean ``${PKG_BUILD_DIR}`` and/or ``${PKG_DESTDIR}`` and/or ``${PKG_BASE_DIR}/${PKG_SUBDIR}`` as per ``-C build,dest,src``, resp., if any |
+| Name | Description |
+| ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| fetch_download | Download package archive & verify w/ SHA-256 message digest and/or clone Git repository/ies |
+| fetch_extract | Extract package archive, if any |
+| configure_patch_pre | Apply ``chainport`` patches and/or patches beneath ``patches/`` prior to (GNU autotools or similar) configuration |
+| configure_autotools | Bootstrap (GNU autools or similar) environment, and install ``config.sub`` and ``config.cache`` |
+| configure_patch | Apply patches beneath ``patches/`` and/or set in ``${PKG_PATCHES_EXTRA}`` after (GNU autotools or similar) configuration |
+| configure | Perform package (GNU autools or similar) configuration w/ configuration-time set of environment variables |
+| build | Call ``make(1)`` w/ build-time set of make variables |
+| install_subdirs | Create default directory hierarchy in ``${PKG_DESTDIR}``, optionally amended w/ ``${PKG_INSTALL_FILES_DESTDIR_EXTRA}`` |
+| install_make | Call ``make(1)`` w/ ``${PKG_INSTALL_TARGET}`` (defaults to ``install``) and installation-time set of make variables |
+| install_files | Install ``${PKG_INSTALL_FILES}``, ``pkgconf(1)`` package files, and/or stripped binaries within ``${PKG_DESTDIR}`` |
+| install_libs | Purge libtool ``.la`` files and install shared objects within ``${PKG_DESTDIR}`` w/ ``perk`` and corresponding symbolic links |
+| install | Fix directory and file mode bits within ``${PKG_DESTDIR}`` and optionally ``${PKG_DESTDIR_HOST}``, install into ``${PKG_PREFIX}``, and optionally ``${PKG_DESTDIR_HOST}`` into ``${PREFIX}``, under mutex, and add package to ``${PREFIX}/pkglist.${PKG_BUILD_TYPE}`` (unless inhibited) |
+| install_rpm | Build package RPM w/ auto-generated specifiation file based on ``etc/package.spec`` beneath ``${PREFIX_RPM}`` |
+| clean | Clean ``${PKG_BUILD_DIR}`` and/or ``${PKG_DESTDIR}`` and/or ``${PKG_DESTDIR_HOST}`` and/or ``${PKG_BASE_DIR}/${PKG_SUBDIR}`` as per ``-C build,dest,src``, resp., if any |
[Back to top](#table-of-contents)
@@ -499,7 +499,7 @@ VERSION`` and/or ``URLS_GIT``, respectively.
| BASE_DIR | Absolute pathname to package build root directory beneath ``${BUILD_WORKDIR}`` |
| BUILD_DIR | Directory name of package build directory beneath ``${PKG_BASE_DIR}`` |
| BUILD_STEPS_DISABLE | List of build steps to disable during package build |
-| BUILD_TYPE | Cross-compiled toolchain (``cross``,) host (``host``,) or cross-compiled package (``native``) build type |
+| BUILD_TYPE | Cross-compiled toolchain (``cross``,) host (``host``,) or cross-compiled package (``native``) build type |
| CC | Command- or pathname of toolchain C compiler ``cc(1)`` |
| CFLAGS_BUILD_EXTRA | Additional C compiler flags during package ``make(1)`` build |
| CFLAGS_CONFIGURE | C compiler flags during package (GNU autotools or similar) configuration |
@@ -515,6 +515,7 @@ VERSION`` and/or ``URLS_GIT``, respectively.
| CXXFLAGS_CONFIGURE_EXTRA | Additional list of C++ compiler flags during package (GNU autotools or similar) configuration |
| DEPENDS | List of package-package dependencies |
| DESTDIR | Directory name of package installation destination directory beneath ``${PKG_BASE_DIR}`` |
+| DESTDIR_HOST | Directory name of optional host package installation destination directory beneath ``${PKG_BASE_DIR}`` |
| DISABLED | Disable package |
| ENV_VARS_EXTRA | List of double colon-separated environment variable equality sign-separated name-value pairs to set during package build |
| FNAME | Filename of package archive file |
diff --git a/midipix.env b/midipix.env
index 5d068d8a..83f767e9 100644
--- a/midipix.env
+++ b/midipix.env
@@ -19,16 +19,16 @@ DEFAULT_BUILD_VARS="
CFLAGS_BUILD_EXTRA CFLAGS_CONFIGURE CFLAGS_CONFIGURE_EXTRA \
CONFIG_CACHE CONFIG_CACHE_EXTRA CONFIG_CACHE_LOCAL CONFIGURE \
CONFIGURE_ARGS CONFIGURE_ARGS_EXTRA CXX CXXFLAGS_CONFIGURE \
- CXXFLAGS_CONFIGURE_EXTRA DEPENDS DESTDIR DISABLED ENV_VARS_EXTRA \
- FNAME FORCE_AUTORECONF GITROOT INHERIT_FROM INSTALL_FILES \
- INSTALL_FILES_DESTDIR INSTALL_FILES_DESTDIR_EXTRA INSTALL_TARGET \
- INSTALL_TARGET_EXTRA IN_TREE LDFLAGS_BUILD_EXTRA LDFLAGS_CONFIGURE \
- LDFLAGS_CONFIGURE_EXTRA LIBTOOL MAKE MAKE_INSTALL_VNAME \
- MAKEFLAGS_BUILD MAKEFLAGS_BUILD_EXTRA MAKEFLAGS_INSTALL \
- MAKEFLAGS_INSTALL_EXTRA MAKEFLAGS_VERBOSITY NO_CLEAN NO_CLEAN_BASE_DIR \
- NO_LOG_VARS PYTHON PATCHES_EXTRA PKG_CONFIG PKG_CONFIG_LIBDIR PKGLIST_DISABLE \
- PREFIX RANLIB RPM_DISABLE SHA256SUM SUBDIR TARGET URL URLS_GIT \
- VERSION";
+ CXXFLAGS_CONFIGURE_EXTRA DEPENDS DESTDIR DESTDIR_HOST DISABLED \
+ ENV_VARS_EXTRA FNAME FORCE_AUTORECONF GITROOT INHERIT_FROM \
+ INSTALL_FILES INSTALL_FILES_DESTDIR INSTALL_FILES_DESTDIR_EXTRA \
+ INSTALL_TARGET INSTALL_TARGET_EXTRA IN_TREE LDFLAGS_BUILD_EXTRA \
+ LDFLAGS_CONFIGURE LDFLAGS_CONFIGURE_EXTRA LIBTOOL MAKE \
+ MAKE_INSTALL_VNAME MAKEFLAGS_BUILD MAKEFLAGS_BUILD_EXTRA \
+ MAKEFLAGS_INSTALL MAKEFLAGS_INSTALL_EXTRA MAKEFLAGS_VERBOSITY \
+ NO_CLEAN NO_CLEAN_BASE_DIR NO_LOG_VARS PYTHON PATCHES_EXTRA \
+ PKG_CONFIG PKG_CONFIG_LIBDIR PKGLIST_DISABLE PREFIX RANLIB \
+ RPM_DISABLE SHA256SUM SUBDIR TARGET URL URLS_GIT VERSION";
# Path names
: ${PREFIX_ROOT:="${HOME}/midipix"};
diff --git a/subr/ex_pkg_env.subr b/subr/ex_pkg_env.subr
index 2f2f674c..ff2338e1 100644
--- a/subr/ex_pkg_env.subr
+++ b/subr/ex_pkg_env.subr
@@ -40,6 +40,7 @@ exp_pkg_env_defaults() {
PKG_BUILD_DIR="${PKG_BASE_DIR}/${PKG_BUILD_DIR}";
PKG_CONFIGURE="${PKG_BASE_DIR}/${PKG_CONFIGURE:-${PKG_SUBDIR}/configure}";
PKG_DESTDIR="${PKG_BASE_DIR}/${PKG_DESTDIR:-destdir}";
+ PKG_DESTDIR_HOST="${PKG_BASE_DIR}/${PKG_DESTDIR_HOST:-destdir_host}";
};
#
diff --git a/subr/ex_pkg_exec.subr b/subr/ex_pkg_exec.subr
index d21289b7..992b7c8c 100644
--- a/subr/ex_pkg_exec.subr
+++ b/subr/ex_pkg_exec.subr
@@ -35,7 +35,7 @@ exp_pkg_exec_pre() {
return 1;
elif ! ex_pkg_state_test "${_pkg_name}" "start" "${_restart_at}"; then
if [ "${PKG_NO_CLEAN_BASE_DIR:-0}" -eq 0 ]\
- && ! rtl_fileop rm "${PKG_BASE_DIR}" "${PKG_BUILD_DIR}" "${PKG_DESTDIR}"\
+ && ! rtl_fileop rm "${PKG_BASE_DIR}" "${PKG_BUILD_DIR}" "${PKG_DESTDIR}" "${PKG_DESTDIR_HOST}"\
|| ! rtl_fileop mkdir "${PKG_BASE_DIR}"; then
return 1;
fi;
diff --git a/subr/pkg_clean.subr b/subr/pkg_clean.subr
index 39b0ead5..a4a70d63 100644
--- a/subr/pkg_clean.subr
+++ b/subr/pkg_clean.subr
@@ -12,6 +12,9 @@ pkg_clean() {
if rtl_lmatch "${ARG_CLEAN_BUILDS}" "dest" ","; then
if ! rtl_fileop rm "${PKG_DESTDIR}"; then
return 1;
+ elif [ -e "${PKG_DESTDIR_HOST}" ]\
+ && ! rtl_fileop rm "${PKG_DESTDIR_HOST}"; then
+ return 1;
fi;
fi;
if rtl_lmatch "${ARG_CLEAN_BUILDS}" "src" ","; then
diff --git a/subr/pkg_install.subr b/subr/pkg_install.subr
index 1f9f1d9d..f869ec5b 100644
--- a/subr/pkg_install.subr
+++ b/subr/pkg_install.subr
@@ -2,31 +2,41 @@
# set +o errexit -o noglob -o nounset is assumed.
#
+pkgp_install_perms() {
+ local _destdir="${1}" _fname="" _ifs_old="${IFS:- }" IFS;
+ IFS="
+"; for _fname in $(find "${_destdir}" -type d); do
+ if ! rtl_fileop chmod 0755 "${_fname}"; then
+ return 1;
+ fi;
+ done;
+ for _fname in $(find "${_destdir}" \( -not -perm /0111 \) -type f); do
+ if ! rtl_fileop chmod 0644 "${_fname}"; then
+ return 1;
+ fi;
+ done;
+ for _fname in $(find "${_destdir}" -perm /0111 -type f); do
+ if ! rtl_fileop chmod 0755 "${_fname}"; then
+ return 1;
+ fi;
+ done;
+};
+
pkg_install() {
- local _fname="" _ifs_old="${IFS:- }" _pkglist_name="" IFS;
+ local _destdir="" _destdir_prefix="" _ifs_old="${IFS:- }" _pkglist_name="" IFS;
if ! rtl_fileop mkdir "${PKG_PREFIX}"; then
return 1;
- else IFS="
-"; for _fname in $(find "${PKG_DESTDIR}" -type d); do
- if ! rtl_fileop chmod 0755 "${_fname}"; then
- return 1;
+ else for _destdir in "${PKG_DESTDIR}:${PKG_PREFIX}" "${PKG_DESTDIR_HOST}:${PREFIX}"; do
+ IFS=":"; set -- ${_destdir}; IFS="${_ifs_old}"; _destdir="${1}"; _destdir_prefix="${2}";
+ if [ -e "${_destdir}" ]; then
+ pkgp_install_perms "${_destdir}";
+ (set +o errexit -o noglob; rtl_flock_acquire 4 || exit "${?}"; date;
+ trap "rm -f \"${BUILD_WORKDIR}/install.lock\"" EXIT;
+ if ! tar -C "${_destdir}" -cpf - . | tar -C "${_destdir_prefix}" --overwrite -xpf -; then
+ exit 1;
+ fi) 4<>"${BUILD_WORKDIR}/install.lock";
fi;
done;
- for _fname in $(find "${PKG_DESTDIR}" \( -not -perm /0111 \) -type f); do
- if ! rtl_fileop chmod 0644 "${_fname}"; then
- return 1;
- fi;
- done;
- for _fname in $(find "${PKG_DESTDIR}" -perm /0111 -type f); do
- if ! rtl_fileop chmod 0755 "${_fname}"; then
- return 1;
- fi;
- done; IFS="${_ifs_old}";
- (set +o errexit -o noglob; rtl_flock_acquire 4 || exit "${?}"; date;
- trap "rm -f \"${BUILD_WORKDIR}/install.lock\"" EXIT;
- if ! tar -C "${PKG_DESTDIR}" -cpf - . | tar -C "${PKG_PREFIX}" --overwrite -xpf -; then
- exit 1;
- fi) 4<>"${BUILD_WORKDIR}/install.lock";
if [ "${?}" -ne 0 ]; then
return 1;
elif [ "${PKG_PKGLIST_DISABLE:-0}" -eq 0 ]; then
diff --git a/vars/libxslt.vars b/vars/libxslt.vars
index 62b87174..b1341f1d 100644
--- a/vars/libxslt.vars
+++ b/vars/libxslt.vars
@@ -3,14 +3,12 @@
#
pkg_libxslt_install_make_post() {
- if [ -e "${PREFIX}/bin/xslt-config" ]\
- && ! rtl_fileop rm "${PREFIX}/bin/xslt-config"; then
+ if ! rtl_fileop mkdir "${PKG_DESTDIR_HOST}/bin"; then
return 1;
- fi;
- if ! sed '/^prefix=$/s,^prefix=$,prefix='"${PREFIX_NATIVE}"',' "${PREFIX_NATIVE}/bin/xslt-config" > "${PREFIX}/bin/xslt-config"; then
+ elif ! sed '/^prefix=$/s,^prefix=$,prefix='"${PREFIX_NATIVE}"',' "${PREFIX_NATIVE}/bin/xslt-config" > "${PKG_DESTDIR_HOST}/bin/xslt-config"; then
return 1;
else
- rtl_fileop chmod +x "${PREFIX}/bin/xslt-config";
+ rtl_fileop chmod +x "${PKG_DESTDIR_HOST}/bin/xslt-config";
fi;
};