commit:     ed70c7578c8f321f58b1c6c81ea478804b3fc0a6
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Sat Mar 26 08:33:42 2016 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Sat Mar 26 08:34:36 2016 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ed70c757

app-arch/p7zip: fix compilation on Darwin, bug #577344

Package-Manager: portage-2.2.28-prefix

 app-arch/p7zip/files/p7zip-15.14-darwin.patch | 13 +++++++++++++
 app-arch/p7zip/p7zip-15.14.ebuild             | 20 ++++++++++----------
 2 files changed, 23 insertions(+), 10 deletions(-)

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
index 0000000..2db6de9
--- /dev/null
+++ b/app-arch/p7zip/files/p7zip-15.14-darwin.patch
@@ -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 */

diff --git a/app-arch/p7zip/p7zip-15.14.ebuild 
b/app-arch/p7zip/p7zip-15.14.ebuild
index bd19893..a2efa29 100644
--- a/app-arch/p7zip/p7zip-15.14.ebuild
+++ b/app-arch/p7zip/p7zip-15.14.ebuild
@@ -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
 }

Reply via email to