| 1 |
%_perl_req_method normal |
| 2 |
%set_perl_req_method() %global _perl_req_method %* |
| 3 |
|
| 4 |
#_perl_lib_path %nil |
| 5 |
%add_perl_lib_path() %global _perl_lib_path %{?_perl_lib_path} %* |
| 6 |
|
| 7 |
# perl library paths |
| 8 |
%perl_vendor_privlib %(eval "`%__perl -V:installvendorlib`"; echo "$installvendorlib") |
| 9 |
%perl_vendor_archlib %(eval "`%__perl -V:installvendorarch`"; echo "$installvendorarch") |
| 10 |
%perl_vendor_autolib %perl_vendor_archlib/auto |
| 11 |
|
| 12 |
# MDK compatibility |
| 13 |
%perl_vendorlib %perl_vendor_privlib |
| 14 |
%perl_vendorarch %perl_vendor_archlib |
| 15 |
%makeinstall_std %make_install install DESTDIR=%buildroot |
| 16 |
|
| 17 |
# build with the same optimization as perl |
| 18 |
%perl_vendor_optflags %(eval "`%__perl -V:optimize`"; echo "$optimize") |
| 19 |
|
| 20 |
# automate various rpmbuild stages |
| 21 |
# MM stands for ExtUtils::MakeMaker |
| 22 |
# MB stands for Module::Build |
| 23 |
|
| 24 |
# %%build helpers |
| 25 |
%perl_vendor_build \ |
| 26 |
_perl_vendor_MB_build() { \ |
| 27 |
: writing Build script \ |
| 28 |
%__perl Build.PL installdirs=vendor "$@" </dev/null \ |
| 29 |
%__perl -e '$req=require"./_build/prereqs";' \\\ |
| 30 |
-e 'while (my ($k, $v) = each %%{$$req{requires}}) { print "perl($k)>=$v\\n" }' \\\ |
| 31 |
-e 'while (my ($k, $v) = each %%{$$req{recommends}}) { print "perl($k)>=$v\\n" }' | tee .perl.req \ |
| 32 |
: running Build script \ |
| 33 |
%__perl Build \ |
| 34 |
%{?!_without_test:%{?!_disable_test:: running tests; LD_BIND_NOW=1 PERL_DL_NONLAZY=1 %__perl Build test %{?_enable_debug:test_verbose=1}}} \ |
| 35 |
} \ |
| 36 |
_perl_vendor_MM_build() { \ |
| 37 |
%{?_without_smp:NPROCS=1; : NOTE: SMP-incompatible} \ |
| 38 |
%{?_disable_smp:NPROCS=1; : NOTE: SMP-incompatible} \ |
| 39 |
: looking for PREREQ dependencies \ |
| 40 |
%__perl Makefile.PL PRINT_PREREQ=1 "$@" </dev/null | tee .perl.req \ |
| 41 |
: writing Makefile \ |
| 42 |
%__perl Makefile.PL PREFIX=%_prefix INSTALLDIRS=vendor "$@" </dev/null \ |
| 43 |
: running make \ |
| 44 |
%make_build OPTIMIZE="%{!?_enable_debug:%perl_vendor_optflags}%{?_enable_debug:%optflags}%{?_enable_Werror: -Werror}" CP="%__cp -p" \ |
| 45 |
%{?!_without_test:%{?!_disable_test:: running tests; LD_BIND_NOW=1 PERL_DL_NONLAZY=1 %__make test CP="%__cp -p" %{?_enable_debug:TEST_VERBOSE=1} </dev/null}} \ |
| 46 |
} \ |
| 47 |
_perl_vendor_fixin() { \ |
| 48 |
find . -type f -print0 | xargs -r0 %__subst -p \\\ |
| 49 |
'1s,^#![[:space:]]*\\([^[:space:]]*/\\)\\?perl\\([^/[:alpha:][:space:]][^/[:space:]]*\\)\\?\\([[:space:]]\\|$\\),#!%__perl\\3,' \ |
| 50 |
} \ |
| 51 |
_perl_vendor_check_dso() { \ |
| 52 |
: checking for undefined symbols \ |
| 53 |
BLIBS="$BLIBS${BLIBS:+ }$(find $PWD/blib -type f -name '*.so' ||:)" \ |
| 54 |
[ -n "$BLIBS" ] || return 0 \ |
| 55 |
echo 'int main(){return 0;}' >ldtest.c \ |
| 56 |
gcc -Wl,--no-as-needed ldtest.c ${LD_LIBRARY_PATH:+-L$LD_LIBRARY_PATH} -lperl $BLIBS $EXTRA_BLIBS \ |
| 57 |
LD_BIND_NOW=1 ./a.out \ |
| 58 |
rm -f ldtest.c ./a.out \ |
| 59 |
} \ |
| 60 |
perl_vendor_build() { \ |
| 61 |
export PERL_EXTUTILS_AUTOINSTALL="${PERL_EXTUTILS_AUTOINSTALL:---skip}" \ |
| 62 |
export XSUBPP_STATIC_XS=${XSUBPP_STATIC_XS:-1} \ |
| 63 |
_perl_vendor_fixin \ |
| 64 |
if %__grep -qs -Ew '(dist|module)_name' Build.PL; then \ |
| 65 |
_perl_vendor_MB_build "$@" \ |
| 66 |
else \ |
| 67 |
_perl_vendor_MM_build "$@" \ |
| 68 |
fi \ |
| 69 |
#_perl_vendor_check_dso \ |
| 70 |
} \ |
| 71 |
perl_vendor_build |
| 72 |
|
| 73 |
# %%install helpers |
| 74 |
%perl_vendor_install \ |
| 75 |
_perl_vendor_MB_install() { \ |
| 76 |
: installing \ |
| 77 |
%__perl Build install destdir=%buildroot installdirs=vendor "$@" </dev/null \ |
| 78 |
} \ |
| 79 |
_perl_vendor_MM_install() { \ |
| 80 |
: installing \ |
| 81 |
%make_install CP="%__cp -p" \\\ |
| 82 |
DESTDIR=%buildroot PREFIX=%_prefix INSTALLDIRS=vendor \\\ |
| 83 |
pure_install "$@" </dev/null \ |
| 84 |
} \ |
| 85 |
_perl_vendor_check_buildroot() { \ |
| 86 |
: prompting for files that contain /usr/local \ |
| 87 |
find %buildroot -type f -exec %__grep -FH /usr/local {} ';' \ |
| 88 |
: prompting for files that contain /tmp \ |
| 89 |
find %buildroot -type f -not -name .packlist -exec %__grep -FH /tmp '{}' ';' \ |
| 90 |
} \ |
| 91 |
_perl_vendor_save_prereq() { \ |
| 92 |
if %__grep -F 'perl(' .perl.req >&2; then \ |
| 93 |
%__grep -F 'perl(' .perl.req >>%buildroot/.perl.req; fi \ |
| 94 |
} \ |
| 95 |
perl_vendor_install() { \ |
| 96 |
if %__grep -qs -Ew '(dist|module)_name' Build.PL; then \ |
| 97 |
_perl_vendor_MB_install "$@" \ |
| 98 |
else \ |
| 99 |
_perl_vendor_MM_install "$@" \ |
| 100 |
fi \ |
| 101 |
_perl_vendor_check_buildroot \ |
| 102 |
_perl_vendor_save_prereq \ |
| 103 |
} \ |
| 104 |
perl_vendor_install |
| 105 |
|
| 106 |
# sugar |
| 107 |
%perl_fix_local %__subst -p 's,/usr/local\\>,/usr,g' |
| 108 |
%CPAN() http://search.cpan.org/dist/%1/%nil |