app-arch/p7zip: fix compilation on Darwin, bug #577344
authorFabian Groffen <grobian@gentoo.org>
Sat, 26 Mar 2016 08:33:42 +0000 (09:33 +0100)
committerFabian Groffen <grobian@gentoo.org>
Sat, 26 Mar 2016 08:34:36 +0000 (09:34 +0100)
Package-Manager: portage-2.2.28-prefix

app-arch/p7zip/files/p7zip-15.14-darwin.patch [new file with mode: 0644]
app-arch/p7zip/p7zip-15.14.ebuild

diff --git a/app-arch/p7zip/files/p7zip-15.14-darwin.patch b/app-arch/p7zip/files/p7zip-15.14-darwin.patch
new file mode 100644 (file)
index 0000000..2db6de9
--- /dev/null
@@ -0,0 +1,13 @@
+Darwin has wchar_h and wctypes_h.
+
+--- CPP/myWindows/config.h
++++ CPP/myWindows/config.h
+@@ -5,7 +5,7 @@
+   #define FILESYSTEM_IS_CASE_SENSITIVE 1
+ #endif
+-  #if !defined(ENV_MACOSX) && !defined(ENV_BEOS)
++  #if !defined(ENV_BEOS)
+     /* <wchar.h> */
+     /* ENV_HAVE_WCHAR__H and not ENV_HAVE_WCHAR_H to avoid warning with wxWidgets */
index bd19893aa898152d796af84b99eaee153cbeca2b..a2efa2908bd987d8445d7cb3856d2812cae1e288 100644 (file)
@@ -30,6 +30,8 @@ DEPEND="${RDEPEND}
 S=${WORKDIR}/${PN}_${PV}
 
 src_prepare() {
+       epatch "${FILESDIR}"/${P}-darwin.patch
+
        if ! use pch; then
                sed "s:PRE_COMPILED_HEADER=StdAfx.h.gch:PRE_COMPILED_HEADER=:g" -i makefile.* || die
        fi
@@ -38,8 +40,6 @@ src_prepare() {
                -e 's:-m32 ::g' \
                -e 's:-m64 ::g' \
                -e 's:-pipe::g' \
-               -e "/^CXX=/s:g++:$(tc-getCXX):" \
-               -e "/^CC=/s:gcc:$(tc-getCC):" \
                -e '/ALLFLAGS/s:-s ::' \
                -e "/OPTFLAGS=/s:=.*:=${CXXFLAGS}:" \
                -i makefile* || die
@@ -63,17 +63,17 @@ src_prepare() {
        elif use x86; then
                cp -f makefile.linux_x86_asm_gcc_4.X makefile.machine || die
        elif [[ ${CHOST} == *-darwin* ]] ; then
-               # Mac OS X needs this special makefile, because it has a non-GNU linker
-               [[ ${CHOST} == *64-* ]] \
-                       && cp -f makefile.macosx_64bits makefile.machine \
-                       || cp -f makefile.macosx_32bits makefile.machine
+               # Mac OS X needs this special makefile, because it has a non-GNU
+               # linker, it doesn't matter so much for bitwidth, for it doesn't
+               # do anything with it
+               cp -f makefile.macosx_llvm_64bits makefile.machine
                # bundles have extension .bundle but don't die because USE=-rar
                # removes the Rar directory
                sed -i -e '/strcpy(name/s/\.so/.bundle/' \
                        CPP/Windows/DLL.cpp || die
                sed -i -e '/^PROG=/s/\.so/.bundle/' \
-                       CPP/7zip/Bundles/Format7zFree/makefile \
-                       $(use rar && echo CPP/7zip/Compress/Rar/makefile) || die
+                       CPP/7zip/Bundles/Format7zFree/makefile.list \
+                       $(use rar && echo CPP/7zip/Compress/Rar/makefile.list) || die
        elif use x86-fbsd; then
                # FreeBSD needs this special makefile, because it hasn't -ldl
                sed -e 's/-lc_r/-pthread/' makefile.freebsd > makefile.machine
@@ -91,9 +91,9 @@ src_prepare() {
 }
 
 src_compile() {
-       emake all3
+       emake CC=$(tc-getCC) CXX=$(tc-getCXX) all3
        if use kde || use wxwidgets; then
-               emake -- 7zG
+               emake CC=$(tc-getCC) CXX=$(tc-getCXX) -- 7zG
 #              emake -- 7zFM
        fi
 }