File macros.perl of Package perl
# macros.perl file
# macros for perl module building. handle with care.
# Useful perl macros (from Artur Frysiak <wiget@t17.ds.pwr.wroc.pl>)
#
%perl_sitearch %(eval "`%{__perl} -V:installsitearch`"; echo $installsitearch)
%perl_sitelib %(eval "`%{__perl} -V:installsitelib`"; echo $installsitelib)
%perl_vendorarch %(eval "`%{__perl} -V:installvendorarch`"; echo $installvendorarch)
%perl_vendorlib %(eval "`%{__perl} -V:installvendorlib`"; echo $installvendorlib)
%perl_archlib %(eval "`%{__perl} -V:installarchlib`"; echo $installarchlib)
%perl_privlib %(eval "`%{__perl} -V:installprivlib`"; echo $installprivlib)
# More useful perl macros (from Raul Dias <rsd@swi.com.br>)
#
%perl_version %(perl -V:version | sed "s!.*='!!;s!'.*!!")
%perl_man1ext %(perl -V:man1ext | sed "s!.*='!!;s!'.*!!")
%perl_man3ext %(perl -V:man3ext | sed "s!.*='!!;s!'.*!!")
%perl_man1dir %(perl -V:man1dir | sed "s!.*='!!;s!'.*!!")
%perl_man3dir %(perl -V:man3dir | sed "s!.*='!!;s!'.*!!")
%perl_installman1dir %(perl -V:installman1dir | sed "s!.*='!!;s!'.*!!")
%perl_installman3dir %(perl -V:installman3dir | sed "s!.*='!!;s!'.*!!")
%perl_installarchlib %(perl -V:installarchlib | sed "s!.*='!!;s!'.*!!")
%perl_prefix %{buildroot}
# Macro to encapsulate perl requires (empty for fedora)
# we keep the complicated form even here to easy sync the other macros with
# perl-macros package
#
%perl_requires() \
%if 0%{?suse_version} > 0 \
Requires: perl(:MODULE_COMPAT_%{perl_version}) \
%endif
%libperl_requires() \
%if 0%{?suse_version} > 0 \
Requires: perl = %{perl_version} \
%endif
# suse specific macros
#
%perl_make_install make DESTDIR="%{buildroot}" install_vendor
%perl_process_packlist(n:) \
if [ -n "%{buildroot}" ] && [ -d "%{buildroot}/%{perl_vendorarch}/auto" ]; then \
find "%{buildroot}/%{perl_vendorarch}/auto" -name .packlist -exec rm -Rf {} + \
if [ "%{_target_cpu}" = noarch ]; then \
find "%{buildroot}/%{perl_vendorarch}/auto" -depth -type d -exec rm -Rf {} + \
fi \
fi \
rm -f "%{buildroot}/%{perl_archlib}/perllocal.pod" \
%nil
# macro: perl_gen_filelist (from Christian <chris@computersalat.de>)
# do the rpmlint happy filelist generation
# with %dir in front of directories
#
%perl_gen_filelist(n)\
FILES=%{name}.files\
# fgen_dir func\
# IN: dir\
fgen_dir(){\
%{__cat} >> $FILES << EOF\
%dir ${1}\
EOF\
}\
# fgen_file func\
# IN: file\
fgen_file(){\
%{__cat} >> $FILES << EOF\
${1}\
EOF\
}\
# check for files in %{perl_vendorlib}\
RES=$(find "%{buildroot}/%{perl_vendorlib}" -maxdepth 1 -type f) \
if [ -n "$RES" ]; then\
for file in $RES; do\
fgen_file "%{perl_vendorlib}/${file##*/}" \
done\
fi\
\
# get all dirs into array\
base_dir="%{buildroot}/%{perl_vendorlib}/" \
all_dir="" \
for dir in $(find ${base_dir} -type d | sort); do \
if [ "$dir" = "${base_dir}" ]; then\
continue\
else\
all_dir="$all_dir ${dir#$base_dir}" \
fi\
done\
\
# build filelist\
for i in $all_dir; do \
# do not add "dir {perl_vendorlib/arch}/auto", included in perl package\
if [ "${i}" = "auto" ]; then\
continue\
fi\
if [ "%{perl_vendorlib}/${i}" = "%{perl_vendorarch}/auto" ]; then\
continue\
else\
if [ -d "${base_dir}/${i}" ]; then \
if [ "%{perl_vendorlib}/${i}" != "%{perl_vendorarch}" ]; then\
fgen_dir "%{perl_vendorlib}/${i}"\
fi\
RES=`find "${base_dir}/${i}" -maxdepth 1 -type f`\
for file in $RES; do\
fgen_file "%{perl_vendorlib}/${i}/${file##*/}" \
done\
fi\
fi\
done\
# add man pages\
if [ -d "%{buildroot}/%{_mandir}" ]; then \
for file in $(cd "%{buildroot}/%{_mandir}" && find . -type f -name "*3pm"); do \
if [ -e "%{_mandir}/$file" ]; then \
mv "%{buildroot}/%{_mandir}/$file" "%{buildroot}/%{_mandir}/${file%.3pm}.3pmc" \
fi \
done \
for file in $(cd "%{buildroot}/%{_mandir}" && find . -type f -name "*3pm.gz"); do \
if [ -e "%{_mandir}/$file" ]; then \
mv "%{buildroot}/%{_mandir}/$file" "%{buildroot}/%{_mandir}/${file%.3pm.gz}.3pmc.gz" \
fi \
done \
fgen_file "%{_mandir}/man?/*"\
fi\
\
# add packlist file\
# generated fom perllocal.pod\
if [ -f "%{buildroot}/var/adm/perl-modules/%{name}" ]; then \
fgen_file "/var/adm/perl-modules/%{name}"\
fi\
\
# check for files in %{_bindir}\
if [ -d "%{buildroot}/%{_bindir}" ]; then \
RES=$(find "%{buildroot}/%{_bindir}" -maxdepth 1 -type f) \
if [ -n "$RES" ]; then\
for file in $RES; do\
fgen_file "%{_bindir}/${file##*/}" \
done\
fi\
fi