Hi,

I'm working on a spec file for AOLserver, which requires a threaded
version of TCL. The attached specfile for TCL has a new option
with_threads, that builds a threaded TCL interpreter. Could this be
added to the -current OpenPKG distribution (after testing on more
platforms, I've only tested this on Solaris) or should the AOLserver
spec file build a custom TCL version just for itself?

-- Olaf
##
##  tcl.spec -- OpenPKG RPM Specification
##  Copyright (c) 2000-2005 The OpenPKG Project <http://www.openpkg.org/>
##  Copyright (c) 2000-2005 Ralf S. Engelschall <[EMAIL PROTECTED]>
##  Copyright (c) 2000-2005 Cable & Wireless <http://www.cw.com/>
##
##  Permission to use, copy, modify, and distribute this software for
##  any purpose with or without fee is hereby granted, provided that
##  the above copyright notice and this permission notice appear in all
##  copies.
##
##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
##  SUCH DAMAGE.
##

#   package version
%define       V_major  8
%define       V_minor  4
%define       V_level  9

#   package information
Name:         tcl
Summary:      Tool Command Language (TCL)
URL:          http://tcl.activestate.com/
Vendor:       John Ousterhout
Packager:     The OpenPKG Project
Distribution: OpenPKG
Class:        BASE
Group:        Language
License:      GPL
Version:      %{V_major}.%{V_minor}.%{V_level}
Release:      20050421

#   package options
%option       with_x11     no
%option       with_threads no

#   list of sources
Source0:      
ftp://ftp.scriptics.com/pub/tcl/tcl%{V_major}_%{V_minor}/tcl%{V_major}.%{V_minor}.%{V_level}-src.tar.gz
Source1:      
ftp://ftp.scriptics.com/pub/tcl/tcl%{V_major}_%{V_minor}/tk%{V_major}.%{V_minor}.%{V_level}-src.tar.gz

#   build information
Prefix:       %{l_prefix}
BuildRoot:    %{l_buildroot}
BuildPreReq:  OpenPKG, openpkg >= 20040130
PreReq:       OpenPKG, openpkg >= 20040130
%if "%{with_x11}" == "yes"
BuildPreReq:  X11
PreReq:       X11
%endif
AutoReq:      no
AutoReqProv:  no

%description
    The Tool Command Language (TCL), optionally including the
    popular TCL Widget Toolkit (Tk).

%track
    prog tcl:tcl = {
        version   = %{version}
        url       = ftp://ftp.scriptics.com/pub/tcl/tcl8_4/
        regex     = tcl(__VER__)-src\.tar.gz
    }
    prog tcl:tk = {
        version   = %{version}
        url       = ftp://ftp.scriptics.com/pub/tcl/tcl8_4/
        regex     = tk(__VER__)-src\.tar.gz
    }

%prep
    %setup -q -c -n tcl-%{V_major}.%{V_minor}.%{V_level}
    %setup -q -T -D -a 1

%build
    #   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 \
%if "%{with_threads}" == "yes"
          --enable-threads \
%endif
          --disable-shared
      %{l_make} %{l_mflags -O}
    ) || exit $?

    #   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_rc} --query x11_incdir` \
          --x-libraries=`%{l_rc} --query x11_libdir`
      %{l_make} %{l_mflags -O}
    ) || exit $?
%endif

%install
    rm -rf $RPM_BUILD_ROOT

    #   install Tcl
    ( cd tcl%{V_major}.%{V_minor}.%{V_level}/unix
      %{l_shtool} subst \
          -e 's;-L[^ ]*;%{l_ldflags};g' \
          -e 
"s;\\(TCL_BUILD_STUB_LIB_PATH=\\).*;\\1'%{l_prefix}/lib/libtclstub%{V_major}.%{V_minor}\${TCL_DBGX}.a';"
 \
          tclConfig.sh
      %{l_make} %{l_mflags} install INSTALL_ROOT=$RPM_BUILD_ROOT
    ) || exit $?
    ( cd $RPM_BUILD_ROOT%{l_prefix}
      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;'`
          mv $mo ../man3/$mn
      done
      cd ../man3
      chmod u+w *
      for mp in *.3; do
          if [ ".`echo $mp | grep '^Tcl_'`" = . ]; then
              mv $mp Tcl_$mp
          fi
      done
    ) || exit $?

    #   install Tk (optional)
%if "%{with_x11}" == "yes"
    ( cd tk%{V_major}.%{V_minor}.%{V_level}/unix
      %{l_shtool} subst \
          -e 's;-L[^ ]*;%{l_ldflags};g' \
          -e 
"s;\\(TK_BUILD_STUB_LIB_PATH=\\).*;\\1'%{l_prefix}/lib/libtkstub%{V_major}.%{V_minor}.a';"
 \
          tkConfig.sh
      %{l_make} %{l_mflags} install INSTALL_ROOT=$RPM_BUILD_ROOT
    ) || exit $?
    ( 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
    ) || exit $?
%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

%clean
    rm -rf $RPM_BUILD_ROOT

Reply via email to