| 1 |
# Copyright 1999-2012 Gentoo Foundation
|
| 2 |
# Distributed under the terms of the GNU General Public License v2
|
| 3 |
# $Header: /var/cvsroot/gentoo-x86/app-arch/p7zip/p7zip-9.13-r3.ebuild,v 1.3 2011/03/26 19:48:13 jlec Exp $
|
| 4 |
|
| 5 |
EAPI="2"
|
| 6 |
WX_GTK_VER="2.8"
|
| 7 |
|
| 8 |
inherit eutils toolchain-funcs multilib wxwidgets
|
| 9 |
|
| 10 |
DESCRIPTION="Port of 7-Zip archiver for Unix"
|
| 11 |
HOMEPAGE="http://p7zip.sourceforge.net/"
|
| 12 |
SRC_URI="mirror://sourceforge/${PN}/${PN}_${PV}_src_all.tar.bz2"
|
| 13 |
|
| 14 |
LICENSE="LGPL-2.1 rar? ( unRAR )"
|
| 15 |
SLOT="0"
|
| 16 |
KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~ppc ~ppc64 ~sparc ~x86 ~x86-fbsd ~x86-freebsd ~x86-interix ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos"
|
| 17 |
IUSE="doc kde rar +pch static wxwidgets"
|
| 18 |
|
| 19 |
RDEPEND="
|
| 20 |
kde? ( x11-libs/wxGTK:2.8[X,-odbc] kde-base/kdelibs )
|
| 21 |
wxwidgets? ( x11-libs/wxGTK:2.8[X,-odbc] )"
|
| 22 |
DEPEND="${RDEPEND}"
|
| 23 |
|
| 24 |
S=${WORKDIR}/${PN}_${PV}
|
| 25 |
|
| 26 |
pkg_setup() {
|
| 27 |
use wxwidgets && wxwidgets_pkg_setup
|
| 28 |
}
|
| 29 |
|
| 30 |
src_prepare() {
|
| 31 |
epatch "${FILESDIR}"/${P}-QA.patch
|
| 32 |
|
| 33 |
if ! use pch; then
|
| 34 |
sed "s:PRE_COMPILED_HEADER=StdAfx.h.gch:PRE_COMPILED_HEADER=:g" -i makefile.* || die
|
| 35 |
fi
|
| 36 |
|
| 37 |
# Being able to use native multilib
|
| 38 |
sed \
|
| 39 |
-e 's:-m32 ::g' \
|
| 40 |
-e 's:-m64 ::g' \
|
| 41 |
-i makefile* || die
|
| 42 |
|
| 43 |
sed \
|
| 44 |
-e "/^CC/s:\$(ALLFLAGS):${CFLAGS} \$(ALLFLAGS):g" \
|
| 45 |
-e "/^CXX/s:\$(ALLFLAGS):${CXXFLAGS} \$(ALLFLAGS):g" \
|
| 46 |
-i makefile* || die
|
| 47 |
if use kde && ! use wxwidgets ; then
|
| 48 |
einfo "USE-flag kde needs wxwidgets flag"
|
| 49 |
einfo "silently enabling wxwidgets flag"
|
| 50 |
fi
|
| 51 |
|
| 52 |
# remove non-free RAR codec
|
| 53 |
if use rar; then
|
| 54 |
ewarn "Enabling nonfree RAR decompressor"
|
| 55 |
else
|
| 56 |
sed -e '/Rar/d' -i makefile*
|
| 57 |
rm -rf CPP/7zip/Compress/Rar
|
| 58 |
epatch "${FILESDIR}"/9.04-makefile.patch
|
| 59 |
fi
|
| 60 |
|
| 61 |
sed -i \
|
| 62 |
-e "/^CXX=/s:g++:$(tc-getCXX):" \
|
| 63 |
-e "/^CC=/s:gcc:$(tc-getCC):" \
|
| 64 |
-e '/ALLFLAGS/s:-s ::' \
|
| 65 |
makefile* || die "changing makefiles"
|
| 66 |
|
| 67 |
if use amd64; then
|
| 68 |
cp -f makefile.linux_amd64 makefile.machine
|
| 69 |
elif [[ ${CHOST} == *-darwin* ]] ; then
|
| 70 |
# Mac OS X needs this special makefile, because it has a non-GNU linker
|
| 71 |
[[ ${CHOST} == *64-* ]] \
|
| 72 |
&& cp -f makefile.macosx_64bits makefile.machine \
|
| 73 |
|| cp -f makefile.macosx_32bits makefile.machine
|
| 74 |
# bundles have extension .bundle but don't die because USE=-rar
|
| 75 |
# removes the Rar directory
|
| 76 |
sed -i -e '/strcpy(name/s/\.so/.bundle/' \
|
| 77 |
CPP/Windows/DLL.cpp || die
|
| 78 |
sed -i -e '/^PROG=/s/\.so/.bundle/' \
|
| 79 |
CPP/7zip/Bundles/Format7zFree/makefile \
|
| 80 |
$(use rar && echo CPP/7zip/Compress/Rar/makefile) || die
|
| 81 |
elif use x86-fbsd; then
|
| 82 |
# FreeBSD needs this special makefile, because it hasn't -ldl
|
| 83 |
sed -e 's/-lc_r/-pthread/' makefile.freebsd > makefile.machine
|
| 84 |
fi
|
| 85 |
use static && sed -i -e '/^LOCAL_LIBS=/s/LOCAL_LIBS=/&-static /' makefile.machine
|
| 86 |
|
| 87 |
# We can be more parallel
|
| 88 |
cp -f makefile.parallel_jobs makefile
|
| 89 |
|
| 90 |
epatch "${FILESDIR}"/9.04-kde4.patch
|
| 91 |
|
| 92 |
if use kde || use wxwidgets; then
|
| 93 |
einfo "Preparing dependency list"
|
| 94 |
emake depend || die
|
| 95 |
fi
|
| 96 |
}
|
| 97 |
|
| 98 |
src_compile() {
|
| 99 |
emake all3 || die "compilation error"
|
| 100 |
if use kde || use wxwidgets; then
|
| 101 |
emake 7zG || die "error building GUI"
|
| 102 |
fi
|
| 103 |
}
|
| 104 |
|
| 105 |
src_test() {
|
| 106 |
emake test_7z test_7zr || die "test failed"
|
| 107 |
}
|
| 108 |
|
| 109 |
src_install() {
|
| 110 |
# this wrappers can not be symlinks, p7zip should be called with full path
|
| 111 |
make_wrapper 7zr "/usr/$(get_libdir)/${PN}/7zr"
|
| 112 |
make_wrapper 7za "/usr/$(get_libdir)/${PN}/7za"
|
| 113 |
make_wrapper 7z "/usr/$(get_libdir)/${PN}/7z"
|
| 114 |
|
| 115 |
if use kde || use wxwidgets; then
|
| 116 |
make_wrapper 7zG "/usr/$(get_libdir)/${PN}/7zG"
|
| 117 |
|
| 118 |
dobin GUI/p7zipForFilemanager
|
| 119 |
exeinto /usr/$(get_libdir)/${PN}
|
| 120 |
doexe bin/7zG
|
| 121 |
|
| 122 |
insinto /usr/$(get_libdir)/${PN}
|
| 123 |
doins -r GUI/{Lang,help}
|
| 124 |
|
| 125 |
if use kde; then
|
| 126 |
insinto /usr/share/icons/hicolor/16x16/apps/
|
| 127 |
newins GUI/p7zip_16_ok.png p7zip.png
|
| 128 |
|
| 129 |
insinto /usr/share/kde4/services/ServiceMenus
|
| 130 |
doins GUI/kde/*.desktop
|
| 131 |
fi
|
| 132 |
fi
|
| 133 |
|
| 134 |
dobin contrib/gzip-like_CLI_wrapper_for_7z/p7zip || die
|
| 135 |
doman contrib/gzip-like_CLI_wrapper_for_7z/man1/p7zip.1 || die
|
| 136 |
|
| 137 |
exeinto /usr/$(get_libdir)/${PN}
|
| 138 |
doexe bin/7z bin/7za bin/7zr bin/7zCon.sfx || die "doexe bins"
|
| 139 |
doexe bin/*$(get_modname) || die "doexe *$(get_modname) files"
|
| 140 |
if use rar; then
|
| 141 |
exeinto /usr/$(get_libdir)/${PN}/Codecs/
|
| 142 |
doexe bin/Codecs/*$(get_modname) || die "doexe Codecs/*$(get_modname) files"
|
| 143 |
fi
|
| 144 |
|
| 145 |
doman man1/7z.1 man1/7za.1 man1/7zr.1 || die
|
| 146 |
dodoc ChangeLog README TODO || die
|
| 147 |
|
| 148 |
if use doc; then
|
| 149 |
dodoc DOCS/*.txt
|
| 150 |
dohtml -r DOCS/MANUAL/*
|
| 151 |
fi
|
| 152 |
}
|