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

Contents of /eclass/netsurf.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (hide annotations) (download)
Sun Jun 23 16:36:49 2013 UTC (14 months ago) by xmw
Branch: MAIN
CVS Tags: HEAD
Add netsurf.eclass

1 xmw 1.1 # Copyright 1999-2013 Gentoo Foundation
2     # Distributed under the terms of the GNU General Public License v2
3     # $Header: $
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 base 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     # Run base_src_prepare for PATCHES support and multilib_copy_sources for
60     # in-source build.
61     netsurf_src_prepare() {
62     base_src_prepare
63     multilib_copy_sources
64     }
65    
66     # @ECLASS-VARIABLE: netsurf_makeconf
67     # @DESCRIPTION:
68     # Configuration variable bash array to be passed to emake calls.
69     # Defined at netsurf_src_configure and can be altered afterwards.
70    
71     # @FUNCTION: netsurf_src_configure
72     # @DESCRIPTION:
73     # Setup netsurf_makeconf and run multilib-minimal_src_configure.
74     # A default multilib_src_configure is provided by this eclass.
75     netsurf_src_configure() {
76     netsurf_makeconf=(
77     NSSHARED=${WORKDIR}/${NETSURF_BUILDSYSTEM}
78     Q=
79     HOST_CC="\$(CC)"
80     CCOPT=
81     CCNOOPT=
82     CCDBG=
83     LDDBG=
84     AR="$(tc-getAR)"
85     BUILD=$(usex debug debug release)
86     PREFIX="${EROOT}"usr
87     )
88    
89     multilib-minimal_src_configure
90     }
91    
92     multilib_src_configure() {
93     sed -e "/^INSTALL_ITEMS/s: /lib: /$(get_libdir):g" \
94     -i Makefile || die
95     if [ -f ${PN}.pc.in ] ; then
96     sed -e "/^libdir/s:/lib:/$(get_libdir):g" \
97     -i ${PN}.pc.in || die
98     fi
99     }
100    
101     # @FUNCTION: netsurf_make
102     # @DESCRIPTION:
103     # Calls emake with netsurf_makeconf and toolchain CC/LD
104     # as arguments for every NETSURF_COMPONENT_TYPE if activated.
105     netsurf_make() {
106     for COMPONENT_TYPE in ${NETSURF_COMPONENT_TYPE} ; do
107     if [ "${COMPONENT_TYPE}" == "lib-static" ] ; then
108     if ! use static-libs ; then
109     continue
110     fi
111     fi
112     emake CC="$(tc-getCC)" LD="$(tc-getLD)" "${netsurf_makeconf[@]}" \
113     COMPONENT_TYPE=${COMPONENT_TYPE} "$@"
114     done
115     }
116    
117     # @FUNCTION: netsurf_src_compile
118     # @DESCRIPTION:
119     # Calls multilib-minimal_src_compile and netsurf_make doc if USE=doc.
120     # A default multilib_src_compile is provided by this eclass.
121     netsurf_src_compile() {
122     local problems=$(egrep -Hn -- ' (-O.?|-g)( |$)' \
123     $(find . -type f -name 'Makefile*'))
124     if [ -n "${problems}" ] ; then
125     elog "found bad flags:
126     ${problems}"
127     fi
128    
129     multilib-minimal_src_compile "$@"
130    
131     if has doc ${USE} ; then
132     netsurf_make "$@" docs
133     fi
134     }
135    
136     multilib_src_compile() {
137     netsurf_make "$@"
138     }
139    
140     # @FUNCTION: netsurf_src_test
141     # @DESCRIPTION:
142     # Calls multilib-minimal_src_test.
143     # A default multilib_src_test is provided by this eclass.
144     netsurf_src_test() {
145     multilib-minimal_src_test "$@"
146     }
147    
148     multilib_src_test() {
149     netsurf_make test "$@"
150     }
151    
152     # @FUNCTION: netsurf_src_install
153     # @DESCRIPTION:
154     # Calls multilib-minimal_src_install.
155     # A default multilib_src_test is provided by this eclass.
156     # A default multilib_src_install is provided by this eclass.
157     netsurf_src_install() {
158     multilib-minimal_src_install "$@"
159     }
160    
161     multilib_src_install() {
162     #DEFAULT_ABI may not be the last.
163     #install to clean dir, rename binaries, move everything back
164     if [ "${ABI}" == "${DEFAULT_ABI}" ] ; then
165     netsurf_make DESTDIR="${D}" install "$@"
166     else
167     netsurf_make DESTDIR="${D}"${ABI} install "$@"
168     if [ "${ABI}" != "${DEFAULT_ABI}" ] ; then
169     find "${D}"${ABI}/usr/bin -type f -exec mv {} {}.${ABI} \;
170     fi
171     mv "${D}"${ABI}/* "${D}" || die
172     rmdir "${D}"${ABI} || die
173     fi
174     }

  ViewVC Help
Powered by ViewVC 1.1.20