Bläddra i källkod

add optional Perl API

Ralf S. Engelschall 22 år sedan
förälder
incheckning
3e306ef837
1 ändrade filer med 79 tillägg och 24 borttagningar
  1. 79 24
      aspell/aspell.spec

+ 79 - 24
aspell/aspell.spec

@@ -24,9 +24,10 @@
 ##
 
 #   package version
-%define       V_aspell     0.50.3
-%define       V_aspell_en  0.51-0
-%define       V_aspell_de  0.50-2
+%define       V_aspell      0.50.3
+%define       V_aspell_en   0.51-0
+%define       V_aspell_de   0.50-2
+%define       V_aspell_perl 0.03
 
 #   package information
 Name:         aspell
@@ -38,12 +39,16 @@ Distribution: OpenPKG [BASE]
 Group:        Text
 License:      GPL
 Version:      %{V_aspell}
-Release:      20030724
+Release:      20030919
+
+#   package options
+%option       with_perl  no
 
 #   list of sources
 Source0:      ftp://ftp.gnu.org/gnu/aspell/aspell-%{V_aspell}.tar.gz
 Source1:      ftp://ftp.gnu.org/gnu/aspell/dict/en/aspell-en-%{V_aspell_en}.tar.bz2
 Source2:      ftp://ftp.gnu.org/gnu/aspell/dict/de/aspell-de-%{V_aspell_de}.tar.bz2
+Source3:      http://www.cpan.org/modules/by-module/Text/Text-Aspell-%{V_aspell_perl}.tar.gz
 Patch0:       aspell.patch
 
 #   build information
@@ -51,6 +56,10 @@ Prefix:       %{l_prefix}
 BuildRoot:    %{l_buildroot}
 BuildPreReq:  OpenPKG, openpkg >= 20030708, gcc, ncurses
 PreReq:       OpenPKG, openpkg >= 20030708, ncurses, perl
+%if "%{with_perl}" == "yes"
+BuildPreReq:  perl, perl-openpkg
+PreReq:       perl, perl-openpkg
+%endif
 AutoReq:      no
 AutoReqProv:  no
 
@@ -66,28 +75,46 @@ AutoReqProv:  no
     when more than one Aspell process is open at once.
 
 %prep
-    %setup0 -q -c
-    %setup1 -q -T -D -a 1
-    %setup2 -q -T -D -a 2
-    %patch0 -p0
+    %setup -q -c
+    %setup -q -T -D -a 1
+    %setup -q -T -D -a 2
+%if "%{with_perl}" == "yes"
+    %setup -q -T -D -a 3
+%endif
+    %patch -p0 -P 0
 
 %build
-    #   configure GNU aspell
-    cd aspell-%{V_aspell}
-    CC="%{l_cc}" \
-    CXX="%{l_cxx}" \
-    CFLAGS="%{l_cflags -O}" \
-    CXXFLAGS="%{l_cxxflags -O}" \
-    CPPFLAGS="%{l_cppflags}" \
-    ./configure \
-        --prefix=%{l_prefix} \
-        --sysconfdir=%{l_prefix}/etc/aspell \
-        --enable-curses-include=%{l_prefix}/include/ncurses \
-        --enable-curses="%{l_ldflags} -lncurses" \
-        --disable-shared
-
-    #   build GNU aspell
-    %{l_make} %{l_mflags -O}
+    ( cd aspell-%{V_aspell}
+      #   configure GNU aspell
+      CC="%{l_cc}" \
+      CXX="%{l_cxx}" \
+      CFLAGS="%{l_cflags -O}" \
+      CXXFLAGS="%{l_cxxflags -O}" \
+      CPPFLAGS="%{l_cppflags}" \
+      ./configure \
+          --prefix=%{l_prefix} \
+          --sysconfdir=%{l_prefix}/etc/aspell \
+          --enable-curses-include=%{l_prefix}/include/ncurses \
+          --enable-curses="%{l_ldflags} -lncurses" \
+          --disable-shared
+
+      #   build GNU aspell
+      %{l_make} %{l_mflags -O}
+    ) || exit $?
+
+    #   optionally build Perl API
+%if "%{with_perl}" == "yes"
+    ( cd Text-Aspell-%{V_aspell_perl}
+      %{l_prefix}/bin/perl Makefile.PL \
+          PERL="%{l_prefix}/bin/perl" \
+          FULLPERL="%{l_prefix}/bin/perl" \
+          PREFIX=$RPM_BUILD_ROOT%{l_prefix} \
+          INSTALLDIRS=site \
+          CCFLAGS="-I`pwd`/../aspell-%{V_aspell}/interfaces/cc" \
+          LIBS="-L`pwd`/../aspell-%{V_aspell}/lib/.libs -laspell"
+      %{l_make} %{l_mflags -O} pure_all
+    ) || exit $?
+%endif
 
 %install
     rm -rf $RPM_BUILD_ROOT
@@ -99,6 +126,7 @@ AutoReqProv:  no
           -e 's;/usr/bin/perl;%{l_prefix}/bin/perl;' \
           $RPM_BUILD_ROOT%{l_prefix}/bin/aspell-import
       rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/doc
+      rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/run-with-aspell
       strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
       %{l_shtool} mkdir -f -p -m 755 \
           $RPM_BUILD_ROOT%{l_prefix}/lib/aspell
@@ -127,7 +155,34 @@ AutoReqProv:  no
       %{l_make} %{l_mflags} install
     ) || exit $?
 
+    #   optionally install Perl API
+%if "%{with_perl}" == "yes"
+    ( cd Text-Aspell-%{V_aspell_perl}
+      %{l_make} %{l_mflags -O} pure_install \
+          PERL="%{l_prefix}/bin/perl" \
+          FULLPERL="%{l_prefix}/bin/perl" \
+          PREFIX=$RPM_BUILD_ROOT%{l_prefix} \
+          INSTALLDIRS=site \
+    ) || exit $?
+%endif
+
+%if "%{with_perl}" != "yes"
     %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std}
+%else
+    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"
+%endif
 
 %files -f files