recipes: Adjust 'docsdir' variable to be consistent with the current recipe format
[dragora.git] / recipes / devel / tk / recipe
blobf99a0093d97c78d7b02378ae6a3411700de98bfa
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
18 set -e
20 program=tk
21 version=8.6.12
22 series_version=8.6
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 The TCL GUI ToolKit.
38 The tk package contains the TCL GUI ToolKit.
40 For more information, visit:
41 $homepage
44 license=Custom
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}"
54 build()
56     unpack "${tardir}/$tarname"
58     cd "$srcdir"
60     # Set sane permissions
61     chmod -R u+w,go-w,a+rX-s .
63     # Determine whether to use 64 bit support
64     case $arch in
65     amd64 | x32 )
66         bit_flags=--enable-64bit
67         ;;
68     esac
70     cd unix
72     ./configure CPPFLAGS="$QICPPFLAGS" CFLAGS="$QICFLAGS" \
73     LDFLAGS="$QILDFLAGS" \
74      $configure_args \
75      --libdir=/usr/lib${libSuffix} \
76      --infodir=$infodir \
77      --mandir=$mandir \
78      --enable-shared \
79      --enable-threads \
80      --enable-man-symlinks \
81      --without-tzdata \
82      --build="$(gcc -dumpmachine)" \
83      $bit_flags
85     unset -v bit_flags
86     make -j${jobs} V=1
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} 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
103     cd ..
105     # Compress info documents deleting index file for the package
106     if test -d "${destdir}/$infodir"
107     then
108         rm -f "${destdir}/${infodir}/dir"
109         lzip -9 "${destdir}/${infodir}"/*
110     fi
112     # Compress and link man pages (if needed)
113     if test -d "${destdir}/$mandir"
114     then
115         (
116             cd "${destdir}/$mandir"
117             find . -type f -exec lzip -9 {} +
118             find . -type l | while read -r file
119             do
120                 ln -sf "$(readlink -- "$file").lz" "${file}.lz"
121                 rm -- "$file"
122             done
123         )
124     fi
126     # Copy documentation
127     mkdir -p "${destdir}/$docsdir"
128     cp -p $docs "${destdir}/$docsdir"