1SUMMARY="A light-weight scripting language"
2DESCRIPTION="Squirrel is a light weight programming language featuring higher-order \
3functions, classes/inheritance, delegation, tail recursion, generators, \
4cooperative threads, exception handling, reference counting and garbage \
5collection on demand.  C-like syntax."
6HOMEPAGE="http://www.squirrel-lang.org"
7COPYRIGHT="2003-2016 Alberto Demichelis"
8LICENSE="MIT"
9REVISION="1"
10SOURCE_URI="https://github.com/albertodemichelis/squirrel/archive/v$portVersion.tar.gz"
11CHECKSUM_SHA256="02805414cfadd5bbb921891d3599b83375a40650abd6404a8ab407dc5e86a996"
12# Grabbed from Gentoo
13PATCHES="squirrel-3.2-CVE-2022-30292.patch"
14
15ARCHITECTURES="all !x86_gcc2"
16SECONDARY_ARCHITECTURES="x86"
17
18commandBinDir=$binDir
19commandSuffix=$secondaryArchSuffix
20if [ "$targetArchitecture" = x86_gcc2 ]; then
21	commandSuffix=
22	commandBinDir=$prefix/bin
23fi
24
25libVersion="0.0.0"
26libVersionCompat="$libVersion compat >= ${libVersion%%.*}"
27
28PROVIDES="
29	squirrel$secondaryArchSuffix = $portVersion
30	cmd:sq$commandSuffix = $portVersion
31	lib:libsqstdlib$secondaryArchSuffix = $libVersionCompat
32	lib:libsquirrel$secondaryArchSuffix = $libVersionCompat
33	"
34REQUIRES="
35	haiku$secondaryArchSuffix
36	"
37
38PROVIDES_devel="
39	squirrel${secondaryArchSuffix}_devel = $portVersion
40	devel:libsqstdlib$secondaryArchSuffix = $libVersionCompat
41	devel:libsquirrel$secondaryArchSuffix = $libVersionCompat
42	"
43REQUIRES_devel="
44	squirrel$secondaryArchSuffix == $portVersion base
45	"
46
47BUILD_REQUIRES="
48	haiku${secondaryArchSuffix}_devel
49	"
50BUILD_PREREQUIRES="
51	cmd:cmake
52	cmd:gcc$secondaryArchSuffix
53	cmd:make
54	"
55
56BUILD()
57{
58	cmake -B build -S . -DCMAKE_BUILD_TYPE=Release \
59		$cmakeDirArgs \
60		-DCMAKE_INSTALL_BINDIR=$commandBinDir \
61		-DDISABLE_STATIC=ON
62	make -C build $jobArgs
63}
64
65INSTALL()
66{
67	make -C build install
68
69	prepareInstalledDevelLibs libsqstdlib libsquirrel
70
71# Add pkgconfig file
72mkdir -p $developLibDir/pkgconfig
73cat > $developLibDir/pkgconfig/squirrel.pc << EOF
74bindir=$commandBinDir
75exec_prefix=$prefix
76libdir=$libDir
77includedir=$includeDir
78
79Name: squirrel
80Description: $SUMMARY
81Version: $portVersion
82Libs: -L${developLibDir} -lsqstdlib -lsquirrel
83Cflags: -I${includeDir}
84EOF
85
86	packageEntries devel \
87		$developDir \
88		$libDir/cmake
89}
90