| 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.ebuild,v 1.10 2011/03/26 19:48:13 jlec Exp $ |
| 4 |
|
| 5 |
EAPI="2" |
| 6 |
WX_GTK_VER="2.8" |
| 7 |
|
| 8 |
inherit eutils flag-o-matic 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 ~x86-macos" |
| 17 |
IUSE="doc kde rar 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 |
append-flags -fno-strict-aliasing |
| 29 |
} |
| 30 |
|
| 31 |
src_prepare() { |
| 32 |
epatch "${FILESDIR}"/${P}-QA.patch |
| 33 |
|
| 34 |
if use kde && ! use wxwidgets ; then |
| 35 |
einfo "USE-flag kde needs wxwidgets flag" |
| 36 |
einfo "silently enabling wxwidgets flag" |
| 37 |
fi |
| 38 |
|
| 39 |
# remove non-free RAR codec |
| 40 |
if use rar; then |
| 41 |
ewarn "Enabling nonfree RAR decompressor" |
| 42 |
else |
| 43 |
sed -e '/Rar/d' -i makefile* |
| 44 |
rm -rf CPP/7zip/Compress/Rar |
| 45 |
epatch "${FILESDIR}"/9.04-makefile.patch |
| 46 |
fi |
| 47 |
|
| 48 |
sed -i \ |
| 49 |
-e "/^CXX=/s:g++:$(tc-getCXX):" \ |
| 50 |
-e "/^CC=/s:gcc:$(tc-getCC):" \ |
| 51 |
-e "s:OPTFLAGS=-O:OPTFLAGS=${CXXFLAGS}:" \ |
| 52 |
-e '/ALLFLAGS/s:-s ::' \ |
| 53 |
makefile* || die "changing makefiles" |
| 54 |
|
| 55 |
if use amd64; then |
| 56 |
cp -f makefile.linux_amd64 makefile.machine |
| 57 |
elif [[ ${CHOST} == *-darwin* ]] ; then |
| 58 |
# Mac OS X needs this special makefile, because it has a non-GNU linker |
| 59 |
[[ ${CHOST} == *64-* ]] \ |
| 60 |
&& cp -f makefile.macosx_64bits makefile.machine \ |
| 61 |
|| cp -f makefile.macosx_32bits makefile.machine |
| 62 |
# bundles have extension .bundle but don't die because USE=-rar |
| 63 |
# removes the Rar directory |
| 64 |
sed -i -e '/^PROG=/s/\.so/.bundle/' \ |
| 65 |
CPP/7zip/Bundles/Format7zFree/makefile \ |
| 66 |
CPP/7zip/Compress/Rar/makefile |
| 67 |
elif use x86-fbsd; then |
| 68 |
# FreeBSD needs this special makefile, because it hasn't -ldl |
| 69 |
sed -e 's/-lc_r/-pthread/' makefile.freebsd > makefile.machine |
| 70 |
fi |
| 71 |
use static && sed -i -e '/^LOCAL_LIBS=/s/LOCAL_LIBS=/&-static /' makefile.machine |
| 72 |
|
| 73 |
# We can be more parallel |
| 74 |
cp -f makefile.parallel_jobs makefile |
| 75 |
|
| 76 |
epatch "${FILESDIR}"/9.04-kde4.patch |
| 77 |
|
| 78 |
if use kde || use wxwidgets; then |
| 79 |
einfo "Preparing dependency list" |
| 80 |
emake depend || die |
| 81 |
fi |
| 82 |
} |
| 83 |
|
| 84 |
src_compile() { |
| 85 |
emake all3 || die "compilation error" |
| 86 |
if use kde || use wxwidgets; then |
| 87 |
emake 7zG || die "error building GUI" |
| 88 |
fi |
| 89 |
} |
| 90 |
|
| 91 |
src_test() { |
| 92 |
emake test_7z test_7zr || die "test failed" |
| 93 |
} |
| 94 |
|
| 95 |
src_install() { |
| 96 |
# this wrappers can not be symlinks, p7zip should be called with full path |
| 97 |
make_wrapper 7zr "/usr/$(get_libdir)/${PN}/7zr" |
| 98 |
make_wrapper 7za "/usr/$(get_libdir)/${PN}/7za" |
| 99 |
make_wrapper 7z "/usr/$(get_libdir)/${PN}/7z" |
| 100 |
|
| 101 |
if use kde || use wxwidgets; then |
| 102 |
make_wrapper 7zG "/usr/$(get_libdir)/${PN}/7zG" |
| 103 |
|
| 104 |
dobin GUI/p7zipForFilemanager |
| 105 |
exeinto /usr/$(get_libdir)/${PN} |
| 106 |
doexe bin/7zG |
| 107 |
|
| 108 |
insinto /usr/$(get_libdir)/${PN} |
| 109 |
doins -r GUI/{Lang,help} |
| 110 |
|
| 111 |
if use kde; then |
| 112 |
insinto /usr/share/icons/hicolor/16x16/apps/ |
| 113 |
newins GUI/p7zip_16_ok.png p7zip.png |
| 114 |
|
| 115 |
insinto /usr/share/kde4/services/ServiceMenus |
| 116 |
doins GUI/kde/*.desktop |
| 117 |
fi |
| 118 |
fi |
| 119 |
|
| 120 |
dobin "${FILESDIR}/p7zip" || die |
| 121 |
|
| 122 |
# gzip introduced in 4.42, so beware :) |
| 123 |
newbin contrib/gzip-like_CLI_wrapper_for_7z/p7zip 7zg || die |
| 124 |
|
| 125 |
exeinto /usr/$(get_libdir)/${PN} |
| 126 |
doexe bin/7z bin/7za bin/7zr bin/7zCon.sfx || die "doexe bins" |
| 127 |
doexe bin/*$(get_modname) || die "doexe *$(get_modname) files" |
| 128 |
if use rar; then |
| 129 |
exeinto /usr/$(get_libdir)/${PN}/Codecs/ |
| 130 |
doexe bin/Codecs/*$(get_modname) || die "doexe Codecs/*$(get_modname) files" |
| 131 |
fi |
| 132 |
|
| 133 |
doman man1/7z.1 man1/7za.1 man1/7zr.1 |
| 134 |
dodoc ChangeLog README TODO |
| 135 |
|
| 136 |
if use doc; then |
| 137 |
dodoc DOCS/*.txt |
| 138 |
dohtml -r DOCS/MANUAL/* |
| 139 |
fi |
| 140 |
} |