Ticket #503: parrot_multidistro.patch

File parrot_multidistro.patch, 6.2 KB (added by wayland, 6 years ago)

Patch to make spec file work with multiple distributions

  • parrot.spec

     
    1 Name:           parrot 
    2 Version:        1.0.0 
    3 Release:        1%{dist} 
     1# Start out by figuring out distro 
     2%define is_fedora     %(test -e /etc/fedora-release   && echo 1 || echo 0) 
     3%define is_suse       %(test -e /etc/SuSE-release     && echo 1 || echo 0) 
     4%define is_mandriva   %(test -e /etc/mandriva-release && echo 1 || echo 0) 
     5 
     6%define name     parrot 
     7%define version  1.0.0 
     8 
     9%if %is_mandriva 
     10%define release  %mkrel 2 
     11%define group    Development/Perl 
     12%define optimiseflags 
     13%define libname  %{mklibname} %{name} 
     14%define libname_devel  %{mklibname} -d %{name} 
     15%define distro_buildreqs BuildRequires: perl-doc 
     16%else 
     17%define not_mandriva 1 
     18%define release  1%{?dist} 
     19%define group    Development/Libraries 
     20%define optimiseflags --optimize="$RPM_OPT_FLAGS -maccumulate-outgoing-args" 
     21%define libname  lib%{name} 
     22%define libname_devel  lib%{name}-devel 
     23%define distro_buildreqs 0 
     24%endif 
     25 
     26%if %is_suse 
     27%define _docdir %{_usr}/share/doc 
     28%define curseslib ncurses 
     29%else 
     30%define curseslib curses 
     31%endif 
     32 
     33%if %{is_fedora} 
     34%define distro_provides  1 
     35%define distro_provides1 Provides: perl(Parrot::Pmc2c::PCCMETHOD_BITS) 
     36%define distro_provides2 Provides: perl(Parrot::Pmc2c::MethodEmitter) 
     37%define distro_provides3 Provides: perl(Parrot::Pmc2c::PMCEmitter) 
     38%else 
     39%define distro_provides 0 
     40%endif 
     41 
     42%define parrotlib %{_libdir}/parrot/%{version}-devel/ 
     43 
     44Name:           %{name} 
     45Version:        %{version} 
     46Release:        %{release} 
    447Summary:        Parrot Virtual Machine 
    548License:        Artistic 2.0 
    6 Group:          Development/Libraries 
     49Group:          %{group} 
    750URL:            http://www.parrot.org/ 
    8 Source0:        ftp://ftp.parrot.org/pub/parrot/releases/stable/%{version}/parrot-%{version}.tar.gz 
     51Source0:        ftp://ftp.parrot.org/pub/parrot/releases/stable/%{version}/%{name}-%{version}.tar.gz 
    952BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) 
    1053BuildRequires:  readline-devel 
    1154BuildRequires:  ncurses-devel 
     
    1356BuildRequires:  gdbm-devel 
    1457BuildRequires:  libicu-devel 
    1558BuildRequires:  perl-Test-Harness 
     59Requires:       %{libname} = %{version}-%{release} 
     60%if %{distro_buildreqs} 
     61%{distro_buildreqs} 
     62%endif 
     63%if %{distro_provides} 
     64%{distro_provides1} 
     65%{distro_provides2} 
     66%endif 
    1667 
    17 %package docs 
    18 Summary:        Parrot Virtual Machine documentation 
    19 License:        Artistic 2.0 
    20 Group:          Development/Libraries 
    21 BuildRequires:  /usr/bin/perldoc 
     68%description 
     69Parrot is a virtual machine designed to efficiently compile and execute 
     70bytecode for dynamic languages. Parrot is the target for Rakudo Perl 6, 
     71as well as variety of other languages. 
    2272 
    23 %package devel 
    24 Summary:        Parrot Virtual Machine development headers and libraries 
     73#-- 
     74 
     75%package -n %{libname} 
     76Summary:        Parrot Virtual Machine run time library 
    2577License:        Artistic 2.0 
    2678Group:          Development/Libraries 
     79Group:          %{group} 
     80Provides:       lib%{name} = %{version}-%{release} 
    2781Requires:       %{name} = %{version}-%{release} 
    2882Requires:       %{_libdir}/pkgconfig 
     83%if %{distro_provides} 
     84%{distro_provides3} 
     85%endif 
    2986 
    30 %description 
    31 Parrot is a virtual machine designed to efficiently compile and execute 
    32 bytecode for dynamic languages. Parrot is the target for Rakudo Perl 6, 
    33 as well as variety of other languages. 
     87%description -n %{libname} 
     88Run time library for the Parrot Virtual Machine. 
    3489 
    35 %description docs 
     90%post -n %{libname} -p /sbin/ldconfig 
     91  
     92%postun -n %{libname} -p /sbin/ldconfig 
     93 
     94#-- 
     95 
     96%if %{is_mandriva} 
     97%define docsname doc 
     98%else 
     99%define docsname docs 
     100%endif 
     101 
     102%package %{docsname} 
     103Summary:        Parrot Virtual Machine documentation 
     104License:        Artistic 2.0 
     105Group:          %{group} 
     106%if %{not_mandriva} 
     107BuildRequires:  /usr/bin/perldoc 
     108%endif 
     109 
     110%description %{docsname} 
    36111Documentation in text-, POD- and HTML-format (docs/html-subdirectory) and also 
    37112examples about the Parrot Virtual Machine 
    38113 
    39 %description devel 
     114#-- 
     115 
     116%if %is_mandriva 
     117%define develname -n %{name}_devel 
     118%else 
     119%define develname devel 
     120%endif 
     121 
     122%package %{develname} 
     123Summary:        Parrot Virtual Machine development headers and libraries 
     124License:        Artistic 2.0 
     125Group:          %{group} 
     126Requires:       %{libname} = %{version} 
     127Requires:       %{_libdir}/pkgconfig 
     128 
     129%if is_mandriva 
     130Provides:       %{name}-devel = %version-%release 
     131%else 
     132%endif 
     133 
     134%description %{develname} 
    40135Parrot Virtual Machine development headers and libraries. 
    41136 
    42137%prep 
     
    48143    tools/dev/install_files.pl 
    49144 
    50145%build 
    51 if test "%{_vendor}" = "suse" 
    52 then 
    53     LIBS='-lncurses -lm' 
    54 else 
    55     LIBS='-lcurses -lm' 
    56 fi 
     146%ifarch x86_64 
     147       RPM_OPT_FLAGS=`echo "$RPM_OPT_FLAGS" | %{__perl} -pi -e 's/-O2//'` 
     148%endif 
    57149 
    58150%ifarch i386 x86_64 
    59151%{__perl} Configure.pl \ 
     
    64156    --mandir=%{_mandir} \ 
    65157    --cc="%{__cc}" \ 
    66158    --cxx=%{__cxx} \ 
    67     --optimize="$RPM_OPT_FLAGS -maccumulate-outgoing-args" \ 
    68159    --parrot_is_shared \ 
    69160    --lex=/usr/bin/flex \ 
    70161    --yacc=/usr/bin/yacc \ 
    71     --libs="$LIBS" 
     162    --libs="-l%{curseslib} -lm" %{optimiseflags} 
    72163%else 
    73164# PowerPC 
    74165%{__perl} Configure.pl \ 
     
    116207%clean 
    117208rm -rf $RPM_BUILD_ROOT 
    118209 
    119 %post -p /sbin/ldconfig 
    120  
    121 %postun -p /sbin/ldconfig 
    122  
    123210%files 
    124211%defattr(-,root,root,-) 
    125212%exclude %{_bindir}/parrot_config 
    126213%exclude %{_bindir}/parrot_debugger 
    127214%exclude %{_bindir}/pbc_* 
    128215%{_bindir}/* 
     216 
     217%files -n %{libname} 
     218%defattr(-,root,root,-) 
     219%exclude %{parrotlib}/languages 
    129220%{_libdir}/parrot 
    130 %{_libdir}/libparrot.so.* 
     221%{_libdir}/*.so.* 
    131222 
    132 %files docs 
     223%files %{docsname} 
    133224%defattr(-,root,root,-) 
    134225%doc ChangeLog CREDITS NEWS PBC_COMPAT PLATFORMS README 
    135226%doc RESPONSIBLE_PARTIES TODO 
    136227%doc docs examples 
    137228 
    138 %files devel 
     229%files %{develname} 
    139230%defattr(-,root,root,-) 
    140231%{_bindir}/parrot_config 
    141232%{_bindir}/parrot_debugger 
     
    150241%{_libdir}/pkgconfig/* 
    151242 
    152243%changelog 
     244* Thu Mar 26 2009 Tim Nelson <wayland@wayland.id.au> 1.0.0 
     245- Modified to support multiple distributions better.  Mandriva changes drawn from a .spec  
     246  file supplied by Jerome Quelin 
     247 
    153248* Tue Mar 17 2009 Allison Randal <allison@parrot.org> 1.0.0 
    154249- updated to 1.0.0 
    155250