summaryrefslogtreecommitdiffhomepage
path: root/subr
diff options
context:
space:
mode:
Diffstat (limited to 'subr')
-rw-r--r--subr/build.subr2
-rw-r--r--subr/pkg_autoconf.subr26
-rw-r--r--subr/pkg_build.subr7
-rw-r--r--subr/pkg_build_dir.subr9
-rw-r--r--subr/pkg_configure.subr4
-rw-r--r--subr/pkg_disabled.subr2
-rw-r--r--subr/pkg_distclean.subr4
-rw-r--r--subr/pkg_extract.subr20
-rw-r--r--subr/pkg_fetch.subr46
-rw-r--r--subr/pkg_patch.subr18
-rw-r--r--subr/pkg_patch_pre.subr12
-rw-r--r--subr/pkg_setup_env.subr32
12 files changed, 92 insertions, 90 deletions
diff --git a/subr/build.subr b/subr/build.subr
index 5b670793..075575c2 100644
--- a/subr/build.subr
+++ b/subr/build.subr
@@ -85,6 +85,8 @@ is_build_script_done() {
else
return 1; # Build
fi;
+ elif [ "${_restart_at}" = "ALL" ]; then
+ return 1; # Build
elif lmatch "${_restart_at}" , "${2}"; then
return 1; # Build
else
diff --git a/subr/pkg_autoconf.subr b/subr/pkg_autoconf.subr
index 65f7c2d8..981dae74 100644
--- a/subr/pkg_autoconf.subr
+++ b/subr/pkg_autoconf.subr
@@ -4,19 +4,19 @@
pkg_autoconf() {
local __;
- if [ -e "../${PKG_SUBDIR}/configure" -o \
- -e "../${PKG_SUBDIR}/configure.ac" -o \
- -e "../${PKG_SUBDIR}/configure.in" -o \
- -e "../${PKG_SUBDIR}/config.guess" ]; then
- find "../${PKG_SUBDIR}" -name config.sub \
+ if [ -e "${WORKDIR}/${PKG_SUBDIR}/configure" -o \
+ -e "${WORKDIR}/${PKG_SUBDIR}/configure.ac" -o \
+ -e "${WORKDIR}/${PKG_SUBDIR}/configure.in" -o \
+ -e "${WORKDIR}/${PKG_SUBDIR}/config.guess" ]; then
+ find "${WORKDIR}/${PKG_SUBDIR}" -name config.sub \
-exec echo mv -- {} {}.orig \; \
-exec mv -- {} {}.orig \; \
-exec echo install -m 0700 "${MIDIPIX_BUILD_PWD}/etc/config.sub" {} \; \
-exec install -m 0700 "${MIDIPIX_BUILD_PWD}/etc/config.sub" {} \;;
- if [ -e "../${PKG_SUBDIR}/configure.ac" ]\
- && [ ! -e "../${PKG_SUBDIR}/configure" ]; then
- if [ -e "../${PKG_SUBDIR}/autogen.sh" ]; then
- for __ in "../${PKG_SUBDIR}/build-aux" "../${PKG_SUBDIR}"; do
+ if [ -e "${WORKDIR}/${PKG_SUBDIR}/configure.ac" ]\
+ && [ ! -e "${WORKDIR}/${PKG_SUBDIR}/configure" ]; then
+ if [ -e "${WORKDIR}/${PKG_SUBDIR}/autogen.sh" ]; then
+ for __ in "${WORKDIR}/${PKG_SUBDIR}/build-aux" "${WORKDIR}/${PKG_SUBDIR}"; do
if [ -e "${__}" ]; then
echo install -m 0700 \
"${MIDIPIX_BUILD_PWD}/etc/config.sub" \
@@ -27,13 +27,13 @@ pkg_autoconf() {
break;
fi;
done;
- (build_fileop cd "../${PKG_SUBDIR}" && "${SHELL}" ./autogen.sh) || exit 1;
+ (build_fileop cd "${WORKDIR}/${PKG_SUBDIR}" && "${SHELL}" ./autogen.sh) || exit 1;
else
- (build_fileop cd "../${PKG_SUBDIR}" && autoconf) || exit 1;
+ (build_fileop cd "${WORKDIR}/${PKG_SUBDIR}" && autoconf) || exit 1;
fi;
fi;
- for __ in . ${PKG_CONFIG_CACHE_EXTRA}; do
- build_fileop cp "${MIDIPIX_BUILD_PWD}/etc/config.cache" "${__}/";
+ for __ in ${PKG_BUILD_DIR} ${PKG_CONFIG_CACHE_EXTRA}; do
+ build_fileop cp "${MIDIPIX_BUILD_PWD}/etc/config.cache" "${WORKDIR}/${__}/";
done;
fi;
};
diff --git a/subr/pkg_build.subr b/subr/pkg_build.subr
index 9ef158a6..16ac1331 100644
--- a/subr/pkg_build.subr
+++ b/subr/pkg_build.subr
@@ -3,6 +3,10 @@
#
pkg_build() {
+ local _no_autoconf;
+ if [ ! -x "${PKG_CONFIGURE}" ]; then
+ _no_autoconf=1;
+ fi;
if [ -n "${PKG_BUILD_CMDLINE}" ]; then
${PKG_BUILD_CMDLINE};
elif [ ${PKG_NO_MAKE_BUILD:-0} -eq 0 ]; then
@@ -12,13 +16,12 @@ pkg_build() {
run_cmd_unsplit make \
${PKG_MAKEFLAGS_BUILD} \
${PKG_MAKEFLAGS_BUILD_EXTRA} \
- AR=${AR} ${__no_autoconf:+CC=${CC}} RANLIB=${RANLIB} \
+ AR=${AR} ${_no_autoconf:+CC=${CC}} RANLIB=${RANLIB} \
"${PKG_CFLAGS_BUILD:+CFLAGS=${PKG_CFLAGS_BUILD}}" \
"${CFLAGS_FOR_BUILD:+CFLAGS_FOR_BUILD=${CFLAGS_FOR_BUILD}}" \
"${PKG_CFLAGS_BUILD_EXTRA:+CFLAGS+=${PKG_CFLAGS_BUILD_EXTRA}}" \
"${PKG_LDFLAGS_BUILD:+LDFLAGS=${PKG_LDFLAGS_BUILD}}" \
"${PKG_LDFLAGS_BUILD_EXTRA:+LDFLAGS+=${PKG_LDFLAGS_BUILD_EXTRA}}";
- unset __no_autoconf;
fi;
};
diff --git a/subr/pkg_build_dir.subr b/subr/pkg_build_dir.subr
index 13e96ab8..7d8a95fd 100644
--- a/subr/pkg_build_dir.subr
+++ b/subr/pkg_build_dir.subr
@@ -3,13 +3,10 @@
#
pkg_build_dir() {
- if [ -z "${PKG_BUILD_DIR}" ]; then
- set_build_dir "${PKG_SUBDIR}" "${PKG_BUILD_TYPE:-native}";
+ if [ ! -d "${WORKDIR}/${PKG_BUILD_DIR}" ]; then
+ build_fileop mkdir "${WORKDIR}/${PKG_BUILD_DIR}";
fi;
- if [ ! -d "${PKG_BUILD_DIR}" ]; then
- build_fileop mkdir "${PKG_BUILD_DIR}";
- fi;
- build_fileop cd "${PKG_BUILD_DIR}";
+ build_fileop cd "${WORKDIR}/${PKG_BUILD_DIR}";
};
# vim:filetype=sh
diff --git a/subr/pkg_configure.subr b/subr/pkg_configure.subr
index fc70f39e..1d53d8b6 100644
--- a/subr/pkg_configure.subr
+++ b/subr/pkg_configure.subr
@@ -4,9 +4,9 @@
pkg_configure() {
if [ -n "${PKG_CONFIGURE}" ]; then
- PKG_CONFIGURE="../${PKG_CONFIGURE}";
+ PKG_CONFIGURE="${WORKDIR}/${PKG_CONFIGURE}";
else
- PKG_CONFIGURE="../${PKG_SUBDIR}/configure";
+ PKG_CONFIGURE="${WORKDIR}/${PKG_SUBDIR}/configure";
fi;
if [ -x "${PKG_CONFIGURE}" ]; then
export CFLAGS_FOR_BUILD="${HOST_TOOLCHAIN_CFLAGS_CONFIGURE_DEFAULT}";
diff --git a/subr/pkg_disabled.subr b/subr/pkg_disabled.subr
index 43cef71f..3b5a3081 100644
--- a/subr/pkg_disabled.subr
+++ b/subr/pkg_disabled.subr
@@ -3,7 +3,7 @@
#
pkg_disabled() {
- if [ ${PKG_DISABLED:-0} -eq 1 ]; then
+ if [ "${PKG_DISABLED:-0}" -eq 1 ]; then
exit 0;
fi;
};
diff --git a/subr/pkg_distclean.subr b/subr/pkg_distclean.subr
index f721a9fb..68c09dd4 100644
--- a/subr/pkg_distclean.subr
+++ b/subr/pkg_distclean.subr
@@ -4,8 +4,8 @@
pkg_distclean() {
if [ "${PKG_SUBDIR}" != "${PKG_BUILD_DIR}" ]; then
- build_fileop rm ${PKG_BUILD_DIR};
- build_fileop mkdir ${PKG_BUILD_DIR};
+ build_fileop rm "${WORKDIR}/${PKG_BUILD_DIR}";
+ build_fileop mkdir "${WORKDIR}/${PKG_BUILD_DIR}";
fi;
};
diff --git a/subr/pkg_extract.subr b/subr/pkg_extract.subr
index d4766479..f6982937 100644
--- a/subr/pkg_extract.subr
+++ b/subr/pkg_extract.subr
@@ -5,24 +5,24 @@
pkg_extract() {
if [ -n "${PKG_URL}" ]\
&& [ "${PKG_URL_TYPE:-wget}" = wget ]; then
- build_fileop rm ${PKG_SUBDIR};
- if [ ${PKG_SUBDIR_CREATE:-0} -eq 1 ]; then
- build_fileop mkdir ${PKG_SUBDIR};
+ build_fileop rm "${WORKDIR}/${PKG_SUBDIR}";
+ if [ "${PKG_SUBDIR_CREATE:-0}" -eq 1 ]; then
+ build_fileop mkdir "${WORKDIR}/${PKG_SUBDIR}";
fi;
if [ "${PKG_FNAME##*.tar.}" = "bz2" ]; then
- bunzip2 -d < ${DLCACHEDIR}/${PKG_FNAME} | tar ${PKG_SUBDIR_CREATE:+-C ${PKG_SUBDIR}} -xf -;
+ bunzip2 -d < "${DLCACHEDIR}/${PKG_FNAME}" | tar -C "${WORKDIR}${PKG_SUBDIR_CREATE:+/${PKG_SUBDIR}}" -xf -;
elif [ "${PKG_FNAME##*.tar.}" = "gz" ]; then
- gunzip -d < ${DLCACHEDIR}/${PKG_FNAME} | tar ${PKG_SUBDIR_CREATE:+-C ${PKG_SUBDIR}} -xf -;
+ gunzip -d < "${DLCACHEDIR}/${PKG_FNAME}" | tar -C "${WORKDIR}${PKG_SUBDIR_CREATE:+/${PKG_SUBDIR}}" -xf -;
elif [ "${PKG_FNAME##*.tar.}" = "xz" ]; then
- xz -d < ${DLCACHEDIR}/${PKG_FNAME} | tar ${PKG_SUBDIR_CREATE:+-C ${PKG_SUBDIR}} -xf -;
+ xz -d < "${DLCACHEDIR}/${PKG_FNAME}" | tar -C "${WORKDIR}${PKG_SUBDIR_CREATE:+/${PKG_SUBDIR}}" -xf -;
elif [ "${PKG_FNAME##*.t}" = "bz2" ]; then
- bunzip2 -d < ${DLCACHEDIR}/${PKG_FNAME} | tar ${PKG_SUBDIR_CREATE:+-C ${PKG_SUBDIR}} -xf -;
+ bunzip2 -d < "${DLCACHEDIR}/${PKG_FNAME}" | tar -C "${WORKDIR}${PKG_SUBDIR_CREATE:+/${PKG_SUBDIR}}" -xf -;
elif [ "${PKG_FNAME##*.t}" = "gz" ]; then
- gunzip -d < ${DLCACHEDIR}/${PKG_FNAME} | tar ${PKG_SUBDIR_CREATE:+-C ${PKG_SUBDIR}} -xf -;
+ gunzip -d < "${DLCACHEDIR}/${PKG_FNAME}" | tar -C "${WORKDIR}${PKG_SUBDIR_CREATE:+/${PKG_SUBDIR}}" -xf -;
elif [ "${PKG_FNAME##*.t}" = "xz" ]; then
- xz -d < ${DLCACHEDIR}/${PKG_FNAME} | tar ${PKG_SUBDIR_CREATE:+-C ${PKG_SUBDIR}} -xf -;
+ xz -d < "${DLCACHEDIR}/${PKG_FNAME}" | tar -C "${WORKDIR}${PKG_SUBDIR_CREATE:+/${PKG_SUBDIR}}" -xf -;
else
- tar ${PKG_SUBDIR_CREATE:+-C ${PKG_SUBDIR}} -xf ${DLCACHEDIR}/${PKG_FNAME};
+ tar -C "${WORKDIR}${PKG_SUBDIR_CREATE:+/${PKG_SUBDIR}}" -xf "${DLCACHEDIR}/${PKG_FNAME}";
fi;
fi;
};
diff --git a/subr/pkg_fetch.subr b/subr/pkg_fetch.subr
index fd78a3c1..37c2439e 100644
--- a/subr/pkg_fetch.subr
+++ b/subr/pkg_fetch.subr
@@ -10,53 +10,51 @@ pkgp_fetch() {
else
_url_dst="${DLCACHEDIR}/${3}";
fi;
- if [ ${ARG_OFFLINE:-0} -eq 1 ]\
- || [ -e ${_url_dst}.fetched ]; then
+ if [ "${ARG_OFFLINE:-0}" -eq 1 ]\
+ || [ -e "${_url_dst}.fetched" ]; then
return 0;
else
- wget ${WGET_ARGS} -c -O ${_url_dst} "${_url}";
+ wget ${WGET_ARGS} -c -O "${_url_dst}" "${_url}";
fi;
if [ -n "${_sha256sum_src}" ]; then
- set -- $(openssl dgst -sha256 ${_url_dst}); shift $((${#}-1));
+ set -- $(openssl dgst -sha256 "${_url_dst}"); shift $((${#}-1));
if [ "${_sha256sum_dst:=${1}}" != "${_sha256sum_src}" ]; then
- if [ ${ARG_IGNORE_SHA256SUMS:-0} -eq 0 ]; then
+ if [ "${ARG_IGNORE_SHA256SUMS:-0}" -eq 0 ]; then
log_msg failexit "Error: hash mismatch for URL \`${_url}' (is: ${_sha256sum_dst}, should be: ${_sha256sum_src}.)";
else
log_msg warn "Warning: hash mismatch for URL \`${_url}' (is: ${_sha256sum_dst}, should be: ${_sha256sum_src}.)";
fi;
fi;
fi;
- touch ${_url_dst}.fetched;
+ touch "${_url_dst}.fetched";
};
pkgp_fetch_git() {
local _subdir="${1}" _url="${2}" _branch="${3}";
- if [ ${ARG_OFFLINE:-0} -eq 0 ]; then
+ if [ "${ARG_OFFLINE:-0}" -eq 0 ]; then
if [ -e "${DLCACHEDIR}/${_subdir}" ]; then
- build_fileop cd ${DLCACHEDIR}/${_subdir} &&\
- git pull origin ${_branch:-main} &&\
- build_fileop cd ${OLDPWD};
+ (build_fileop cd "${DLCACHEDIR}/${_subdir}" &&\
+ git pull origin "${_branch:-main}");
else
- git clone ${_url} ${DLCACHEDIR}/${_subdir};
+ git clone "${_url}" "${DLCACHEDIR}/${_subdir}";
if [ -n "${_branch}" -a \
\( -z "${_branch#main}" \) -a \
\( -z "${_branch#master}" \) ]; then
- build_fileop cd ${DLCACHEDIR}/${_subdir} &&\
- git checkout -b ${_branch} &&\
- build_fileop cd ${OLDPWD};
+ (build_fileop cd "${DLCACHEDIR}/${_subdir}" &&\
+ git checkout -b "${_branch}");
fi;
fi;
fi;
- build_fileop rm ${_subdir};
- build_fileop cp ${DLCACHEDIR}/${_subdir} .;
+ build_fileop rm "${WORKDIR}/${_subdir}";
+ build_fileop cp "${DLCACHEDIR}/${_subdir}" "${WORKDIR}";
};
pkgp_fetch_urls_git() {
local _url_spec _subdir _url _git_branch;
- for _url_spec in "${@}"; do
- _subdir=${_url_spec%=*};
- _url=${_url_spec#*=};
- _url=${_url%@*};
+ for _url_spec in ${@}; do
+ _subdir="${_url_spec%=*}";
+ _url="${_url_spec#*=}";
+ _url="${_url%@*}";
if [ "${_url_spec#*@}" != "${_url_spec}" ]; then
_git_branch=${_url_spec#*@};
fi;
@@ -67,16 +65,16 @@ pkgp_fetch_urls_git() {
pkg_fetch() {
if [ -n "${1}" ]; then
if [ "${1}" = "-git" ]; then
- shift; pkgp_fetch_urls_git ${1};
+ shift; pkgp_fetch_urls_git "${1}";
else
- pkgp_fetch ${1} ${2};
+ pkgp_fetch "${1}" "${2}";
fi;
else
if [ -n "${PKG_URL}" ]; then
- pkgp_fetch ${PKG_URL} ${PKG_SHA256SUM} ${PKG_FNAME};
+ pkgp_fetch "${PKG_URL}" "${PKG_SHA256SUM}" "${PKG_FNAME}";
fi;
if [ -n "${PKG_URLS_GIT}" ]; then
- pkgp_fetch_urls_git ${PKG_URLS_GIT};
+ pkgp_fetch_urls_git "${PKG_URLS_GIT}";
fi;
fi;
};
diff --git a/subr/pkg_patch.subr b/subr/pkg_patch.subr
index 8cb173f9..3730395c 100644
--- a/subr/pkg_patch.subr
+++ b/subr/pkg_patch.subr
@@ -6,19 +6,19 @@ pkg_patch() {
local _patch_fname;
if [ -d "${MIDIPIX_BUILD_PWD}/patches/${PKG_NAME}" ]; then
set +o noglob;
- for _patch_fname in "${MIDIPIX_BUILD_PWD}/patches/${PKG_NAME}/*.patch"; do
- patch -b -d "../${PKG_SUBDIR}" -p1 < "${_patch_fname}";
+ for _patch_fname in ${MIDIPIX_BUILD_PWD}/patches/${PKG_NAME}/*.patch; do
+ patch -b -d "${WORKDIR}/${PKG_SUBDIR}" -p1 < "${_patch_fname}";
done;
set -o noglob;
fi;
- for _patch_fname in \
- "${MIDIPIX_BUILD_PWD}/../${PKG_SUBDIR}.local.patch" \
- "${MIDIPIX_BUILD_PWD}/../${PKG_SUBDIR}.local@${BUILD_HNAME}.patch" \
- "${WORKDIR}/chainport/${PKG_SUBDIR}.midipix.patch" \
- "${MIDIPIX_BUILD_PWD}/patches/${PKG_SUBDIR}.local.patch" \
- "${MIDIPIX_BUILD_PWD}/patches/${PKG_SUBDIR}.local@${BUILD_HNAME}.patch"; do
+ for _patch_fname in \
+ ${MIDIPIX_BUILD_PWD}/${WORKDIR}/${PKG_SUBDIR}.local.patch \
+ ${MIDIPIX_BUILD_PWD}/${WORKDIR}/${PKG_SUBDIR}.local@${BUILD_HNAME}.patch \
+ ${WORKDIR}/chainport/${PKG_SUBDIR}.midipix.patch \
+ ${MIDIPIX_BUILD_PWD}/patches/${PKG_SUBDIR}.local.patch \
+ ${MIDIPIX_BUILD_PWD}/patches/${PKG_SUBDIR}.local@${BUILD_HNAME}.patch; do
if [ -r "${_patch_fname}" ]; then
- patch -b -d "../${PKG_SUBDIR}" -p1 < "${_patch_fname}";
+ patch -b -d "${WORKDIR}/${PKG_SUBDIR}" -p1 < "${_patch_fname}";
fi;
done;
};
diff --git a/subr/pkg_patch_pre.subr b/subr/pkg_patch_pre.subr
index 298acd73..f3402fcd 100644
--- a/subr/pkg_patch_pre.subr
+++ b/subr/pkg_patch_pre.subr
@@ -5,13 +5,13 @@
pkg_patch_pre() {
local __;
for __ in \
- "${MIDIPIX_BUILD_PWD}/../${PKG_SUBDIR}_pre.local.patch" \
- "${MIDIPIX_BUILD_PWD}/../${PKG_SUBDIR}_pre.local@${BUILD_HNAME}.patch" \
- "${WORKDIR}/chainport/${PKG_SUBDIR}_pre.midipix.patch" \
- "${MIDIPIX_BUILD_PWD}/patches/${PKG_SUBDIR}_pre.local.patch" \
- "${MIDIPIX_BUILD_PWD}/patches/${PKG_SUBDIR}_pre.local@${BUILD_HNAME}.patch"; do
+ ${MIDIPIX_BUILD_PWD}/../${PKG_SUBDIR}_pre.local.patch \
+ ${MIDIPIX_BUILD_PWD}/../${PKG_SUBDIR}_pre.local@${BUILD_HNAME}.patch \
+ ${WORKDIR}/chainport/${PKG_SUBDIR}_pre.midipix.patch \
+ ${MIDIPIX_BUILD_PWD}/patches/${PKG_SUBDIR}_pre.local.patch \
+ ${MIDIPIX_BUILD_PWD}/patches/${PKG_SUBDIR}_pre.local@${BUILD_HNAME}.patch; do
if [ -r "${__}" ]; then
- patch -b -d "${PKG_SUBDIR}" -p1 < "${__}";
+ patch -b -d "${WORKDIR}/${PKG_SUBDIR}" -p1 < "${__}";
fi;
done;
};
diff --git a/subr/pkg_setup_env.subr b/subr/pkg_setup_env.subr
index 60d5aec2..83c24117 100644
--- a/subr/pkg_setup_env.subr
+++ b/subr/pkg_setup_env.subr
@@ -25,6 +25,23 @@ pkg_setup_env() {
[ -z "${PKG_SUBDIR}" ] && PKG_SUBDIR="${PKG_FNAME%%.tar*}";
[ -z "${PKG_TARGET}" ] && PKG_TARGET="${TARGET}";
[ -z "${MIDIPIX_BUILD_PWD}" ] && MIDIPIX_BUILD_PWD="$(pwd)";
+ if [ -z "${PKG_BUILD_DIR}" ]; then
+ set_build_dir "${PKG_SUBDIR}" "${PKG_BUILD_TYPE:-native}";
+ fi;
+ if [ "${PKG_BUILD_TYPE}" = "host" ]; then
+ export AR="ar";
+ export CC="gcc";
+ export CXX="g++";
+ export RANLIB="ranlib";
+ else
+ export AR="${PKG_TARGET}-ar";
+ export CC="${PKG_TARGET}-gcc";
+ export CXX="${PKG_TARGET}-g++";
+ export RANLIB="${PKG_TARGET}-ranlib";
+ fi;
+ if [ "${PKG_SLIBTOOL}" != "default" ]; then
+ export MAKE="make LIBTOOL=${PKG_SLIBTOOL:-slibtool}";
+ fi;
fi;
for __ in $(set); do
if [ "${__#PKG_${_pkg_name_uc}}" != "${__}" ]; then
@@ -34,21 +51,6 @@ pkg_setup_env() {
if [ -n "${_log_env_vars}" ]; then
log_env_vars "build" ${_log_env_vars};
fi;
- build_fileop cd "${WORKDIR}";
- if [ "${PKG_BUILD_TYPE}" = "host" ]; then
- export AR="ar";
- export CC="gcc";
- export CXX="g++";
- export RANLIB="ranlib";
- else
- export AR="${PKG_TARGET}-ar";
- export CC="${PKG_TARGET}-gcc";
- export CXX="${PKG_TARGET}-g++";
- export RANLIB="${PKG_TARGET}-ranlib";
- fi;
- if [ "${PKG_SLIBTOOL}" != "default" ]; then
- export MAKE="make LIBTOOL=${PKG_SLIBTOOL:-slibtool}";
- fi;
};
# vim:filetype=sh