Explorar el Código

fix Tcl packaging; add Tk (optional)

Ralf S. Engelschall hace 24 años
padre
commit
05eef4e8fd
Se han modificado 1 ficheros con 87 adiciones y 17 borrados
  1. 87 17
      tcl/tcl.spec

+ 87 - 17
tcl/tcl.spec

@@ -23,6 +23,16 @@
 ##  SUCH DAMAGE.
 ##
 
+#   package version
+%define       V_major  8
+%define       V_minor  3
+%define       V_level  4
+
+#   package options
+%ifndef       with_x11
+%define       with_x11 no
+%endif
+
 #   package information
 Name:         tcl
 Summary:      Tool Command Language (TCL)
@@ -32,46 +42,75 @@ Packager:     The OpenPKG Project
 Distribution: OpenPKG [REL]
 Group:        Language
 License:      GPL
-Version:      8.3.4
+Version:      %{V_major}.%{V_minor}.%{V_level}
 Release:      20020610
 
 #   list of sources
-Source0:      ftp://ftp.scriptics.com/pub/tcl/tcl8_3/tcl%{version}.tar.gz
+Source0:      ftp://ftp.scriptics.com/pub/tcl/tcl%{V_major}_%{V_minor}/tcl%{V_major}.%{V_minor}.%{V_level}.tar.gz
+Source1:      ftp://ftp.scriptics.com/pub/tcl/tcl%{V_major}_%{V_minor}/tk%{V_major}.%{V_minor}.%{V_level}.tar.gz
 
 #   build information
 Prefix:       %{l_prefix}
 BuildRoot:    %{l_buildroot}
 BuildPreReq:  OpenPKG, openpkg >= 20020206
 PreReq:       OpenPKG, openpkg >= 20020206
+%if "%{with_x11}" == "yes"
+BuildPreReq:  X11
+PreReq:       X11
+%endif
 AutoReq:      no
 AutoReqProv:  no
 
 %description
-    The Tool Command Language (TCL).
+    The Tool Command Language (TCL), optionally including the 
+    popular TCL Widget Toolkit (Tk).
+
+    Options: with_x11=%{with_x11}
 
 %prep
-    %setup -q -n tcl%{version}
+    %setup0 -q -c -n tcl-%{V_major}.%{V_minor}.%{V_level}
+    %setup1 -q -T -D -a 1
 
 %build
-    cd unix
-    CC="%{l_cc}" \
-    CFLAGS="%{l_cflags -O}" \
-    ./configure \
-        --prefix=%{l_prefix} \
-        --includedir=%{l_prefix}/include/tcl \
-        --disable-shared
-    %{l_make} %{l_mflags -O}
+    #   build Tcl
+    ( cd tcl%{V_major}.%{V_minor}.%{V_level}/unix
+      CC="%{l_cc}" \
+      CFLAGS="%{l_cflags -O}" \
+      ./configure \
+          --prefix=%{l_prefix} \
+          --includedir=%{l_prefix}/include/tcl \
+          --disable-shared
+      %{l_make} %{l_mflags -O}
+    )
+
+    #   build Tk (optional)
+%if "%{with_x11}" == "yes"
+    ( cd tk%{V_major}.%{V_minor}.%{V_level}/unix
+      CC="%{l_cc}" \
+      CFLAGS="%{l_cflags -O}" \
+      ./configure \
+          --prefix=%{l_prefix} \
+          --includedir=%{l_prefix}/include/tcl \
+          --disable-shared \
+          --with-tcl=../../tcl%{V_major}.%{V_minor}.%{V_level}/unix
+          --with-x \
+          --x-includes=`%{l_prefix}/etc/rc --query x11_incdir` \
+          --x-libraries=`%{l_prefix}/etc/rc --query x11_libdir`
+      %{l_make} %{l_mflags -O}
+    )
+%endif
 
 %install
     rm -rf $RPM_BUILD_ROOT
-    ( cd unix
+
+    #   install Tcl
+    ( cd tcl%{V_major}.%{V_minor}.%{V_level}/unix
       %{l_make} %{l_mflags} install INSTALL_ROOT=$RPM_BUILD_ROOT
     )
-    strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
     ( cd $RPM_BUILD_ROOT%{l_prefix}
-      mv bin/tclsh8.3 bin/tclsh
-      ln lib/libtcl83.a lib/libtcl.a
-      ln lib/libtclstub83.a lib/libtclstub.a
+      mv bin/tclsh%{V_major}.%{V_minor} bin/tclsh
+      ln lib/libtcl%{V_major}%{V_minor}.a lib/libtcl.a
+      ln lib/libtclstub%{V_major}%{V_minor}.a lib/libtclstub.a
       cd man/mann
       for mo in *.n; do
           mn=`echo $mo | sed -e 's;\.n$;.3;'`
@@ -85,6 +124,37 @@ AutoReqProv:  no
           fi
       done
     )
+    %{l_shtool} subst \
+        -e "s;-L$RPM_BUILD_DIR[^ ]*;-L%{l_prefix}/lib;" \
+        $RPM_BUILD_ROOT%{l_prefix}/lib/tclConfig.sh
+
+    #   install Tk (optional)
+%if "%{with_x11}" == "yes"
+    ( cd tk%{V_major}.%{V_minor}.%{V_level}/unix
+      %{l_make} %{l_mflags} install INSTALL_ROOT=$RPM_BUILD_ROOT
+    )
+    ( cd $RPM_BUILD_ROOT%{l_prefix}
+      mv bin/wish%{V_major}.%{V_minor} bin/wish
+      ln lib/libtk%{V_major}%{V_minor}.a lib/libtk.a
+      ln lib/libtkstub%{V_major}%{V_minor}.a lib/libtkstub.a
+      cd man/mann
+      for mo in *.n; do
+          mn=`echo $mo | sed -e 's;\.n$;.3;'`
+          mv $mo ../man3/$mn
+      done
+      cd ../man3
+      chmod u+w *
+      for mp in *.3; do
+          if [ ".`echo $mp | grep '^Tcl_'`" = . ] && \
+             [ ".`echo $mp | grep '^Tk_'`"  = . ]; then
+              mv $mp Tk_$mp
+          fi
+      done
+    )
+%endif
+
+    #   post-process installation
+    strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
     %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std}
 
 %files -f files