Note dropped patch in d/changelog
[deb_dpdk.git] / debian / rules
1 #!/usr/bin/make -f
2 # See debhelper(7) (uncomment to enable)
3 # output every command that modifies files on the build system.
4 #export DH_VERBOSE = 1
5
6 VERSION := $(shell dpkg-parsechangelog | sed -nr '/^Version:/s/Version: (.*:)?(.*)-(.*)/\2/p')
7
8 # see EXAMPLES in dpkg-buildflags(1) and read /usr/share/dpkg/*
9 DPKG_EXPORT_BUILDFLAGS = 1
10 include /usr/share/dpkg/default.mk
11
12 DEB_HOST_GNU_CPU := $(shell dpkg-architecture -qDEB_HOST_GNU_CPU)
13
14 # see FEATURE AREAS in dpkg-buildflags(1)
15 export DEB_BUILD_MAINT_OPTIONS = hardening=+all
16
17 # build with debug symbols, dh_strip will create -dgbsyms packages by that
18 # also export -fPIC for the static build (already used by shared by default)
19 export EXTRA_CFLAGS = -g -fPIC
20
21 # see ENVIRONMENT in dpkg-buildflags(1)
22 # package maintainers to append CFLAGS
23 #export DEB_CFLAGS_MAINT_APPEND  = -Wall -pedantic
24 # package maintainers to append LDFLAGS
25 #export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed
26
27 ifneq (,$(filter $(DEB_HOST_ARCH), arm64))
28 DPDK_CONFIG = "arm64-armv8a-linuxapp-gcc"
29 RTE_MACHINE = "armv8a"
30 RTE_TARGET = "arm64-armv8a-linuxapp-gcc"
31 else
32 DPDK_CONFIG = "$(DEB_HOST_GNU_CPU)-native-linuxapp-gcc"
33 RTE_MACHINE = "default"
34 RTE_TARGET = "$(DEB_HOST_GNU_CPU)-default-linuxapp-gcc"
35 endif
36 DPDK_STATIC_DIR = "debian/build/static-root"
37 DPDK_SHARED_DIR = "debian/build/shared-root"
38
39 clean:
40         dh_testdir
41         rm -rf debian/build debian/tmp
42         dh_clean
43
44 build-config:
45         dh_testdir
46         $(MAKE) O=$(DPDK_STATIC_DIR) T=$(DPDK_CONFIG) config
47         sed -ri -e 's,(RTE_MACHINE=).*,\1$(RTE_MACHINE),' \
48                 -e 's,(RTE_NEXT_ABI=).*,\1n,' \
49                 -e 's,(CONFIG_RTE_EAL_IGB_UIO=).*,\1n,' \
50                 -e 's,(CONFIG_RTE_KNI_KMOD=).*,\1n,' \
51                 -e 's,(LIBRTE_PMD_PCAP=).*,\1y,' \
52                 -e 's,(LIBRTE_PMD_XENVIRT=).*,\1y,' \
53                 $(DPDK_STATIC_DIR)/.config
54
55 build-indep: build-config
56         dh_testdir
57         $(MAKE) O=$(DPDK_STATIC_DIR) doc-api-html doc-guides-html
58
59 build-arch: build-config
60         dh_testdir
61         $(MAKE) O=$(DPDK_STATIC_DIR) build
62         # Unfortunately the decision about having static or shared libraries is
63         # made for the whole build, which then produces only .a or .so files
64         # (but not both).
65         # And the target layout for target selection has no field for the
66         # type of library.
67         # Right now I hack this by doing a second build which only differs in
68         # the selection of shared libs.
69         # Shared libs should be default, so the previous static build is only
70         # used to get static libraries.
71         cp -a $(DPDK_STATIC_DIR) $(DPDK_SHARED_DIR)
72         sed -ri 's,(RTE_BUILD_SHARED_LIB=).*,\1y,' \
73                 $(DPDK_SHARED_DIR)/.config
74         $(MAKE) O=$(DPDK_SHARED_DIR) build
75
76 build: build-arch build-indep
77
78 binary-indep: PACKAGE_NAME=dpdk-doc
79 binary-indep: DOCDIR=usr/share/doc/dpdk
80 binary-indep: export DH_OPTIONS=--indep
81 binary-indep:
82         dh_testroot
83         dh_prep
84         dh_testdir
85         dh_installdirs
86         dh_install
87         dh_installdocs
88         dh_installchangelogs
89         dh_lintian
90         # Package: dpdk-doc
91         # All files based on the install-doc rule (includes examples)
92         $(MAKE) O=$(DPDK_SHARED_DIR) prefix=/usr \
93                 DESTDIR=debian/dpdk-doc install-doc
94         dh_link
95         dh_compress
96         dh_fixperms
97         dh_installdeb
98         dh_gencontrol
99         dh_md5sums
100         dh_builddeb
101
102 binary-arch: LIBDIR=usr/lib/$(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
103 binary-arch: export DH_OPTIONS=--arch
104 binary-arch:
105         dh_testroot
106         dh_prep
107         dh_testdir
108         dh_installdirs
109         dh_install
110         dh_installdocs
111         dh_installchangelogs
112         dh_lintian
113         dh_systemd_enable
114         dh_installinit --no-start --no-restart-on-upgrade
115         dh_systemd_start --no-start --no-restart-on-upgrade
116         # Package: dpdk (runtime)
117         $(MAKE) O=$(DPDK_STATIC_DIR) prefix=/usr \
118                 DESTDIR=debian/dpdk install-runtime
119         $(MAKE) O=$(DPDK_SHARED_DIR) prefix=/usr \
120                 DESTDIR=debian/dpdk install-runtime
121         cp debian/dpdk.interfaces debian/dpdk/etc/dpdk/interfaces
122         rm debian/dpdk/usr/sbin/dpdk_nic_bind
123         ln -s /usr/share/dpdk/tools/dpdk_nic_bind.py \
124                 debian/dpdk/sbin/dpdk_nic_bind
125         # Package: dpdk-dev (build environment)
126         $(MAKE) O=$(DPDK_SHARED_DIR) prefix=/usr \
127                 DESTDIR=debian/dpdk-dev install-sdk
128         cp $(DPDK_SHARED_DIR)/.config debian/dpdk-dev/usr/share/dpdk/config
129         sed -e 's/SDK_TARGET/$(RTE_TARGET)/' debian/dpdk-sdk-env.sh.in > \
130                 debian/dpdk-dev/usr/share/dpdk/dpdk-sdk-env.sh
131         # Package: libdpdk-dev (bare headers, static devel libs and linker
132         # script)
133         mkdir -p debian/libdpdk-dev/$(LIBDIR)
134         # linker script
135         mv debian/dpdk/usr/lib/libdpdk.so debian/libdpdk-dev/$(LIBDIR)/
136         # includes
137         mv debian/dpdk-dev/usr/include/dpdk debian/libdpdk-dev/usr/include/
138         # all static libs are in the dev package
139         mv debian/dpdk/usr/lib/lib*.a debian/libdpdk-dev/$(LIBDIR)/
140         # symlinks to last .so's are in the non versioned libdpdk-dev as well
141         # this allows multiple libdpdk-<NAME><VER> at different VER concurrently
142         # libdpdk-dev depends on all sublibs so symlinks are never broken
143         mv debian/dpdk/usr/lib/*.so debian/libdpdk-dev/$(LIBDIR)/
144         # Package(s): libdpdk-<NAME><VER> (bare runtime libs)
145         for lib in $$(ls -1 debian/dpdk/usr/lib/*.so.*); do \
146           BN=$$(basename $${lib}); \
147           VER=$$(echo $${BN} | sed -e 's/^.*\.so\.//'); \
148           LN=$$(echo $${BN} | sed -e 's/\.so\.[0-9]*$$//' | tr '_' '-'); \
149           LNV="libdpdk-$${LN}$${VER}"; \
150           echo "moving $${lib} for library $${LNV}"; \
151           mkdir -p debian/$${LNV}/$(LIBDIR); \
152           mv $${lib} debian/$${LNV}/$(LIBDIR); \
153         done
154         # Package: dpdk-igb-uio-dkms
155         mkdir -p debian/dpdk-igb-uio-dkms/usr/src/dpdk-igb-uio-$(VERSION)
156         cp lib/librte_eal/linuxapp/igb_uio/* \
157                 debian/dpdk-igb-uio-dkms/usr/src/dpdk-igb-uio-$(VERSION)
158         # Package: dpdk-rte-kni-dkms
159         mkdir -p debian/dpdk-rte-kni-dkms/usr/src/dpdk-rte-kni-$(VERSION)
160         cp -a lib/librte_eal/linuxapp/kni/* \
161                 debian/dpdk-rte-kni-dkms/usr/src/dpdk-rte-kni-$(VERSION)
162         dh_dkms -V $(VERSION)
163         dh_python2
164         dh_perl
165         dh_link
166         dh_compress
167         dh_fixperms
168         dh_strip
169         dh_makeshlibs
170         dh_shlibdeps
171         dh_installdeb
172         dh_gencontrol
173         dh_md5sums
174         dh_builddeb
175
176 binary: binary-arch binary-indep

©2016 FD.io a Linux Foundation Collaborative Project. All Rights Reserved.
Linux Foundation is a registered trademark of The Linux Foundation. Linux is a registered trademark of Linus Torvalds.
Please see our privacy policy and terms of use.