Skip to content

Commit 2a512de

Browse files
committed
Implement a makefile rule to build a debian package
1 parent bf81c85 commit 2a512de

6 files changed

Lines changed: 52 additions & 1 deletion

File tree

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,6 @@
22
*.so
33
*.dll
44
.deps
5+
debian_build
6+
*.deb
57

INSTALL

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,14 @@ Then you can install the module on your system by using:
1919

2020
> make install
2121

22+
or, as an alternative, you can build a debian package using
23+
24+
> make debian
25+
26+
The Lua's package will be named "graph" and can be called from luajit using
27+
28+
> require("graph")
29+
2230
Windows Installation Instructions
2331
---------------------------------
2432

Makefile

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ endif
116116
LUA_PATH = $(DEST_PREFIX)/share/lua/5.1
117117
LUA_DLLPATH = $(DEST_PREFIX)/lib/lua/5.1
118118
SYSTEM_LIBPATH = $(DEST_PREFIX)/lib
119+
DEBIAN = debian_build/$(PREFIX)
119120

120121
ifeq ($(HOST_SYS),Windows)
121122
PLATFORM_NATWIN_SRC_FILES = agg_platform_support_win32.cpp agg_win32_bmp.cpp
@@ -176,6 +177,17 @@ install: $(TARGETS)
176177
ln -s $(LUA_DLLPATH)/graphcore.so $(SYSTEM_LIBPATH)/libgraphcore.so
177178
$(CP_REL) $(GRAPH_LUA_SRC) $(LUA_PATH)
178179

180+
debian: $(TARGETS)
181+
rm -fr debian_build
182+
rm lua-graph-toolkit*.deb
183+
mkdir -p $(DEBIAN)/share/lua/5.1
184+
mkdir -p $(DEBIAN)/lib/lua/5.1
185+
cp $(LIBGRAPH_SO) $(DEBIAN)/lib/lua/5.1/graphcore.so
186+
cp $(LIBNATWIN_SO) $(DEBIAN)/lib/lua/5.1/natwin.so
187+
ln -s lua/5.1/graphcore.so $(DEBIAN)/lib/libgraphcore.so
188+
$(CP_REL) $(GRAPH_LUA_SRC) $(DEBIAN)/share/lua/5.1
189+
fakeroot bash debian/build.sh $(VERSION)
190+
179191
clean:
180192
$(HOST_RM) *.o *.so *.dll $(TARGETS)
181193

@@ -197,6 +209,6 @@ clean:
197209
>> .deps/$(*F).P; \
198210
rm .deps/$(*F).pp
199211

200-
.PHONY: clean all
212+
.PHONY: debian clean all
201213

202214
-include $(DEP_FILES)

debian/build.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/sh
2+
3+
LGT_ISIZE_A=(`du -s debian_build`)
4+
LGT_ISIZE=${LGT_ISIZE_A[0]}
5+
6+
VERSION=$1
7+
8+
mkdir debian_build/DEBIAN
9+
10+
cat debian/control | sed "s/LGT_VERSION/$VERSION/;s/LGT_INSTALLED_SIZE/$LGT_ISIZE/" - > debian_build/DEBIAN/control
11+
12+
chown root.root -R debian_build
13+
chmod a-w -R debian_build
14+
chmod 0755 debian_build/DEBIAN
15+
16+
dpkg-deb -b debian_build lua-graph-toolkit_$VERSION-1_i386.deb

debian/control

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Package: lua-graph-toolkit
2+
Maintainer: Francesco Abbate <francesc.bbt@gmail.com>
3+
Version: LGT_VERSION
4+
Architecture: i386
5+
Installed-Size: LGT_INSTALLED_SIZE
6+
Depends: libc6 (>= 2.7-1), libx11-6, libluajit-5.1-2
7+
Section: x11
8+
Priority: optional
9+
Description: Lua Graphics Toolkit
10+
The Lua Graphics Toolkit is a LuaJIT2 module to create graphical
11+
windows for plots or animations.

makeconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,7 @@ DISABLE_SUBPIXEL_LCD = no
66

77
DEBUG = no
88

9+
VERSION = 1.0
10+
911
PREFIX = /usr
1012
DEST_DIR =

0 commit comments

Comments
 (0)