summaryrefslogtreecommitdiff
path: root/debian/rules
blob: 48afadbb8075e5f5d97ea801689b11e959af62d6 (plain)
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
#!/usr/bin/make -f

# Uncomment this to turn on verbose mode.
export DH_VERBOSE=1

# check if we need to use DEBUG:
DEBUG_FLAGS:=$(if $(findstring debug,$(DEB_BUILD_OPTIONS)),--with-debug,)

#standard C flags:
CFLAGS:=-falign-functions=4
export CFLAGS

# change the CFLAGS depending on the architecture
DEB_BUILD_ARCH := $(shell dpkg-architecture -qDEB_BUILD_ARCH)

ifneq (,$(filter m68k alpha hppa powerpc,$(DEB_BUILD_ARCH)))
	CFLAGS:=-D SAFETY=3 -D NO_MULTIMAP_SHM -D NO_MULTIMAP_FILE -D NO_SINGLEMAP -D NO_TRIVIALMAP ${CFLAGS}
endif

ifneq (,$(filter ia64 ,$(DEB_BUILD_ARCH)))
	CFLAGS:=-D NO_MULTIMAP_SHM -D NO_MULTIMAP_FILE -D NO_SINGLEMAP -D NO_TRIVIALMAP ${CFLAGS}
endif

ifneq (,$(filter sparc ,$(DEB_BUILD_ARCH)))
	 CFLAGS:=-mcpu=v9 -fno-gcse -DSAFETY=3 -D SAFETY=3 -D NO_MULTIMAP_SHM -D NO_MULTIMAP_FILE -D NO_SINGLEMAP -D NO_TRIVIALMAP ${CFLAGS}
endif

ifneq (,$(filter armhf ,$(DEB_BUILD_ARCH)))
	 CFLAGS:=-marm ${CFLAGS}
endif

ifneq (,$(filter hppa ia64 m68k s390 s390x mipsel powerpc powerpcspe,$(DEB_BUILD_ARCH)))
        # Disable FFI
        FFI:=--without-dynamic-ffi
        MODULES:=--with-module=gdbm --with-module=berkeley-db --with-module=pcre --with-module=rawsock --with-module=clx/new-clx
else ifneq (,$(filter sparc ,$(DEB_BUILD_ARCH)))
        # Disable FFI and the dynamic modules
        # this will only build a base and full package:
        FFI:=--without-dynamic-ffi --without-dynamic-modules
	MODULES:=--with-module=gdbm --with-module=berkeley-db --with-module=pcre --with-module=rawsock --with-module=clx/new-clx
else
        # Enable FFI on all other platforms
        FFI:=--with-dynamic-ffi --with-dynamic-modules
        MODULES:=--with-module=bindings/glibc --with-module=gdbm --with-module=berkeley-db --with-module=postgresql --with-module=pcre --with-module=zlib --with-module=rawsock --with-module=dbus --with-module=clx/new-clx
endif

configure: configure-stamp
configure-stamp:
	echo we have no configure step
	touch configure-stamp

build: build-stamp
build-stamp: 
	dh_testdir

	# on systems without FFI we cannot make multiple packages
	./configure debian/build --enable-portability ${DEBUG_FLAGS} --prefix=/usr --fsstnd=debian ${FFI} CFLAGS="${CFLAGS}" ${MODULES} || { cat debian/build/config.log; touch foo.h; cpp -dM foo.h ; exit 1; }

	# remove the -O2 from the makefile
ifneq (,$(filter sparc mipsel ia64 ,$(DEB_BUILD_ARCH)))
	sed 's/ -O2 / /' < debian/build/Makefile > debian/build/Makefile-new && \
		mv debian/build/Makefile debian/build/Makefile-old && \
		mv debian/build/Makefile-new debian/build/Makefile
endif # filter mipsel ia64 ,$(DEB_BUILD_ARCH) remove the -O2 from the makefile

	# build the package
	$(MAKE) -C debian/build

	touch build-stamp

clean: 
	dh_testdir
	dh_testroot
	rm -f build-stamp configure-stamp

	rm -rf debian/build 

	chmod a+x configure 
	dh_clean

