Gentoo Archives: gentoo-commits

From: Justin Lecher <jlec@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/sci:pkg-config commit in: eclass/
Date: Thu, 29 Nov 2012 07:11:30
Message-Id: 1354135306.1217b9add9d88d9174efa5f3f4a5d0c944607915.jlec@gentoo
1 commit: 1217b9add9d88d9174efa5f3f4a5d0c944607915
2 Author: Justin Lecher <jlec <AT> gentoo <DOT> org>
3 AuthorDate: Wed Nov 28 20:41:46 2012 +0000
4 Commit: Justin Lecher <jlec <AT> gentoo <DOT> org>
5 CommitDate: Wed Nov 28 20:41:46 2012 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/sci.git;a=commit;h=1217b9ad
7
8 full featured
9
10 Signed-off-by: Justin Lecher <jlec <AT> gentoo.org>
11
12 ---
13 eclass/pkgconfig.eclass | 161 +++++++++++++++++++++++++++++------------------
14 1 files changed, 100 insertions(+), 61 deletions(-)
15
16 diff --git a/eclass/pkgconfig.eclass b/eclass/pkgconfig.eclass
17 index e56e54e..cd401de 100644
18 --- a/eclass/pkgconfig.eclass
19 +++ b/eclass/pkgconfig.eclass
20 @@ -15,41 +15,43 @@ inherit multilib
21 # @REQUIRED
22 # @DESCRIPTION:
23 # Offset for current package
24 -:{PC_PREFIX:-"${EPREFIX}/usr"}
25 +: ${PC_PREFIX:="${EPREFIX}/usr"}
26
27 # @ECLASS-VARIABLE: PC_EXEC_PREFIX
28 # @REQUIRED
29 # @DESCRIPTION:
30 # Offset for current package
31 -:{PC_EXEC_PREFIX:-"${PC_PREFIX}"}
32 +: ${PC_EXEC_PREFIX:="${PC_PREFIX}"}
33
34 # @ECLASS-VARIABLE: PC_LIBDIR
35 # @DESCRIPTION:
36 -# libdir to use, defaults to standard system libdir aka /usr/lib*
37 +# libdir to use
38 +: ${PC_LIBDIR:="${EPREFIX}/usr/$(get_libdir)"}
39
40 # @ECLASS-VARIABLE: PC_INCLUDEDIR
41 # @DESCRIPTION:
42 -# include dir to use, defaults to standard system libdir aka /usr/include
43 -:{PC_INCLUDEDIR:-"${PC_PREFIX}/include"}
44 +# include dir to use
45 +: ${PC_INCLUDEDIR:="${PC_PREFIX}/include"}
46
47 -# A human-readable name for the library or package, defaults to PN
48 -: {PC_NAME:-${PN}}
49 +# @ECLASS-VARIABLE: PC_NAME
50 +# @DESCRIPTION:
51 +# A human-readable name for the library or package
52 +: ${PC_NAME:=${PN}}
53
54 # @ECLASS-VARIABLE: PC_DESCRIPTION
55 # @DESCRIPTION:
56 -# A brief description of the package, defaults to DESCRIPTION
57 -:{PC_DESCRIPTION:-DESCRIPTION}
58 +# A brief description of the package
59 +: ${PC_DESCRIPTION:=${DESCRIPTION}}
60
61 # @ECLASS-VARIABLE: PC_URL
62 # @DESCRIPTION:
63 -# An URL where people can get more information about and download the package,
64 -# defaults to HOMEPAGE
65 -:{PC_URL:-HOMEPAGE}
66 +# An URL where people can get more information about and download the package
67 +: ${PC_URL:=${HOMEPAGE}}
68
69 # @ECLASS-VARIABLE: PC_VERSION
70 # @DESCRIPTION:
71 -# A string specifically defining the version of the package, defaults to ${PV}
72 -:{PC_VERSION:-PV}
73 +# A string specifically defining the version of the package
74 +: ${PC_VERSION:=${PV}}
75
76 # @ECLASS-VARIABLE: PC_REQUIRES
77 # @DEFAULT_UNSET
78 @@ -64,7 +66,7 @@ inherit multilib
79 # applications. The version specific rules from the PC_REQUIRES field also
80 # apply here.
81
82 -# @ECLASS-VARIABLE: PC_CONFLICT
83 +# @ECLASS-VARIABLE: PC_CONFLICTS
84 # @DEFAULT_UNSET
85 # @DESCRIPTION:
86 # An optional field describing packages that this one conflicts with.
87 @@ -72,13 +74,6 @@ inherit multilib
88 # This field also takes multiple instances of the same package. E.g.,
89 # Conflicts: bar < 1.2.3, bar >= 1.3.0.
90
91 -# @ECLASS-VARIABLE: PC_CFLAGS
92 -# @DEFAULT_UNSET
93 -# @DESCRIPTION:
94 -# The compiler flags specific to this package and any required libraries
95 -# that don't support pkg-config. If the required libraries support
96 -# pkg-config, they should be added to PC_REQUIRES or PC_REQUIRES_PRIVATE.
97 -
98 # @ECLASS-VARIABLE: PC_LIBS
99 # @DEFAULT_UNSET
100 # @DESCRIPTION:
101 @@ -91,46 +86,90 @@ inherit multilib
102 # The link flags for private libraries required by this package but not
103 # exposed to applications. The same rule as PC_CFLAGS applies here.
104
105 +# @ECLASS-VARIABLE: PC_CFLAGS
106 +# @DEFAULT_UNSET
107 +# @DESCRIPTION:
108 +# The compiler flags specific to this package and any required libraries
109 +# that don't support pkg-config. If the required libraries support
110 +# pkg-config, they should be added to PC_REQUIRES or PC_REQUIRES_PRIVATE.
111 +
112 # @FUNCTION: create_pkgconfig
113 +# @USAGE: [-p | --prefix PC_PREFIX] [-e | --exec-prefix PC_EXEC_PREFIX] [-L | --libdir PC_LIBDIR ] [-I | --includedir PC_INCLUDEDIR ] [-n | --name PC_NAME] [-d | --description PC_DESCRIPTION] [-V | --version PC_VERSION] [-u | --url PC_URL] [-r | --requires PC_REQUIRES] [--requires-private PC_REQUIRES_PRIVATE] [--conflicts PC_CONFLICTS] [-l | --libs PC_LIBS] [--libs-private PC_LIBS_PRIVATE] [-c | --cflags PC_CFLAGS] <filename>
114 # @DESCRIPTION:
115 +# Creates and installs .pc file. Function arguments overrule the global set
116 +# eclass variables. The function should only be executed in src_install().
117 create_pkgconfig() {
118 - local name
119 - case ${1} in
120 - -i | --includedir )
121 - shift
122 - PC_INCLUDEDIR=${1}
123 - ;;
124 - -l | --libdir )
125 - shift
126 - PC_LIBDIR=${1}
127 - ;;
128 - -* )
129 - die "Unknown option ${1}"
130 - * )
131 - name=${1}
132 - ;;
133 - esac
134 -
135 - [[ -z ${name} ]] && die "Missing name for pkg-config file"
136 - [[ -z ${PC_LIBDIR]] || PC_LIBDIR="${EPREFIX}/usr/$(get_libdir)"
137 -
138 - cat > ${T}/${pcname}.pc <<- EOF
139 - prefix="${EPREFIX}/usr"
140 -exec_prefix=\${prefix}
141 -libdir=\${prefix}/$(get_libdir)
142 -includedir=\${prefix}/include
143 -
144 -Name: ${pcname}
145 -Description: ${PN} ${pcname}
146 -Version: ${PV}
147 -URL: ${HOMEPAGE}
148 -Requires:
149 -Requires.private:
150 -Conflicts:
151 -Libs.private:
152 -Libs: -L\${libdir} -l${libname} $@
153 -Cflags: -I\${includedir}/${PN}
154 -${PCREQ}
155 -EOF
156 -
157 + local pcname
158 +
159 + [[ "${EBUILD_PHASE}" != "install" ]] && \
160 + die "create_pkgconfig should only be used in src_install()"
161 +
162 + while (($#)); do
163 + case ${1} in
164 + -p | --prefix )
165 + shift; PC_PREFIX=${1} ;;
166 + -e | --exec-prefix )
167 + shift; PC_EXEC_PREFIX=${1} ;;
168 + -L | --libdir )
169 + shift; PC_LIBDIR=${1} ;;
170 + -I | --includedir )
171 + shift; PC_INCLUDEDIR=${1} ;;
172 + -n | --name )
173 + shift; PC_NAME=${1} ;;
174 + -d | --description )
175 + shift; PC_DESCRIPTION=${1} ;;
176 + -V | --version )
177 + shift; PC_VERSION=${1} ;;
178 + -u | --url )
179 + shift; PC_URL=${1} ;;
180 + -r | --requires )
181 + shift; PC_REQUIRES=${1} ;;
182 + --requires-private )
183 + shift; PC_REQUIRES_PRIVATE=${1} ;;
184 + --conflicts )
185 + shift; PC_CONFLICTS=${1};;
186 + -l | --libs )
187 + shift; PC_LIBS=${1} ;;
188 + --libs-private )
189 + shift; PC_LIBS_PRIVATE=${1} ;;
190 + -c | --cflags )
191 + shift; PC_CFLAGS=${1} ;;
192 + -* )
193 + ewarn "Unknown option ${1}" ;;
194 + * )
195 + pcname=${1} ;;
196 + esac
197 + shift
198 + done
199 +
200 + [[ -z ${pcname} ]] && die "Missing name for pkg-config file"
201 + : ${PC_PREFIX:="${EPREFIX}/usr"}
202 + : ${PC_EXEC_PREFIX:="${PC_PREFIX}"}
203 + : ${PC_LIBDIR:="${EPREFIX}/usr/$(get_libdir)"}
204 + : ${PC_INCLUDEDIR:="${PC_PREFIX}/include"}
205 + : ${PC_NAME:=${PN}}
206 + : ${PC_DESCRIPTION:=${DESCRIPTION}}
207 + : ${PC_URL:=${HOMEPAGE}}
208 + : ${PC_VERSION:=${PV}}
209 +
210 + cat > "${T}"/${pcname}.pc <<- EOF
211 + prefix="${PC_PREFIX}"
212 + exec_prefix="${PC_EXEC_PREFIX}"
213 + libdir="${PC_LIBDIR}"
214 + includedir="${PC_INCLUDEDIR}"
215 +
216 + Name: ${PC_NAME}
217 + Description: ${PC_DESCRIPTION}
218 + Version: ${PC_VERSION}
219 + URL: ${PC_URL}
220 + Requires: ${PC_REQUIRES}
221 + Requires.private: ${PC_REQUIRES_PRIVATE}
222 + Conflicts: ${PC_CONFLICTS}
223 + Cflags: ${PC_CFLAGS}
224 + Libs: ${PC_LIBS}
225 + Libs.private: ${PC_LIBS_PRIVATE}
226 + EOF
227 +
228 + insinto /usr/$(get_libdir)/pkgconfig
229 + doins "${T}"/${pcname}.pc
230 }