summaryrefslogtreecommitdiff
path: root/debian/rules
blob: ee7f469ec3508cdcd39b957743c7477eba68ce16 (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
#!/usr/bin/make -f
# -*- makefile -*-
export SHELL = bash

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

DEB_HOST_ARCH_OS ?= $(dpkg-architecture -qDEB_HOST_ARCH_OS)
HOST_CFLAGS = -fcommon
LDFLAGS ?= $(shell dpkg-buildflags --get LDFLAGS)
CFLAGS ?= $(shell dpkg-buildflags --get CFLAGS) $(HOST_CFLAGS)

ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
else
NUMJOBS = 1
endif

RUMPMAKE := $(CURDIR)/buildrump.sh/src/obj/tooldir/bin/nbmake-i386

%:
	rm -f debian/*.debhelper.log
	dh $@ 

override_dh_auto_clean:
	-cd pci-userspace/src-linux-uio && $(RUMPMAKE) clean
	-cd pci-userspace/src-gnu && $(RUMPMAKE) clean
	rm -rf buildrump.sh/src/{obj,rump}
	-find buildrump.sh/src -type f -name .depend -or -name \*.d | xargs -L512 rm -f

override_dh_auto_build-arch:
	dh_testdir -a
	cd buildrump.sh/src/lib/librumpuser && ./configure
	cd buildrump.sh/src && HOST_CC=gcc \
            LDADD="-L/usr/lib/i386-gnu -L/lib/i386-gnu" \
            _GCC_CRTENDS= _GCC_CRTEND= _GCC_CRTBEGINS= _GCC_CRTBEGIN= _GCC_CRTI= _GCC_CRTN= \
            ./build.sh \
                -V TOOLS_BUILDRUMP=yes -V MKGROFF=no -V TOPRUMP="$(CURDIR)/buildrump.sh/src/sys/rump" \
                -V BUILDRUMP_CPPFLAGS="-Wno-error=stringop-overread" \
                -V RUMPUSER_EXTERNAL_DPLIBS=pthread \
				-V CPPFLAGS="-I../../obj/destdir.i386/usr/include -D_FILE_OFFSET_BITS=64 -DRUMP_REGISTER_T=int -DRUMPUSER_CONFIG=yes -DNO_PCI_MSI_MSIX=yes" \
                -V CWARNFLAGS="-Wno-error=maybe-uninitialized -Wno-error=address-of-packed-member -Wno-error=unused-variable -Wno-error=stack-protector -Wno-error=array-parameter -Wno-error=array-bounds -Wno-error=stringop-overflow" \
                -V LIBCRTBEGIN=" " -V LIBCRTEND=" " -V LIBCRT0=" " -V LIBCRTI=" " \
                -V _GCC_CRTENDS=" " -V _GCC_CRTEND=" " \
                -V _GCC_CRTBEGINS=" " -V _GCC_CRTBEGIN=" " \
                -V _GCC_CRTI=" " -V _GCC_CRTN=" " \
                -V LDADD="-L/usr/lib/i386-gnu -L/lib/i386-gnu" \
                -U -u -T ./obj/tooldir -m i386 -j $(NUMJOBS) tools rump
	cd buildrump.sh/src/lib/librumpuser && RUMPRUN=true $(RUMPMAKE) dependall
ifeq ($(DEB_HOST_ARCH_OS), linux)
#	cd pci-userspace/src-linux-uio && $(RUMPMAKE) dependall
endif
ifeq ($(DEB_HOST_ARCH_OS), hurd)
	cd pci-userspace/src-gnu && $(RUMPMAKE) dependall
endif

override_dh_auto_install:
	mkdir -p $(CURDIR)/debian/tmp/usr/include
	mkdir -p $(CURDIR)/debian/tmp/usr/lib
	cp -a $(CURDIR)/buildrump.sh/src/sys/rump/include/rump $(CURDIR)/debian/tmp/usr/include/
	find $(CURDIR)/buildrump.sh/src -type f,l \
            -name "librump*.so*" -exec cp -a {} $(CURDIR)/debian/tmp/usr/lib/ \;
	find $(CURDIR)/buildrump.sh/src -type f \
            -name "librump*.a" -exec cp -a {} $(CURDIR)/debian/tmp/usr/lib/ \;

	# rempve non lib files
	rm -f $(CURDIR)/debian/tmp/usr/lib/*.map
	# Remove it to make lintian happy
	rm -f $(CURDIR)/debian/tmp/usr/lib/librumpkern_z.*