Gentoo Archives: gentoo-commits

From: "Angelo Arrifano (miknix)" <miknix@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in eclass: gpe.eclass
Date: Sat, 28 Feb 2009 14:08:00
Message-Id: E1LdPrC-0001lh-QO@stork.gentoo.org
1 miknix 09/02/28 14:07:58
2
3 Added: gpe.eclass
4 Log:
5 Initial commit of gpe eclass.
6 Credits to solar for his collaborative work with me on GPE.
7
8 Revision Changes Path
9 1.1 eclass/gpe.eclass
10
11 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/gpe.eclass?rev=1.1&view=markup
12 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/gpe.eclass?rev=1.1&content-type=text/plain
13
14 Index: gpe.eclass
15 ===================================================================
16 # Copyright 2008 Gentoo Foundation
17 # Distributed under the terms of the GNU General Public License v2
18 # $Header: /var/cvsroot/gentoo-x86/eclass/gpe.eclass,v 1.1 2009/02/28 14:07:58 miknix Exp $
19 #
20 # @ECLASS: gpe.eclass
21 # @MAINTAINER: <gpe@g.o>
22 #
23 # Original Authors:
24 # Rene Wagner <rw@×××××××××.org>
25 # Ned Ludd <solar@g.o>
26 # Angelo Arrifano <miknix@g.o>
27 #
28 # @BLURB: Provides common functionality for the G Palmtop Environment.
29 # @DESCRIPTION: Provides common functionality for the G Palmtop Environment.
30 #
31 # Thanks to:
32 # loki_val for EAPI->EAPI2 patch
33 # Betelgeuse for multiple suggestions.
34 #
35 # Based on:
36 # gnome2.eclass and gpe.bbclass (the latter from OpenEmbedded)
37
38 inherit libtool toolchain-funcs
39
40 case "${EAPI:-0}" in
41 0|1)
42 EXPORT_FUNCTIONS src_unpack src_compile src_install
43 ;;
44 *)
45 EXPORT_FUNCTIONS src_unpack src_prepare src_configure src_compile src_install
46 ;;
47 esac
48
49 # @ECLASS-VARIABLE: ELTCONF
50 # @DESCRIPTION:
51 # Extra options passed to elibtoolize on gnome2 eclass.
52 ELTCONF=""
53
54 # @ECLASS-VARIABLE: GPE_DOCS
55 # @DESCRIPTION:
56 # Documentation files to be installed with dodoc.
57 GPE_DOCS=""
58
59 [[ -z "${GPE_MIRROR}" ]] && GPE_MIRROR="http://gpe.linuxtogo.org/download/source"
60 [[ -z "${GPE_TARBALL_SUFFIX}" ]] && GPE_TARBALL_SUFFIX="gz"
61 SRC_URI="${GPE_MIRROR}/${P}.tar.${GPE_TARBALL_SUFFIX}"
62
63 HOMEPAGE="http://gpe.linuxtogo.org"
64
65 IUSE="nls"
66 GPECONF="${GPECONF} --enable-debug=no --disable-debug"
67
68 RDEPEND=""
69 DEPEND="
70 >=dev-util/intltool-0.29
71 >=dev-util/pkgconfig-0.12.0"
72
73 # @FUNCTION: gpe_src_unpack
74 # @DESCRIPTION: Unpacks and applies some required patches for GPE.
75 gpe_src_unpack() {
76 unpack ${A}
77 cd "${S}"
78 has "${EAPI:-0}" 0 1 && gpe_src_prepare "$@"
79 }
80
81 # Do not call, use gpe_src_unpack() instead.
82 gpe_src_prepare() {
83 # let portage handle stripping.
84 for file in $(find . -name 'Makefile*') ; do
85 sed -i -e s/'install -s'/'install'/g \
86 -e s/'install -Ds'/'install -D'/g \
87 -e 's/$(INSTALL) -s/$(INSTALL) /g' \
88 -e 's;strip ;#strip ;g' \
89 ${file} \
90 ||die "Sedding ${file} failed."
91 done
92 [[ -f configure ]] && elibtoolize
93 }
94
95 # @FUNCTION: gpe_src_configure
96 # @DESCRIPTION: Configures a GPE package in a cross-compile aware environment.
97 gpe_src_configure() {
98 tc-export CC
99 [[ -f configure ]] && econf "$@" ${GPECONF}
100 }
101
102 # @FUNCTION: gpe_src_compile
103 # @DESCRIPTION: (Cross-)Compiles a GPE package.
104 gpe_src_compile() {
105 tc-export CC
106 has "${EAPI:-0}" 0 1 && gpe_src_configure "$@"
107 emake PREFIX=/usr || die "emake failed"
108 }
109
110 # @FUNCTION: gpe_src_install
111 # @DESCRIPTION: Installs a GPE package in the correct way.
112 gpe_src_install() {
113 local use_nls=yes
114
115 use nls || use_nls=no
116
117 if [ -f configure ]; then
118 einstall "$@" || die "einstall failed"
119 else
120 emake STRIP=true DESTDIR=${D} PREFIX=/usr \
121 ENABLE_NLS=${use_nls} "$@" install || die "emake install failed"
122 fi
123
124 use nls || rm -rf ${D}/usr/share/locale
125
126 # manual document installation
127 if [[ "${GPE_DOCS}" ]]; then
128 dodoc ${GPE_DOCS} || die "dodoc failed"
129 fi
130 }