app-text/scdoc: fix cross-compile, prefix install.
authorMarty E. Plummer <hanetzer@startmail.com>
Fri, 19 Oct 2018 09:40:33 +0000 (04:40 -0500)
committerMichał Górny <mgorny@gentoo.org>
Mon, 22 Oct 2018 20:23:20 +0000 (22:23 +0200)
Cross-compiling (tested with a crossdev musl toolchain via
`PORTAGE_CONFIGROOT=/usr/x86_64-pc-linux-musl ebuild scdoc-1.3.1.ebuild ...`
currently fails because VERSION is not defined.

Installing in prefix fails due to files being installed outside of the
prefix. Pass PREFIX="${EPREFIX}/usr" on emake call.

Tested via building with `ebuild scdoc-1.3.1.ebuild ...` while inside a
prefix.

Signed-off-by: Marty E. Plummer <hanetzer@startmail.com>
Package-Manager: Portage-2.3.51, Repoman-2.3.11
Signed-off-by: Michał Górny <mgorny@gentoo.org>
app-text/scdoc/scdoc-1.3.1.ebuild

index c5d56d74dfee514c8cebc0cd3df63ff4686d998c..c8999bc8053286b9c34331ff2ae78bec837a4d84 100644 (file)
@@ -18,23 +18,21 @@ src_prepare() {
 
        sed -e 's/-Werror//' \
                -e 's/CFLAGS=/CFLAGS+=/' \
-               -e '/^PREFIX/s@=.*$@=/usr@' \
                -i Makefile || die 'Failed to patch Makefile'
 }
 
 src_compile() {
-       MY_HS="./scdoc"
+       local MY_HS="./scdoc"
        if tc-is-cross-compiler; then
                tc-export_build_env
                MY_HS="./hostscdoc"
-               MAKEOPTS+=" HOST_SCDOC=./hostscdoc"
-               emake scdoc OUTDIR="${S}/.build.host" CC=$(tc-getBUILD_CC) \
-                       CFLAGS="${BUILD_CFLAGS}" LDFLAGS="${BUILD_LDFLAGS}"
+               emake scdoc HOST_SCDOC="./hostscdoc" OUTDIR="${S}/.build.host" CC="$(tc-getBUILD_CC)" \
+                       CFLAGS="${BUILD_CFLAGS} -DVERSION='\"${PV}\"'" LDFLAGS="${BUILD_LDFLAGS}"
                mv scdoc hostscdoc || die 'Failed to rename host scdoc'
        fi
-       emake LDFLAGS="${LDFLAGS}" HOST_SCDOC="${MY_HS}"
+       emake LDFLAGS="${LDFLAGS}" PREFIX="${EPREFIX}/usr" HOST_SCDOC="${MY_HS}"
 }
 
 src_install() {
-       emake DESTDIR="${D}" HOST_SCDOC="${MY_HS}" install
+       emake DESTDIR="${D}" PREFIX="${EPREFIX}/usr" HOST_SCDOC="${MY_HS}" install
 }