install: build
	# echo doing install
	dh_testdir
	dh_testroot
	dh_prep
	dh_installdirs -A

	# install the package

	$(MAKE) -C debian/build DESTDIR=$(shell pwd)/debian/tmp install
	mkdir -p debian/tmp/usr/share/doc debian/tmp/usr/share/man debian/tmp/usr/sbin debian/tmp/usr/bin 

	# remove unwanted upstream doc/ files
	rm debian/tmp/usr/share/doc/clisp/doc/clisp.1 \
		debian/tmp/usr/share/doc/clisp/doc/clisp-link.1 \
		debian/tmp/usr/share/doc/clisp/COPYRIGHT \
		debian/tmp/usr/share/doc/clisp/GNU-GPL || true

	# Install CLC files
	install -o root -g root -m 0644 debian/install-clc.lisp \
		debian/tmp/usr/lib/clisp-2.49.60+

	dh_install --sourcedir=debian/tmp
	# remove docs  from the clx package:
	if [ -d debian/clisp-module-clx/usr/lib/clisp-2.49.60+/clx/new-clx/demos ] ; then rm -rf debian/clisp-module-clx/usr/lib/clisp-2.49.60+/clx/new-clx/demos ; fi 
	# handle full image if  it exists, normally we do not build it
	if [ -d debian/tmp/usr/lib/clisp-2.49.60+/full ] ; then mkdir -p debian/clisp-dev/usr/lib/clisp-2.49.60+/full/ ; fi
	if [ -d debian/tmp/usr/lib/clisp-2.49.60+/full ] ; then mkdir -p debian/clisp/usr/lib/clisp-2.49.60+/full/ ; fi
	if [ -d debian/tmp/usr/lib/clisp-2.49.60+/full ] ; then install --owner=root --group=root --mode=0644  debian/tmp/usr/lib/clisp-2.49.60+/full/*.a debian/clisp-dev/usr/lib/clisp-2.49.60+/full/ ; fi
	if [ -d debian/tmp/usr/lib/clisp-2.49.60+/full ] ; then install --owner=root --group=root --mode=0644  debian/tmp/usr/lib/clisp-2.49.60+/full/*.h debian/clisp-dev/usr/lib/clisp-2.49.60+/full/ ; fi
	if [ -d debian/tmp/usr/lib/clisp-2.49.60+/full ] ; then install --owner=root --group=root --mode=0644  debian/tmp/usr/lib/clisp-2.49.60+/full/makevars debian/clisp-dev/usr/lib/clisp-2.49.60+/full/ ; fi
	if [ -d debian/tmp/usr/lib/clisp-2.49.60+/full ] ; then install --owner=root --group=root --mode=0644  debian/tmp/usr/lib/clisp-2.49.60+/full/lispinit.mem debian/clisp/usr/lib/clisp-2.49.60+/full/ ; fi
	if [ -d debian/tmp/usr/lib/clisp-2.49.60+/full ] ; then install --owner=root --group=root --mode=0755  debian/tmp/usr/lib/clisp-2.49.60+/full/lisp.run debian/clisp/usr/lib/clisp-2.49.60+/full/ ; fi
	if [ -d debian/tmp/usr/lib/clisp-2.49.60+/full ] ; then install --owner=root --group=root --mode=0644  debian/tmp/usr/lib/clisp-2.49.60+/full/*.o debian/clisp/usr/lib/clisp-2.49.60+/full/ ; fi


build-arch: build
build-indep: build

# Build architecture-independent files here.
binary-indep: build install
	dh_testdir  -i
	dh_testroot  -i
	dh_installdocs  -i
	dh_installexamples  -i
	dh_installchangelogs -a -i src/ChangeLog -i
	dh_strip  -i
	dh_link  -i
	dh_compress  -i
	dh_fixperms -i
	dh_installdeb -i
	dh_shlibdeps -i
	dh_gencontrol -i
	dh_md5sums  -i
	dh_builddeb -i

# Build architecture-dependent files here.
binary-arch: build install
	dh_testdir  -a
	dh_testroot  -a
	dh_installdocs  -a
	dh_installexamples  -a
	dh_installman  -a
	dh_installchangelogs -a -i src/ChangeLog -a
	dh_lisp clisp -a
	dh_strip  -a
	dh_link  -a
	dh_compress  -a
	dh_fixperms -a
	dh_installdeb -a
	dh_shlibdeps -a

#	add FAS file format version to substvars
	debian/clisp/usr/bin/clisp -Efile utf-8 -B debian/clisp/usr/lib/clisp-2.49.60+ -M debian/clisp/usr/lib/clisp-2.49.60+/base/lispinit.mem debian/fasl-version.lisp

	dh_gencontrol -a
	dh_md5sums  -a
	dh_builddeb -a

binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install configure