1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
|
# Maintainer: Jiří Klimeš <blueowl@centrum.cz>
# Contributor: Stefan Husmann <stefan-husmann@t-online.de>
# Contributor: Karro <karolina.lindqvist@kramnet.se>
pkgbase=libcd
pkgname=('libcd' 'lua-cd' 'lua51-cd' 'lua52-cd' 'lua53-cd')
pkgdesc="Canvas Draw - 2D vector graphics library"
pkgver=5.14
pkgrel=4
arch=('i686' 'x86_64')
url="https://www.tecgraf.puc-rio.br/cd/"
makedepends=('glu' 'pdflib-lite' 'lsb-release' 'lua' 'lua51' 'lua52' 'lua53' 'lua-im' 'lua51-im' 'lua52-im' 'lua53-im')
license=('MIT')
_ftglver=2.1.5
source=(
"https://downloads.sourceforge.net/project/canvasdraw/${pkgver}/Docs%20and%20Sources/cd-${pkgver}_Sources.tar.gz"
"https://downloads.sourceforge.net/project/canvasdraw/${pkgver}/Docs%20and%20Sources/ftgl-${_ftglver}_Sources.tar.gz"
"https://downloads.sourceforge.net/project/canvasdraw/${pkgver}/Docs%20and%20Sources/cd-${pkgver}_Docs.pdf"
fix-build-gcc-14.patch
)
md5sums=('7b7bc2cd0d0b598e957aaf16e8bc6884'
'dcad37c50e5832150ef3382d12f3182d'
'c8abe5349f426228f9219ceb134e84ac'
'370882f1bc46c3e2bf9713820c2b5880')
prepare() {
# Statically link internal ftgl library. It contains Tecgraf's extensions needed by libcdgl.so
sed '/LIBS += ftgl/{ N; s/.*/SLIB += $(FTGL_LIB)\/libftgl.a/; }' -i "$srcdir"/cd/tecmake.mak
# patch to build with harfbuzz-ed pango (i.e. pango >= 1.44)
if [[ "$(vercmp $(pacman -Q pango | cut -d' ' -f2) 1:1.44)" -ge 0 ]]; then
sed 's/LIBS += gdk_pixbuf-2.0 pango-1.0 gobject-2.0 gmodule-2.0 glib-2.0/LIBS += gdk_pixbuf-2.0 pango-1.0 harfbuzz gobject-2.0 gmodule-2.0 glib-2.0/' -i "$srcdir"/cd/tecmake.mak
sed 's|STDINCS += $(GTK)/include/cairo $(GTK)/include/pango-1.0 $(GTK)/include/glib-2.0|STDINCS += $(GTK)/include/cairo $(GTK)/include/pango-1.0 $(GTK)/include/harfbuzz $(GTK)/include/glib-2.0|' -i "$srcdir"/cd/tecmake.mak
fi
# patch to link to pdflib-lite correctly (AUR pdflib-lite is just named libpdf instead of libpdflib)
sed 's|LIBS += pdflib|LIBS += pdf|' -i "$srcdir"/cd/tecmake.mak
# patch for building with gcc 14
# temporary - remove when it is fixed in upstream
patch -p0 < "$srcdir"/fix-build-gcc-14.patch
# ensure proper building in parallel (specifying targets' dependencies)
sed -i 's/^cd[^\(:\|lua\)].*/\0 cd/g;s/^cdlua[^5].*/\0 cdlua5/g' "$srcdir"/cd/src/Makefile
}
build() {
echo 'Building libcd'
cd "$srcdir"/ftgl
make
cd "$srcdir"/cd/src
make cd cdpdf cdgl cdim cdcontextplus \
IM_INC=/usr/include/im \
IM_LIB=/usr/lib \
USE_FTGL=Yes \
USE_GTK3=Yes
echo 'Building Lua 5.4 bindings'
make cdlua5 cdluapdf5 cdluagl5 cdluacontextplus5 cdluaim5 \
STDLDFLAGS="-shared -Wl,-rpath=/usr/lib/lua/5.4,--enable-new-dtags,--as-needed" \
IM_INC=/usr/include/im \
IM_LIB=/usr/lib \
IMLUA_LIB=/usr/lib/lua/5.4 \
USE_LUA54=Yes
echo 'Building Lua 5.3 bindings'
make cdlua5 cdluapdf5 cdluagl5 cdluacontextplus5 cdluaim5 \
STDLDFLAGS="-shared -Wl,-rpath=/usr/lib/lua/5.3,--enable-new-dtags,--as-needed" \
IM_INC=/usr/include/im \
IM_LIB=/usr/lib \
IMLUA_LIB=/usr/lib/lua/5.3 \
LUA_INC=/usr/include/lua5.3 \
USE_LUA53=Yes
echo 'Building Lua 5.2 bindings'
make cdlua5 cdluapdf5 cdluagl5 cdluacontextplus5 cdluaim5 \
STDLDFLAGS="-shared -Wl,-rpath=/usr/lib/lua/5.2,--enable-new-dtags,--as-needed" \
IM_INC=/usr/include/im \
IM_LIB=/usr/lib \
IMLUA_LIB=/usr/lib/lua/5.2 \
LUA_INC=/usr/include/lua5.2 \
USE_LUA52=Yes
echo 'Building Lua 5.1 bindings'
make cdlua5 cdluapdf5 cdluagl5 cdluacontextplus5 cdluaim5 \
STDLDFLAGS="-shared -Wl,-rpath=/usr/lib/lua/5.1,--enable-new-dtags,--as-needed" \
IM_INC=/usr/include/im \
IM_LIB=/usr/lib \
IMLUA_LIB=/usr/lib/lua/5.1 \
LUA_INC=/usr/include/lua5.1 \
USE_LUA51=Yes
}
package_libcd() {
pkgdesc="Canvas Draw - 2D vector graphics library"
depends=('libim' 'glu' 'libxmu' 'gtk3')
_linux_ver="Linux$(uname -r | awk -v FS='.' -v OFS='' {'print $1,$2'})_64"
install -m755 -d "$pkgdir"/usr/lib
install -m644 "$srcdir"/cd/lib/${_linux_ver}/lib*.so "$pkgdir"/usr/lib
install -m755 -d "$pkgdir"/usr/share/$pkgname
install -m644 "$srcdir"/cd-${pkgver}_Docs.pdf "$pkgdir"/usr/share/$pkgname
install -m755 -d "$pkgdir"/usr/include/cd
install -m644 "$srcdir"/cd/include/* "$pkgdir"/usr/include/cd
install -Dm644 "$srcdir"/cd/COPYRIGHT "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
}
_lua_cd_package_helper() {
# $1 ... Lua version ("5.1", "5.2", "5.3" or "5.4")
_lua_ver=$1
_lua_ver_nodot=`echo $1 | cut -c1,3`
_linux_ver="Linux$(uname -r | awk -v FS='.' -v OFS='' {'print $1,$2'})_64"
install -d "$pkgdir"/usr/lib/lua/${_lua_ver}/
install -Dm644 "$srcdir"/cd/lib/${_linux_ver}/Lua${_lua_ver_nodot}/*.so "$pkgdir"/usr/lib/lua/${_lua_ver}/
install -Dm644 "$srcdir"/cd/COPYRIGHT "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
# create symlinks required for Lua modules
for name in \
cdlua \
cdluapdf \
cdluagl \
cdluaim \
cdluacontextplus ; do
_lib=lib${name}${_lua_ver_nodot}.so
ln -s /usr/lib/lua/${_lua_ver}/${_lib} "$pkgdir"/usr/lib/lua/${_lua_ver}/${name}.so
done
}
package_lua-cd() {
pkgdesc="Lua (5.4) bindings for Canvas Draw library"
depends=('libcd')
_lua_cd_package_helper "5.4"
}
package_lua53-cd() {
pkgdesc="Lua (5.3) bindings for Canvas Draw library"
depends=('libcd')
_lua_cd_package_helper "5.3"
}
package_lua52-cd() {
pkgdesc="Lua (5.2) bindings for Canvas Draw library"
depends=('libcd')
_lua_cd_package_helper "5.2"
}
package_lua51-cd() {
pkgdesc="Lua (5.1) bindings for Canvas Draw library"
depends=('libcd')
_lua_cd_package_helper "5.1"
}
# vim:set ts=2 sw=2 et:
|