Files
haikuports/dev-lang/tk/tk-8.6.10.recipe
2023-05-12 20:21:29 +02:00

138 lines
3.8 KiB
Bash

SUMMARY="A windowing toolkit for use with Tcl"
DESCRIPTION="Tk is a graphical user interface toolkit that takes developing desktop \
applications to a higher level than conventional approaches. Tk is the \
standard GUI not only for Tcl, but for many other dynamic languages, and \
can produce rich, native applications that run unchanged across Windows, \
Mac OS X, Linux and more.
This package is based on UndroidWish, a SDL2-based Tk port."
HOMEPAGE="https://www.androwish.org"
COPYRIGHT="Regents of the University of California, Sun Microsystems, Inc., Scriptics Corporation, and other parties"
LICENSE="TCL"
REVISION="3"
SOURCE_URI="http://androwish.org/download/androwish-c48f047f5b.tar.gz"
CHECKSUM_SHA256="4ecbc23193cb00b9fc34c0942e2327f0b6badbe587ab574b492780994707683d"
SOURCE_DIR="androwish-c48f047f5b/jni/sdl2tk/"
PATCHES="tk-$portVersion.patchset"
ARCHITECTURES="all !x86_gcc2"
SECONDARY_ARCHITECTURES="x86"
commandBinDir=$binDir
commandSuffix=$secondaryArchSuffix
if [ "$targetArchitecture" = x86_gcc2 ]; then
commandSuffix=
commandBinDir=$prefix/bin
fi
PROVIDES="
tk$secondaryArchSuffix = $portVersion compat >= 8.6
cmd:wish$commandSuffix = $portVersion compat >= 8.6
cmd:wish8.6$commandSuffix = $portVersion compat >= 8.6
lib:libtk8.6$secondaryArchSuffix = $portVersion compat >= 8.6
"
REQUIRES="
haiku$secondaryArchSuffix
tcl$secondaryArchSuffix
lib:libfreetype$secondaryArchSuffix
lib:libSDL2_2.0$secondaryArchSuffix
lib:libz$secondaryArchSuffix
"
PROVIDES_devel="
tk${secondaryArchSuffix}_devel = $portVersion
devel:libtk8.6$secondaryArchSuffix = $portVersion
devel:libtkstub8.6$secondaryArchSuffix = $portVersion
"
REQUIRES_devel="
tk$secondaryArchSuffix == $portVersion base
"
CONFLICTS_devel="
xlibe${secondaryArchSuffix}_devel
"
BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel
tcl${secondaryArchSuffix}_devel
devel:libfreetype$secondaryArchSuffix
devel:libSDL2$secondaryArchSuffix
devel:libz$secondaryArchSuffix
"
BUILD_PREREQUIRES="
cmd:awk
cmd:gcc$secondaryArchSuffix
cmd:ld$secondaryArchSuffix
cmd:make
cmd:pkg_config$secondaryArchSuffix
"
BUILD()
{
cd sdl
chmod +x configure
local _64bit="--enable-64bit"
if [ "$targetArchitecture" = x86_gcc2 ]; then
_64bit="--disable-64bit"
fi
LDFLAGS="-Wl,--no-undefined" \
CFLAGS=-DTclpGetMonotonicTime=Tcl_GetTime \
runConfigure --omit-dirs binDir ./configure \
--bindir=$commandBinDir \
--with-tcl=$(finddir B_SYSTEM_DEVELOP_DIRECTORY)/lib$secondaryArchSubDir \
--enable-man-symlinks $_64bit
# patch Makefile for Haiku compatibility
sed -i s/-lsocket// Makefile
if [ "$effectiveTargetArchitecture" = x86_gcc2 ]; then
sed -i s/-lstdc++/-lstdc++.r4/ Makefile
fi
# patch Makefile for shared Tcl compatibility
sed -i 's/-ltcl8.6/-ltcl8.6 -ltclstub8.6/' Makefile
# patch Makefile to be "regular Tk"
sed -i s/tkZipMain/tkMain/ Makefile
sed -i s/libsdl2tk/libtk/ Makefile
sed -i s/sdl2wish/wish/ Makefile
sed -i s/sdl2tk8/tk8/ Makefile
make
}
INSTALL()
{
cd sdl
make install
# rearrange to be "regular Tk"
mv $libDir/sdl2tkConfig.sh $libDir/tkConfig.sh
mv $libDir/pkgconfig/sdl2tk.pc $libDir/pkgconfig/tk.pc
# add standard symlinks
ln -s $commandBinDir/wish8.6 $commandBinDir/wish
prepareInstalledDevelLib libtkstub8.6
fixPkgconfig
# since we pretend to be regular tk
# correct library names in tk.pc and tkConfig.sh
sed -i 's/-lsdl2tk8.6 -lsdl2tkstub8.6/-ltk8.6 -ltkstub8.6/' \
$prefix/$relativeDevelopLibDir/pkgconfig/tk.pc
sed -i 's/libsdl2tk8.6.so/libtk8.6.so/' \
$prefix/$relativeLibDir/tkConfig.sh
sed -i 's/-lsdl2tk8.6/-ltk8.6/' \
$prefix/$relativeLibDir/tkConfig.sh
sed -i 's/libsdl2tkstub8.6.a/libtkstub8.6.a/' \
$prefix/$relativeLibDir/tkConfig.sh
sed -i 's/-lsdl2tkstub8.6/-ltkstub8.6/' \
$prefix/$relativeLibDir/tkConfig.sh
mv $libDir/tkConfig.sh $developLibDir
packageEntries devel \
$developDir
}