Ralf S. Engelschall пре 22 година
родитељ
комит
0f727c7f2b
1 измењених фајлова са 54 додато и 4 уклоњено
  1. 54 4
      geoip/geoip.spec

+ 54 - 4
geoip/geoip.spec

@@ -23,6 +23,10 @@
 ##  SUCH DAMAGE.
 ##
 
+#   package version
+%define       V_api_c   1.2.2
+%define       V_api_pl  1.21
+
 #   package information
 Name:         geoip
 Summary:      Geographic IP Resolution
@@ -32,11 +36,15 @@ Packager:     The OpenPKG Project
 Distribution: OpenPKG [EVAL]
 Group:        Network
 License:      GPL
-Version:      1.2.2
-Release:      20030811
+Version:      %{V_api_c}
+Release:      20030912
+
+#   package options
+%option       with_perl   no
 
 #   list of sources
-Source0:      http://www.maxmind.com/download/geoip/api/c/GeoIP-%{version}.tar.gz
+Source0:      http://www.maxmind.com/download/geoip/api/c/GeoIP-%{V_api_c}.tar.gz
+Source1:      http://www.cpan.org/modules/by-module/Geo/Geo-IP-%{V_api_pl}.tar.gz
 
 #   build information
 Prefix:       %{l_prefix}
@@ -55,7 +63,10 @@ AutoReqProv:  no
     public IP address.
 
 %prep
-    %setup -q -n GeoIP-%{version}
+    %setup -q -n GeoIP-%{V_api_c}
+%if "%{with_perl}" == "yes"
+    %setup -q -D -T -a 1 -n GeoIP-%{V_api_c}
+%endif
     %{l_shtool} subst \
         -e 's;-Wall;;g' \
         -e 's;-ansi;;g' \
@@ -73,6 +84,17 @@ AutoReqProv:  no
         --mandir=$RPM_BUILD_ROOT%{l_prefix}/man \
         --disable-shared
     %{l_make} %{l_mflags}
+%if "%{with_perl}" == "yes"
+    ( cd Geo-IP-%{V_api_pl}
+      %{l_prefix}/bin/perl Makefile.PL \
+          PREFIX=$RPM_BUILD_ROOT%{l_prefix} \
+          PERL=%{l_prefix}/bin/perl \
+          FULLPERL=%{l_prefix}/bin/perl \
+          LIBS="-L../libGeoIP/.libs" \
+          INC="-I../libGeoIP"
+      %{l_make} %{l_mflags}
+    ) || exit $?
+%endif
 
 %install
     rm -rf $RPM_BUILD_ROOT
@@ -80,9 +102,37 @@ AutoReqProv:  no
         $RPM_BUILD_ROOT%{l_prefix}/man \
         $RPM_BUILD_ROOT%{l_prefix}/man/man1
     %{l_make} %{l_mflags} install AM_MAKEFLAGS="DESTDIR=$RPM_BUILD_ROOT"
+%if "%{with_perl}" == "yes"
+    ( cd Geo-IP-%{V_api_pl}
+      %{l_make} %{l_mflags} install
+    ) || exit $?
+%endif
     strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
     rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/geoip/GeoIP.conf.default
+%if "%{with_perl}" != "yes"
     %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std}
+%else
+    find ${RPM_BUILD_ROOT}${l_prefix} \
+        -name perllocal.pod -print | xargs rm -f
+    find ${RPM_BUILD_ROOT}${l_prefix} \
+        -name .packlist -print | xargs rm -f
+    find ${RPM_BUILD_ROOT}${l_prefix} \
+        -type d -depth -print | (xargs rmdir >/dev/null 2>&1 || true) || true
+    eval `%{l_prefix}/bin/perl -V:installarchlib -V:installprivlib -V:installsitearch -V:installsitelib`
+    %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
+        %{l_files_std} \
+        '%not %dir %{l_prefix}/lib/perl' \
+        '%not %dir %{l_prefix}/lib/perl/*' \
+        "%not %dir $installarchlib" \
+        "%not %dir $installprivlib" \
+        "%not %dir $installsitearch" \
+        "%not %dir $installsitelib" \
+        "%not %dir $installarchlib/auto" \
+        "%not %dir $installprivlib/auto" \
+        "%not %dir $installsitearch/auto" \
+        "%not %dir $installsitelib/auto" \
+        "%not %dir %{l_prefix}/lib/pkgconfig"
+%endif
 
 %files -f files