/[gentoo-x86]/eclass/netsurf.eclass
Gentoo

Contents of /eclass/netsurf.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations) (download)
Wed Dec 24 09:58:27 2014 UTC (2 days, 23 hours ago) by xmw
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +8 -6 lines
remove base.eclass inherit

1 # Copyright 1999-2014 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/eclass/netsurf.eclass,v 1.1 2013/06/23 16:36:49 xmw Exp $
4
5 # @ECLASS: netsurf.eclass
6 # @MAINTAINER:
7 # Michael Weber <xmw@gentoo.org>
8 # @BLURB: Handle buildsystem of www.netsurf-browser.org components
9 # @DESCRIPTION:
10 # Handle unpacking and usage of separate buildsystem tarball and manage
11 # multilib build, static-libs generation and debug building.
12 #
13 # Supports PATCHES and DOCS as in base.eclass
14
15 case ${EAPI:-0} in
16 0|1|2|3|4) die "this eclass doesn't support EAPI<5" ;;
17 *) ;;
18 esac
19
20 inherit eutils toolchain-funcs multilib-minimal
21
22 EXPORT_FUNCTIONS src_prepare src_configure src_compile src_install
23
24 # @ECLASS-VARIABLE: NETSURF_BUILDSYSTEM
25 # @DESCRIPTION:
26 # Select version of buildsystem tarball to be used along the component
27 # defaults to buildsystem-1.0
28 NETSURF_BUILDSYSTEM="${NETSURF_BUILDSYSTEM:-buildsystem-1.0}"
29
30 # @ECLASS-VARIABLE: NETSURF_BUILDSYSTEM_SRC_URI
31 # @DESCRIPTION:
32 # Download link for NETSURF_BUILDSYSTEM, add to SRC_URI iff set explicitly.
33 NETSURF_BUILDSYSTEM_SRC_URI="http://download.netsurf-browser.org/libs/releases/${NETSURF_BUILDSYSTEM}.tar.gz -> netsurf-${NETSURF_BUILDSYSTEM}.tar.gz"
34
35 # @ECLASS-VARIABLE: NETSURF_COMPONENT_TYPE
36 # @DESCRIPTION:
37 # Passed to buildsystem as COMPONENT_TYPE, valid values are
38 # lib-shared, lib-static and binary. Defaults to "lib-static lib-shared"
39 NETSURF_COMPONENT_TYPE="${NETSURF_COMPONENT_TYPE:-lib-static lib-shared}"
40
41 # @ECLASS-VARIABLE: SRC_URI
42 # @DESCRIPTION:
43 # Defaults to http://download.netsurf-browser.org/libs/releases/${P}-src.tar.gz
44 # and NETSURF_BUILDSYSTEM_SRC_URI.
45 if [ -z "${SRC_URI}" ] ; then
46 SRC_URI="http://download.netsurf-browser.org/libs/releases/${P}-src.tar.gz
47 ${NETSURF_BUILDSYSTEM_SRC_URI}"
48 fi
49
50 IUSE="debug"
51 if has lib-static ${NETSURF_COMPONENT_TYPE} ; then
52 IUSE+=" static-libs"
53 fi
54
55 DEPEND="virtual/pkgconfig"
56
57 # @FUNCTION: netsurf_src_prepare
58 # @DESCRIPTION:
59 # Apply and PATCHES and multilib_copy_sources for in-source build.
60 netsurf_src_prepare() {
61 [[ ${PATCHES[@]} ]] && epatch "${PATCHES[@]}"
62 debug-print "$FUNCNAME: applying user patches"
63 epatch_user
64
65 multilib_copy_sources
66 }
67
68 # @ECLASS-VARIABLE: netsurf_makeconf
69 # @DESCRIPTION:
70 # Configuration variable bash array to be passed to emake calls.
71 # Defined at netsurf_src_configure and can be altered afterwards.
72
73 # @FUNCTION: netsurf_src_configure
74 # @DESCRIPTION:
75 # Setup netsurf_makeconf and run multilib-minimal_src_configure.
76 # A default multilib_src_configure is provided by this eclass.
77 netsurf_src_configure() {
78 netsurf_makeconf=(
79 NSSHARED=${WORKDIR}/${NETSURF_BUILDSYSTEM}
80 Q=
81 HOST_CC="\$(CC)"
82 CCOPT=
83 CCNOOPT=
84 CCDBG=
85 LDDBG=
86 AR="$(tc-getAR)"
87 BUILD=$(usex debug debug release)
88 PREFIX="${EROOT}"usr
89 )
90
91 multilib-minimal_src_configure
92 }
93
94 multilib_src_configure() {
95 sed -e "/^INSTALL_ITEMS/s: /lib: /$(get_libdir):g" \
96 -i Makefile || die
97 if [ -f ${PN}.pc.in ] ; then
98 sed -e "/^libdir/s:/lib:/$(get_libdir):g" \
99 -i ${PN}.pc.in || die
100 fi
101 }
102
103 # @FUNCTION: netsurf_make
104 # @DESCRIPTION:
105 # Calls emake with netsurf_makeconf and toolchain CC/LD
106 # as arguments for every NETSURF_COMPONENT_TYPE if activated.
107 netsurf_make() {
108 for COMPONENT_TYPE in ${NETSURF_COMPONENT_TYPE} ; do
109 if [ "${COMPONENT_TYPE}" == "lib-static" ] ; then
110 if ! use static-libs ; then
111 continue
112 fi
113 fi
114 emake CC="$(tc-getCC)" LD="$(tc-getLD)" "${netsurf_makeconf[@]}" \
115 COMPONENT_TYPE=${COMPONENT_TYPE} "$@"
116 done
117 }
118
119 # @FUNCTION: netsurf_src_compile
120 # @DESCRIPTION:
121 # Calls multilib-minimal_src_compile and netsurf_make doc if USE=doc.
122 # A default multilib_src_compile is provided by this eclass.
123 netsurf_src_compile() {
124 local problems=$(egrep -Hn -- ' (-O.?|-g)( |$)' \
125 $(find . -type f -name 'Makefile*'))
126 if [ -n "${problems}" ] ; then
127 elog "found bad flags:
128 ${problems}"
129 fi
130
131 multilib-minimal_src_compile "$@"
132
133 if has doc ${USE} ; then
134 netsurf_make "$@" docs
135 fi
136 }
137
138 multilib_src_compile() {
139 netsurf_make "$@"
140 }
141
142 # @FUNCTION: netsurf_src_test
143 # @DESCRIPTION:
144 # Calls multilib-minimal_src_test.
145 # A default multilib_src_test is provided by this eclass.
146 netsurf_src_test() {
147 multilib-minimal_src_test "$@"
148 }
149
150 multilib_src_test() {
151 netsurf_make test "$@"
152 }
153
154 # @FUNCTION: netsurf_src_install
155 # @DESCRIPTION:
156 # Calls multilib-minimal_src_install.
157 # A default multilib_src_test is provided by this eclass.
158 # A default multilib_src_install is provided by this eclass.
159 netsurf_src_install() {
160 multilib-minimal_src_install "$@"
161 }
162
163 multilib_src_install() {
164 #DEFAULT_ABI may not be the last.
165 #install to clean dir, rename binaries, move everything back
166 if [ "${ABI}" == "${DEFAULT_ABI}" ] ; then
167 netsurf_make DESTDIR="${D}" install "$@"
168 else
169 netsurf_make DESTDIR="${D}"${ABI} install "$@"
170 if [ "${ABI}" != "${DEFAULT_ABI}" ] ; then
171 find "${D}"${ABI}/usr/bin -type f -exec mv {} {}.${ABI} \;
172 fi
173 mv "${D}"${ABI}/* "${D}" || die
174 rmdir "${D}"${ABI} || die
175 fi
176 }

  ViewVC Help
Powered by ViewVC 1.1.20