Gentoo Archives: gentoo-commits

From: Daniel Pielmeier <billie@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: app-cdr/cdrtools/
Date: Sun, 14 Oct 2018 09:15:51
Message-Id: 1539508524.746f4e62ffb7f4b1b4ed6642cfacee79ad5866ff.billie@gentoo
1 commit: 746f4e62ffb7f4b1b4ed6642cfacee79ad5866ff
2 Author: Daniel Pielmeier <billie <AT> gentoo <DOT> org>
3 AuthorDate: Sun Oct 14 09:14:44 2018 +0000
4 Commit: Daniel Pielmeier <billie <AT> gentoo <DOT> org>
5 CommitDate: Sun Oct 14 09:15:24 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=746f4e62
7
8 app-cdr/cdrtools: Add support for the SELinux policy package.
9
10 Thanks to Scall and Luis Ressel for the report.
11
12 Signed-off-by: Daniel Pielmeier <billie <AT> gentoo.org>
13 Package-Manager: Portage-2.3.49, Repoman-2.3.11
14
15 app-cdr/cdrtools/cdrtools-3.02_alpha09-r2.ebuild | 280 +++++++++++++++++++++++
16 1 file changed, 280 insertions(+)
17
18 diff --git a/app-cdr/cdrtools/cdrtools-3.02_alpha09-r2.ebuild b/app-cdr/cdrtools/cdrtools-3.02_alpha09-r2.ebuild
19 new file mode 100644
20 index 00000000000..b7c396deae0
21 --- /dev/null
22 +++ b/app-cdr/cdrtools/cdrtools-3.02_alpha09-r2.ebuild
23 @@ -0,0 +1,280 @@
24 +# Copyright 1999-2018 Gentoo Authors
25 +# Distributed under the terms of the GNU General Public License v2
26 +
27 +EAPI=7
28 +
29 +inherit fcaps multilib toolchain-funcs flag-o-matic gnuconfig
30 +
31 +MY_P="${P/_alpha/a}"
32 +
33 +DESCRIPTION="A set of tools for CD/DVD reading and recording, including cdrecord"
34 +HOMEPAGE="https://sourceforge.net/projects/cdrtools/"
35 +SRC_URI="mirror://sourceforge/${PN}/$([[ -z ${PV/*_alpha*} ]] && echo 'alpha')/${MY_P}.tar.bz2"
36 +
37 +LICENSE="GPL-2 LGPL-2.1 CDDL-Schily"
38 +SLOT="0"
39 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x86-macos ~sparc-solaris ~x86-solaris"
40 +IUSE="acl caps nls unicode selinux"
41 +
42 +BDEPEND="
43 + nls? ( >=sys-devel/gettext-0.18.1.1 )
44 +"
45 +RDEPEND="
46 + acl? ( virtual/acl )
47 + caps? ( sys-libs/libcap )
48 + nls? ( virtual/libintl )
49 + !app-cdr/cdrkit
50 + selinux? ( sec-policy/selinux-cdrecord )
51 +"
52 +DEPEND="
53 + ${RDEPEND}
54 + x11-misc/makedepend
55 +"
56 +
57 +S=${WORKDIR}/${P/_alpha[0-9][0-9]}
58 +
59 +FILECAPS=(
60 + cap_sys_resource,cap_dac_override,cap_sys_admin,cap_sys_nice,cap_net_bind_service,cap_ipc_lock,cap_sys_rawio+ep usr/bin/cdrecord --
61 + cap_dac_override,cap_sys_admin,cap_sys_nice,cap_net_bind_service,cap_sys_rawio+ep usr/bin/cdda2wav --
62 + cap_dac_override,cap_sys_admin,cap_net_bind_service,cap_sys_rawio+ep usr/bin/readcd
63 +)
64 +
65 +cdrtools_os() {
66 + local os="linux"
67 + [[ ${CHOST} == *-darwin* ]] && os="mac-os10"
68 + [[ ${CHOST} == *-freebsd* ]] && os="freebsd"
69 + echo "${os}"
70 +}
71 +
72 +src_prepare() {
73 + default
74 +
75 + gnuconfig_update
76 +
77 + # This fixes a clash with clone() on uclibc. Upstream isn't
78 + # going to include this so let's try to carry it forward.
79 + # Contact me if it needs updating. Bug #486782.
80 + # Anthony G. Basile <blueness@g.o>.
81 + use elibc_uclibc && epatch "${FILESDIR}"/${PN}-fix-clone-uclibc.patch
82 +
83 + # Remove profiled make files.
84 + find -name '*_p.mk' -delete || die "delete *_p.mk"
85 +
86 + # Adjusting hardcoded paths.
87 + sed -i -e "s|opt/schily|usr|" \
88 + $(find ./ -type f -name \*.[0-9ch] -exec grep -l 'opt/schily' '{}' '+') \
89 + || die "sed opt/schily"
90 +
91 + sed -i -e "s|\(^INSDIR=\t\tshare/doc/\)|\1${PF}/|" \
92 + $(find ./ -type f -exec grep -l '^INSDIR.\+doc' '{}' '+') \
93 + || die "sed doc"
94 +
95 + # Respect libdir.
96 + sed -i -e "s|\(^INSDIR=\t\t\)lib|\1$(get_libdir)|" \
97 + $(find ./ -type f -exec grep -l '^INSDIR.\+lib\(/siconv\)\?$' '{}' '+') \
98 + || die "sed multilib"
99 +
100 + # Do not install static libraries.
101 + sed -i -e "s|include\t\t.*rules.lib||" \
102 + $(find ./ -type f -exec grep -l '^include.\+rules\.lib' '{}' '+') \
103 + || die "sed rules"
104 +
105 + # Enable verbose build.
106 + sed -i -e '/@echo.*==>.*;/s:@echo[^;]*;:&set -x;:' \
107 + RULES/*.rul RULES/rules.prg RULES/rules.inc \
108 + || die "sed verbose rules"
109 +
110 + # Respect CC/CXX variables.
111 + cd "${S}"/RULES || die
112 + local tcCC=$(tc-getCC)
113 + local tcCXX=$(tc-getCXX)
114 + sed -i -e "/cc-config.sh/s|\$(C_ARCH:%64=%) \$(CCOM_DEF)|${tcCC} ${tcCC}|" \
115 + rules1.top || die "sed rules1.top"
116 + sed -i -e "/^CC_COM_DEF=/s|gcc|${tcCC}|" \
117 + -e "/^CC++_COM_DEF=/s|g++|${tcCXX}|" \
118 + -e "/COPTOPT=/s|-O||" \
119 + -e 's|$(GCCOPTOPT)||' \
120 + cc-gcc.rul || die "sed cc-gcc.rul"
121 + sed -i -e "s|^#\(CONFFLAGS +=\).*|\1\t-cc=${tcCC}|" \
122 + rules.cnf || die "sed rules.cnf"
123 +
124 + # Schily make setup.
125 + cd "${S}"/DEFAULTS || die
126 + local os=$(cdrtools_os)
127 +
128 + sed -i \
129 + -e "s|^\(DEFLINKMODE=\).*|\1\tdynamic|" \
130 + -e "s|^\(LINUX_INCL_PATH=\).*|\1|" \
131 + -e "s|^\(LDPATH=\).*|\1|" \
132 + -e "s|^\(RUNPATH=\).*|\1|" \
133 + -e "s|^\(INS_BASE=\).*|\1\t${ED}/usr|" \
134 + -e "s|^\(INS_RBASE=\).*|\1\t${ED}|" \
135 + -e "s|^\(DEFINSGRP=\).*|\1\t0|" \
136 + -e '/^DEFUMASK/s,002,022,g' \
137 + Defaults.${os} || die "sed Schily make setup"
138 + # re DEFUMASK above:
139 + # bug 486680: grsec TPE will block the exec if the directory is
140 + # group-writable. This is painful with cdrtools, because it makes a bunch of
141 + # group-writable directories during build. Change the umask on their
142 + # creation to prevent this.
143 +}
144 +
145 +ac_cv_sizeof() {
146 + cat <<-EOF >"${T}"/test.c
147 + #include <inttypes.h>
148 + #include <stddef.h>
149 + #include <stdint.h>
150 + #include <sys/types.h>
151 + int main () {
152 + static int test_array [1 - 2 * !((sizeof(TYPE)) == LEN)];
153 + test_array [0] = 0;
154 + return test_array [0];
155 + }
156 + EOF
157 +
158 + local i=1
159 + while [[ ${i} -lt 20 ]] ; do
160 + if ${CC} ${CPPFLAGS} ${CFLAGS} -c "${T}"/test.c -o /dev/null -DTYPE="$1" -DLEN=$i 2>/dev/null; then
161 + echo ${i}
162 + return 0
163 + fi
164 + : $(( i += 1 ))
165 + done
166 + return 1
167 +}
168 +
169 +src_configure() {
170 + use acl || export ac_cv_header_sys_acl_h="no"
171 + use caps || export ac_cv_lib_cap_cap_get_proc="no"
172 + export ac_cv_header_pulse_pulseaudio_h="no"
173 +
174 + # skip obsolete configure script
175 + if tc-is-cross-compiler ; then
176 + # Cache known values for targets. #486680
177 +
178 + tc-export CC
179 + local var val t types=(
180 + char "short int" int "long int" "long long"
181 + "unsigned char" "unsigned short int" "unsigned int"
182 + "unsigned long int" "unsigned long long"
183 + float double "long double" size_t ssize_t ptrdiff_t
184 + mode_t uid_t gid_t pid_t dev_t time_t wchar_t
185 + "char *" "unsigned char *"
186 + )
187 + for t in "${types[@]}" ; do
188 + var="ac_cv_sizeof_${t// /_}"
189 + var=${var//[*]/p}
190 + val=$(ac_cv_sizeof "${t}") || die "could not compute ${t}"
191 + export "${var}=${val}"
192 + einfo "Computing sizeof(${t}) as ${val}"
193 + done
194 + # We don't have these types.
195 + export ac_cv_sizeof___int64=0
196 + export ac_cv_sizeof_unsigned___int64=0
197 + export ac_cv_sizeof_major_t=${ac_cv_sizeof_dev_t}
198 + export ac_cv_sizeof_minor_t=${ac_cv_sizeof_dev_t}
199 + export ac_cv_sizeof_wchar=${ac_cv_sizeof_wchar_t}
200 +
201 + export ac_cv_type_prototypes="yes"
202 + export ac_cv_func_mlock{,all}="yes"
203 + export ac_cv_func_{e,f,g}cvt=$(usex elibc_glibc)
204 + export ac_cv_func_dtoa_r="no"
205 + export ac_cv_func_sys_siglist{,_def}="no"
206 + export ac_cv_func_printf_{j,ll}="yes"
207 + export ac_cv_realloc_null="yes"
208 + export ac_cv_no_user_malloc="no"
209 + export ac_cv_var_timezone="yes"
210 + export ac_cv_var___progname{,_full}="yes"
211 + export ac_cv_fnmatch_igncase="yes"
212 + export ac_cv_file__dev_{fd_{0,1,2},null,std{err,in,out},tty,zero}="yes"
213 + export ac_cv_file__usr_src_linux_include="no"
214 +
215 + case $(cdrtools_os) in
216 + linux)
217 + export ac_cv_func_bsd_{g,s}etpgrp="no"
218 + export ac_cv_hard_symlinks="yes"
219 + export ac_cv_link_nofollow="yes"
220 + export ac_cv_access_e_ok="no"
221 +
222 + export ac_cv_dev_minor_noncontig="yes"
223 + case ${ac_cv_sizeof_long_int} in
224 + 4) export ac_cv_dev_minor_bits="32";;
225 + 8) export ac_cv_dev_minor_bits="44";;
226 + esac
227 +
228 + cat <<-EOF >"${T}"/test.c
229 + struct {
230 + char start[6];
231 + unsigned char x1:4;
232 + unsigned char x2:4;
233 + char end[5];
234 + } a = {
235 + .start = {'S', 't', 'A', 'r', 'T', '_'},
236 + .x1 = 5,
237 + .x2 = 4,
238 + .end = {'_', 'e', 'N', 'd', 'X'},
239 + };
240 + EOF
241 + ${CC} ${CPPFLAGS} ${CFLAGS} -c "${T}"/test.c -o "${T}"/test.o
242 + if grep -q 'StArT_E_eNdX' "${T}"/test.o ; then
243 + export ac_cv_c_bitfields_htol="no"
244 + elif grep -q 'StArT_T_eNdX' "${T}"/test.o ; then
245 + export ac_cv_c_bitfields_htol="yes"
246 + fi
247 + ;;
248 + esac
249 + fi
250 +}
251 +
252 +src_compile() {
253 + if use unicode; then
254 + local flags="$(test-flags -finput-charset=ISO-8859-1 -fexec-charset=UTF-8)"
255 + if [[ -n ${flags} ]]; then
256 + append-flags ${flags}
257 + else
258 + ewarn "Your compiler does not support the options required to build"
259 + ewarn "cdrtools with unicode in USE. unicode flag will be ignored."
260 + fi
261 + fi
262 +
263 + # If not built with -j1, "sometimes" cdda2wav will not be built.
264 + emake -j1 CPPOPTX="${CPPFLAGS}" COPTX="${CFLAGS}" C++OPTX="${CXXFLAGS}" \
265 + LDOPTX="${LDFLAGS}" GMAKE_NOWARN="true"
266 +}
267 +
268 +src_install() {
269 + # If not built with -j1, "sometimes" manpages are not installed.
270 + emake -j1 CPPOPTX="${CPPFLAGS}" COPTX="${CFLAGS}" C++OPTX="${CXXFLAGS}" \
271 + LDOPTX="${LDFLAGS}" GMAKE_NOWARN="true" install
272 +
273 + # These symlinks are for compat with cdrkit.
274 + dosym schily /usr/include/scsilib
275 + dosym ../scg /usr/include/schily/scg
276 +
277 + dodoc ABOUT Changelog* CONTRIBUTING PORTING README.linux-shm READMEs/README.linux
278 +
279 + cd "${S}"/cdda2wav || die
280 + docinto cdda2wav
281 + dodoc Changelog FAQ Frontends HOWTOUSE NEEDED README THANKS TODO
282 +
283 + cd "${S}"/mkisofs || die
284 + docinto mkisofs
285 + dodoc ChangeLog* TODO
286 +
287 + # Remove man pages related to the build system
288 + rm -rvf "${ED}"/usr/share/man/man5 || die
289 +}
290 +
291 +pkg_postinst() {
292 + fcaps_pkg_postinst
293 +
294 + if [[ ${CHOST} == *-darwin* ]] ; then
295 + einfo
296 + einfo "Darwin/OS X use the following device names:"
297 + einfo
298 + einfo "CD burners: (probably) ./cdrecord dev=IOCompactDiscServices"
299 + einfo
300 + einfo "DVD burners: (probably) ./cdrecord dev=IODVDServices"
301 + einfo
302 + fi
303 +}