Start mass upgrade
[dragora.git] / recipes / devel / tcl / recipe
blob8d259eeac93b343301e1d83b887d6c6096cf3b83
1 # Build recipe for tcl.
3 # Copyright (c) 2018, 2020-2022 Matias Fonzo, <selk@dragora.org>.
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 #    http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
17 # Exit immediately on any error
18 set -e
20 program=tcl
21 version=8.6.12
22 series_version="${version%.*}"
23 release=1
25 # Define a category for the output of the package name
26 pkgcategory=devel
28 tarname=${program}${version}-src.tar.gz
30 # Remote source(s)
31 fetch=https://prdownloads.sourceforge.net/tcl/$tarname
33 homepage=https://www.tcl.tk
35 description="
36 Tool command language.
38 Tcl (Tool Command Language) is a very powerful but easy to learn
39 dynamic programming language, suitable for a very wide range of uses,
40 including web and desktop applications, networking, administration,
41 testing and many more.  Open source and business-friendly, Tcl is a
42 mature yet evolving language that is truly cross platform, easily
43 deployed and highly extensible.
45 For more information, visit:
46 $homepage
49 license=Custom
51 # Source documentation
52 docs="ChangeLog README.md changes license.terms"
53 docsdir="${docdir}/${program}-${version}"
55 # Custom source directory
56 srcdir=${program}${version}
58 build()
60     unpack "${tardir}/$tarname"
62     cd "$srcdir"
64     # Set sane permissions
65     chmod -R u+w,go-w,a+rX-s .
67     WD="$(pwd)"
69     # Determine whether to use 64 bit support
70     case $arch in
71     amd64 | x32 )
72         bit_flags=--enable-64bit
73         ;;
74     esac
76     cd unix
78     ./configure CPPFLAGS="$QICPPFLAGS" CFLAGS="$QICFLAGS" \
79     LDFLAGS="$QILDFLAGS" \
80      $configure_args \
81      --libdir=/usr/lib${libSuffix} \
82      --infodir=$infodir \
83      --mandir=$mandir \
84      --enable-shared \
85      --enable-threads \
86      --enable-man-symlinks \
87      --without-tzdata \
88      --build="$(gcc -dumpmachine)" \
89      $bit_flags
91     unset -v bit_flags
92     make -j${jobs} V=1
94     # Current versions provided on this release
95     itcl_version=4.2.2
96     tdbc_version=1.1.3
98     # Fix header and library paths
99     sed -e "s@^\(TCL_SRC_DIR='\).*@\1/usr/include'@" \
100         -e "/TCL_B/s@='\(-L\)\?.*unix@='\1/usr/lib${libSuffix}@" \
101         -i tclConfig.sh
103     sed -e "s#${WD}/unix/pkgs/itcl${itcl_version}#/usr/lib${libSuffix}/itcl${itcl_version}#"      \
104         -e "s#${WD}/pkgs/itcl${itcl_version}/generic#/usr/include#"                               \
105         -e "s#${WD}/pkgs/itcl${itcl_version}#/usr/include#"                                       \
106         -i pkgs/itcl${itcl_version}/itclConfig.sh
108     sed -e "s#${WD}/unix/pkgs/tdbc${tdbc_version}#/usr/lib${libSuffix}/tdbc${tdbc_version}#"      \
109         -e "s#${WD}/pkgs/tdbc${tdbc_version}/generic#/usr/include#"                               \
110         -e "s#${WD}/pkgs/tdbc${tdbc_version}/library#/usr/lib${libSuffix}/tcl${series_version}#"  \
111         -e "s#${WD}/pkgs/tdbc${tdbc_version}#/usr/include#"                                       \
112         -i pkgs/tdbc${tdbc_version}/tdbcConfig.sh
114     unset -v WD tdbc_version itcl_version
116     make -j${jobs} DESTDIR="$destdir" install
117     make -j${jobs} INSTALL_ROOT="$destdir" install-private-headers
119     # Make symlink(s) for compatibility
120     ln -s tclsh${series_version} "${destdir}/usr/bin/tclsh"
121     ln -s libtcl${series_version}.so "${destdir}/usr/lib${libSuffix}/libtcl.so"
122     ln -s libtclstub${series_version}.a "${destdir}/usr/lib${libSuffix}/libtclstub.a"
124     unset -v series_version
126     cd ..
128     # Compress info documents deleting index file for the package
129     if test -d "${destdir}/$infodir"
130     then
131         rm -f "${destdir}/${infodir}/dir"
132         lzip -9 "${destdir}/${infodir}"/*
133     fi
135     # Compress and link man pages (if needed)
136     if test -d "${destdir}/$mandir"
137     then
138         (
139             cd "${destdir}/$mandir"
140             find . -type f -exec lzip -9 {} +
141             find . -type l | while read -r file
142             do
143                 ln -sf "$(readlink -- "$file").lz" "${file}.lz"
144                 rm -- "$file"
145             done
146         )
147     fi
149     # Copy documentation
150     mkdir -p "${destdir}${docsdir}"
151     cp -p $docs "${destdir}${docsdir}"