1 # Build recipe for tk (Tcl/Tk).
3 # Copyright (c) 2018-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
25 # Define a category for the output of the package name
28 tarname=${program}${version}-src.tar.gz
31 fetch=https://prdownloads.sourceforge.net/tcl/$tarname
33 homepage=https://www.tcl.tk
38 The tk package contains the TCL GUI ToolKit.
40 For more information, visit:
46 # Source documentation
47 docs="ChangeLog README.md changes license.terms"
48 docsdir="${docdir}/${program}-${version}"
50 # Custom source directory
51 #srcdir="${program}${version%.*}"
52 srcdir="${program}${version}"
56 unpack "${tardir}/$tarname"
60 # Set sane permissions
61 chmod -R u+w,go-w,a+rX-s .
63 # Determine whether to use 64 bit support
66 bit_flags=--enable-64bit
72 ./configure CPPFLAGS="$QICPPFLAGS" CFLAGS="$QICFLAGS" \
73 LDFLAGS="$QILDFLAGS" \
75 --libdir=/usr/lib${libSuffix} \
80 --enable-man-symlinks \
82 --build="$(gcc -dumpmachine)" \
88 # Thanks to "Beyond of Linux From Scratch"
89 sed -e "s@^\(TK_SRC_DIR='\).*@\1/usr/include'@" \
90 -e "/TK_B/s@='\(-L\)\?.*unix@='\1/usr/lib${libSuffix}@" \
93 make -j${jobs} DESTDIR="$destdir" install
94 make -j${jobs} INSTALL_ROOT="$destdir" install-private-headers
96 # Make symlink(s) for compatibility
97 ln -s wish${series_version} "${destdir}/usr/bin/wish"
98 ln -s libtk${series_version}.so "${destdir}/usr/lib${libSuffix}/libtk.so"
99 ln -s libtkstub${series_version}.a "${destdir}/usr/lib${libSuffix}/libtkstub.a"
101 unset -v series_version
105 # Compress info documents deleting index file for the package
106 if test -d "${destdir}/$infodir"
108 rm -f "${destdir}/${infodir}/dir"
109 lzip -9 "${destdir}/${infodir}"/*
112 # Compress and link man pages (if needed)
113 if test -d "${destdir}/$mandir"
116 cd "${destdir}/$mandir"
117 find . -type f -exec lzip -9 {} +
118 find . -type l | while read -r file
120 ln -sf "$(readlink -- "$file").lz" "${file}.lz"
127 mkdir -p "${destdir}/$docsdir"
128 cp -p $docs "${destdir}/$docsdir"