summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Gilbert <floppym@gentoo.org>2020-01-04 13:07:12 -0500
committerMike Gilbert <floppym@gentoo.org>2020-01-04 13:08:29 -0500
commit30b0ca3905ccd1bff0a5f1641adf2226d57f23b1 (patch)
tree80a70fa2e669781e7fb60f9017ecdcdc99e78e4a /sys-apps
parentsys-kernel/gentoo-sources: Linux patch 4.14.162 (diff)
downloadgentoo-30b0ca3905ccd1bff0a5f1641adf2226d57f23b1.tar.gz
gentoo-30b0ca3905ccd1bff0a5f1641adf2226d57f23b1.tar.bz2
gentoo-30b0ca3905ccd1bff0a5f1641adf2226d57f23b1.zip
sys-apps/file: refactor cross-compile logic
Add build_src_configure and need_build_file helper functions. Pass --disable-{bzlib,xzlib,zlib} to configure in build_src_configure. Use tc-env_build helper in build_src_configure. Convert "ROOT=/ has_version" to PMS-compliant "has_version -b". Make ECONF_SOURCE and PATH local variables. Closes: https://bugs.gentoo.org/704776 Package-Manager: Portage-2.3.84_p2, Repoman-2.3.20_p24 Signed-off-by: Mike Gilbert <floppym@gentoo.org>
Diffstat (limited to 'sys-apps')
-rw-r--r--sys-apps/file/file-5.38.ebuild42
-rw-r--r--sys-apps/file/file-9999.ebuild42
2 files changed, 48 insertions, 36 deletions
diff --git a/sys-apps/file/file-5.38.ebuild b/sys-apps/file/file-5.38.ebuild
index 74b955f43b6d..93d716314d53 100644
--- a/sys-apps/file/file-5.38.ebuild
+++ b/sys-apps/file/file-5.38.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2019 Gentoo Authors
+# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
@@ -55,28 +55,34 @@ multilib_src_configure() {
$(use_enable static-libs static)
$(use_enable zlib)
)
- ECONF_SOURCE="${S}" econf "${myeconfargs[@]}"
+ econf "${myeconfargs[@]}"
}
-src_configure() {
+build_src_configure() {
+ local myeconfargs=(
+ --disable-shared
+ --disable-libseccomp
+ --disable-bzlib
+ --disable-xzlib
+ --disable-zlib
+ )
+ tc-env_build econf "${myeconfargs[@]}"
+}
+
+need_build_file() {
# when cross-compiling, we need to build up our own file
# because people often don't keep matching host/target
# file versions #362941
- if tc-is-cross-compiler && ! ROOT=/ has_version ~${CATEGORY}/${P} ; then
+ tc-is-cross-compiler && ! has_version -b "~${CATEGORY}/${P}"
+}
+
+src_configure() {
+ local ECONF_SOURCE=${S}
+
+ if need_build_file; then
mkdir -p "${WORKDIR}"/build || die
cd "${WORKDIR}"/build || die
- tc-export_build_env BUILD_C{C,XX}
- ECONF_SOURCE="${S}" \
- ac_cv_header_zlib_h=no \
- ac_cv_lib_z_gzopen=no \
- CHOST=${CBUILD} \
- CFLAGS=${BUILD_CFLAGS} \
- CXXFLAGS=${BUILD_CXXFLAGS} \
- CPPFLAGS=${BUILD_CPPFLAGS} \
- LDFLAGS="${BUILD_LDFLAGS} -static" \
- CC=${BUILD_CC} \
- CXX=${BUILD_CXX} \
- econf --disable-shared --disable-libseccomp
+ build_src_configure
fi
multilib-minimal_src_configure
@@ -93,10 +99,10 @@ multilib_src_compile() {
}
src_compile() {
- if tc-is-cross-compiler && ! ROOT=/ has_version "~${CATEGORY}/${P}" ; then
+ if need_build_file; then
emake -C "${WORKDIR}"/build/src magic.h #586444
emake -C "${WORKDIR}"/build/src file
- PATH="${WORKDIR}/build/src:${PATH}"
+ local -x PATH="${WORKDIR}/build/src:${PATH}"
fi
multilib-minimal_src_compile
diff --git a/sys-apps/file/file-9999.ebuild b/sys-apps/file/file-9999.ebuild
index fb29c4f2a25c..d834362dd1e8 100644
--- a/sys-apps/file/file-9999.ebuild
+++ b/sys-apps/file/file-9999.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2019 Gentoo Authors
+# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
@@ -56,28 +56,34 @@ multilib_src_configure() {
$(use_enable static-libs static)
$(use_enable zlib)
)
- ECONF_SOURCE="${S}" econf "${myeconfargs[@]}"
+ econf "${myeconfargs[@]}"
}
-src_configure() {
+build_src_configure() {
+ local myeconfargs=(
+ --disable-shared
+ --disable-libseccomp
+ --disable-bzlib
+ --disable-xzlib
+ --disable-zlib
+ )
+ tc-env_build econf "${myeconfargs[@]}"
+}
+
+need_build_file() {
# when cross-compiling, we need to build up our own file
# because people often don't keep matching host/target
# file versions #362941
- if tc-is-cross-compiler && ! ROOT=/ has_version ~${CATEGORY}/${P} ; then
+ tc-is-cross-compiler && ! has_version -b "~${CATEGORY}/${P}"
+}
+
+src_configure() {
+ local ECONF_SOURCE=${S}
+
+ if need_build_file; then
mkdir -p "${WORKDIR}"/build || die
cd "${WORKDIR}"/build || die
- tc-export_build_env BUILD_C{C,XX}
- ECONF_SOURCE="${S}" \
- ac_cv_header_zlib_h=no \
- ac_cv_lib_z_gzopen=no \
- CHOST=${CBUILD} \
- CFLAGS=${BUILD_CFLAGS} \
- CXXFLAGS=${BUILD_CXXFLAGS} \
- CPPFLAGS=${BUILD_CPPFLAGS} \
- LDFLAGS="${BUILD_LDFLAGS} -static" \
- CC=${BUILD_CC} \
- CXX=${BUILD_CXX} \
- econf --disable-shared $(use_enable seccomp libseccomp)
+ build_src_configure
fi
multilib-minimal_src_configure
@@ -94,10 +100,10 @@ multilib_src_compile() {
}
src_compile() {
- if tc-is-cross-compiler && ! ROOT=/ has_version "~${CATEGORY}/${P}" ; then
+ if need_build_file; then
emake -C "${WORKDIR}"/build/src magic.h #586444
emake -C "${WORKDIR}"/build/src file
- PATH="${WORKDIR}/build/src:${PATH}"
+ local -x PATH="${WORKDIR}/build/src:${PATH}"
fi
multilib-minimal_src_compile