recipes: Rename 'pkghashtag' variable to 'pkgcategory'
[dragora.git] / recipes / devel / tk / recipe
blob93773ce5f241fa640dc6c3a9721990c90b3feafc
1 # Build recipe for tk (Tcl/Tk).
3 # Copyright (c) 2018-2019 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 program=tk
18 version=8.6.9.1
19 series_version=8.6
20 release=2
22 # Define a category for the output of the package name
23 pkgcategory=devel
25 tarname=${program}${version}-src.tar.gz
27 # Remote source(s)
28 fetch=http://prdownloads.sourceforge.net/tcl/$tarname
30 homepage=http://www.tcl.tk
32 description="
33 The TCL GUI ToolKit.
35 The tk package contains the TCL GUI ToolKit.
37 For more information, visit:
38 $homepage
41 license=Custom
43 # Source documentation
44 docs="ChangeLog README changes license.terms"
45 docsdir="${docdir}/${program}-${version}"
47 # Custom source directory
48 srcdir=${program}8.6.9
50 build()
52     set -e
54     unpack "${tardir}/$tarname"
56     cd "$srcdir"
58     # Set sane permissions
59     chmod -R u+w,go-w,a+rX-s .
61     cd unix
63     # Determine whether to use 64 bit support
64     case $arch in
65     x86_64*)
66         bit_flags=--enable-64bit
67         ;;
68     esac
70     ./configure CFLAGS="$QICFLAGS" LDFLAGS="$QILDFLAGS" \
71      $configure_args \
72      --libdir=/usr/lib${libSuffix} \
73      --infodir=$infodir \
74      --mandir=$mandir \
75      --enable-shared \
76      --enable-threads \
77      --enable-man-symlinks \
78      --enable-man-suffix \
79      --without-tzdata \
80      --build="$(cc -dumpmachine)" \
81      $bit_flags
83     unset bit_flags
84     make -j${jobs} V=1 TK_LIBRARY=/usr/lib${libSuffix}/tcl${series_version}
86     # Clean up build-directory references/traces
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}@" \
91         -i tkConfig.sh
93     make -j${jobs} \
94      TK_LIBRARY=/usr/lib${libSuffix}/tcl${series_version} \
95      DESTDIR="$destdir" install
97     make -j${jobs} INSTALL_ROOT="$destdir" install-private-headers
99     # Make symlinks for compatibility
100     ln -s wish${series_version} "${destdir}/usr/bin/wish"
101     ln -s libtk${series_version}.so "${destdir}/usr/lib${libSuffix}/libtk.so"
102     ln -s libtkstub${series_version}.a "${destdir}/usr/lib${libSuffix}/libtkstub.a"
104     unset series_version
106     cd ..
108     # Compress info documents deleting index file for the package
109     if test -d "${destdir}/$infodir"
110     then
111         rm -f "${destdir}/${infodir}/dir"
112         lzip -9 "${destdir}/${infodir}"/*
113     fi
115     # Compress and link man pages (if needed)
116     if test -d "${destdir}/$mandir"
117     then
118         (
119             cd "${destdir}/$mandir"
120             find . -type f -exec lzip -9 '{}' +
121             find . -type l | while read -r file
122             do
123                 ln -sf "$(readlink -- "$file").lz" "${file}.lz"
124                 rm -- "$file"
125             done
126         )
127     fi
129     # Copy documentation
130     mkdir -p "${destdir}${docsdir}"
131     cp -p $docs "${destdir}${docsdir}"/