a568c7a06a3344d3971e6c2da60c3775d6862bfb
[vpp.git] / build-data / platforms.mk
1 # Copyright (c) 2015 Cisco and/or its affiliates.
2 # Licensed under the Apache License, Version 2.0 (the "License");
3 # you may not use this file except in compliance with the License.
4 # You may obtain a copy of the License at:
5 #
6 #     http://www.apache.org/licenses/LICENSE-2.0
7 #
8 # Unless required by applicable law or agreed to in writing, software
9 # distributed under the License is distributed on an "AS IS" BASIS,
10 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 # See the License for the specific language governing permissions and
12 # limitations under the License.
13
14 # Pick up per-platform makefile fragments
15 $(foreach d,$(SOURCE_PATH_BUILD_DATA_DIRS),     \
16   $(eval -include $(d)/platforms/*.mk))
17
18 .PHONY: install-deb
19 install-deb: $(patsubst %,%-find-source,$(ROOT_PACKAGES))
20         @$(BUILD_ENV) ;                                                 \
21         set -eu$(BUILD_DEBUG) ;                                         \
22         $(MAKE) -C $(MU_BUILD_ROOT_DIR)                                 \
23             $(patsubst %,%-install,                                     \
24               $(ROOT_PACKAGES)) || exit 1;                              \
25                                                                         \
26         : generate file manifests ;                                     \
27         find $(INSTALL_PREFIX)$(ARCH)/*/bin -type f -print              \
28           | sed -e 's:.*:../& /usr/bin:'                                \
29             > deb/debian/vpp.install ;                                  \
30                                                                         \
31         : core api definitions ;                                        \
32         ./scripts/find-api-core-contents $(INSTALL_PREFIX)$(ARCH)       \
33          deb/debian/vpp.install ;                                       \
34                                                                         \
35         : need symbolic links in the lib pkg ;                          \
36         find $(INSTALL_PREFIX)$(ARCH)/*/lib* \( -type f -o  -type l \)  \
37           -print | egrep -e '*\.so\.*\.*\.*'                            \
38           | grep -v plugins\/                                           \
39           | sed -e 's:.*:../& /usr/lib/x86_64-linux-gnu:'               \
40             > deb/debian/vpp-lib.install ;                              \
41                                                                         \
42         : vnet api definitions ;                                        \
43         ./scripts/find-api-lib-contents $(INSTALL_PREFIX)$(ARCH)        \
44          deb/debian/vpp-lib.install ;                                   \
45                                                                         \
46         : dev package ;                                                 \
47         ./scripts/find-dev-contents $(INSTALL_PREFIX)$(ARCH)            \
48          deb/debian/vpp-dev.install ;                                   \
49                                                                         \
50         : plugins package ;                                             \
51         ./scripts/find-plugins-contents $(INSTALL_PREFIX)$(ARCH)        \
52          deb/debian/vpp-plugins.install ;                               \
53                                                                         \
54         : python-api package ;                                          \
55         ./scripts/find-python-api-contents $(INSTALL_PREFIX)$(ARCH)     \
56          deb/debian/vpp-python-api.install ;                            \
57                                                                         \
58         : dpdk headers ;                                                \
59         ./scripts/find-dpdk-contents $(INSTALL_PREFIX)$(ARCH)           \
60          deb/debian/vpp-dpdk-dev.install ;                              \
61                                                                         \
62         : bin package needs startup config ;                            \
63         echo ../../vpp/conf/startup.conf /etc/vpp                       \
64            >> deb/debian/vpp.install ;                                  \
65                                                                         \
66         : and sysctl config ;                                           \
67         echo ../../vpp/conf/80-vpp.conf /etc/sysctl.d                   \
68            >> deb/debian/vpp.install ;                                  \
69                                                                         \
70         : dev package needs a couple of additions ;                     \
71         echo ../build-tool-native/vppapigen/vppapigen /usr/bin          \
72            >> deb/debian/vpp-dev.install ;                              \
73         echo ../../vpp-api/java/jvpp/gen/jvpp_gen.py /usr/bin           \
74            >> deb/debian/vpp-dev.install ;                              \
75         for i in $$(ls ../vpp-api/java/jvpp/gen/jvppgen/*.py); do       \
76            echo ../$${i} /usr/lib/python2.7/dist-packages/jvppgen       \
77                >> deb/debian/vpp-dev.install;                           \
78         done;                                                           \
79                                                                         \
80         : generate changelog;                                           \
81         ./scripts/generate-deb-changelog                                \
82                                                                         \
83         : Go fabricate the actual Debian packages ;                     \
84         (                                                               \
85         cd deb &&                                                       \
86         dpkg-buildpackage -us -uc -b                                    \
87         )
88
89 .PHONY: install-rpm
90 install-rpm: $(patsubst %,%-find-source,$(ROOT_PACKAGES))
91         @$(BUILD_ENV) ;                                                 \
92         set -eu$(BUILD_DEBUG) ;                                         \
93         $(MAKE) -C $(MU_BUILD_ROOT_DIR)                                 \
94             $(patsubst %,%-install,                                     \
95               $(ROOT_PACKAGES)) || exit 1;                              \
96                                                                         \
97         cd rpm ;                                                        \
98         mkdir -p SOURCES ;                                              \
99         if test -f *.tar.gz ; then mv *.tar.gz SOURCES ; fi ;           \
100         rpmbuild -bb --define "_topdir $$PWD" --define                  \
101                 "_install_dir $(INSTALL_PREFIX)$(ARCH)"                 \
102                 --define "_mu_build_root_dir $(MU_BUILD_ROOT_DIR)"      \
103                 vpp.spec ;                                              \
104         mv $$(find RPMS -name \*.rpm -type f) ..
105