aboutsummaryrefslogtreecommitdiffstats
path: root/packages/vpp_ldp.mk
blob: 05e83984f840e240e6dfbd0c362bb4da24a36272 (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
# Copyright (c) 2020 Intel and/or its affiliates.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

vpp_ldp_patch_dir          := $(CURDIR)/vpp_patches
vpp_ldp_src_dir            := $(CURDIR)/vpp
vpp_ldp_install_dir        := $(I)/local
vpp_ldp_pkg_deb_name       := vpp
vpp_ldp_pkg_deb_dir        := $(CURDIR)/vpp/build-root
vpp_ldp_desc               := "ldp vpp"
openssl_install_dir        ?= /usr/local/ssl


define  vpp_ldp_extract_cmds
	@true
endef

define  vpp_ldp_patch_cmds
	@echo "--- ldp vpp patching ---"
	@cd $(vpp_ldp_src_dir); \
		git reset --hard; git clean -f; git checkout $(MAIN_BRANCH); \
		if [ $(_VPP_VER) != $(MAIN_BRANCH) ] ; then \
			echo "--- vpp version: $(_VPP_VER) ---"; \
			if [ $(_VPP_VER) = "2005" ]; then \
				git checkout v20.05; \
			elif [ $(_VPP_VER) = "2001" ]; then \
				git checkout v20.01; \
			fi; \
			git reset --hard; git clean -f; \
		fi
	@for f in $(CURDIR)/vpp_patches/common/*.patch ; do \
		echo Applying patch: $$(basename $$f) ; \
		patch -p1 -d $(vpp_ldp_src_dir) < $$f ; \
	done
	@if [ $(openssl3_enable) -eq 1 ]; then \
		for f in $(CURDIR)/vpp_patches/other/*.patch ; do \
			echo Applying patch: $$(basename $$f) ; \
			patch -p1 -d $(vpp_vcl_src_dir) < $$f ; \
		done; \
		if [ $(_VPP_VER) = $(MAIN_BRANCH) ]; then \
			echo "--- vpp $(MAIN_BRANCH) ---"; \
			for f in $(CURDIR)/vpp_patches/other/$(MAIN_BRANCH)/*; do \
				echo Applying patch: $$(basename $$f) ; \
				patch -p1 -d $(vpp_ldp_src_dir) < $$f ; \
			done; \
		elif [ $(_VPP_VER) = "2005" ]; then \
			echo "--- vpp 20.05 ---"; \
			for f in $(CURDIR)/vpp_patches/other/2005/*; do \
				echo Applying patch: $$(basename $$f) ; \
				patch -p1 -d $(vpp_ldp_src_dir) < $$f ; \
			done; \
		elif [ $(_VPP_VER) = "2001" ]; then \
			echo "--- vpp 20.01 ---"; \
			for f in $(CURDIR)/vpp_patches/other/2001/*.patch ;do \
				echo Applying patch: $$(basename $$f) ; \
				patch -p1 -d $(vpp_ldp_src_dir) < $$f ; \
			done; \
		fi; \
	fi
	@true
endef


define  vpp_ldp_config_cmds
	@true
endef

define  vpp_ldp_build_cmds
	@cd $(vpp_ldp_src_dir); \
	echo "---build : $(vpp_ldp_src_dir)"; \
		if [ $(openssl3_enable) -eq 1 ]; then \
			export OPENSSL_ROOT_DIR=$(openssl_install_dir); \
			export LD_LIBRARY_PATH=$(openssl_install_dir)/lib; \
		fi; \
		$(MAKE) wipe-release; $(MAKE) wipe; \
		cd build-root; $(MAKE) distclean; cd ..; \
		if [ $(debug) -eq 1 ]; then $(MAKE) build; \
		else $(MAKE) build-release; \
		fi
endef

define  vpp_ldp_install_cmds
	@true
endef

define  vpp_ldp_pkg_deb_cmds
	@cd $(vpp_ldp_src_dir); \
	echo "---build deb: $(vpp_ldp_src_dir)"; \
		if [ $(openssl3_enable) -eq 1 ]; then \
			export OPENSSL_ROOT_DIR=$(openssl_install_dir); \
			export LD_LIBRARY_PATH=$(openssl_install_dir)/lib; \
		fi; \
		$(MAKE) pkg-deb;
endef

define  vpp_ldp_pkg_deb_cp_cmds
	@echo "--- move deb to $(CURDIR)/deb-ldp ---"
	@mkdir -p deb-ldp
	@ls deb-ldp/ ;rm -f deb-ldp/*
	@if [ $(openssl3_enable) -eq 1 ]; then \
		mv $(I)/openssl-deb/*.deb .; \
		rm $(B)/.openssl.pkg-deb.ok; \
	fi
	@mv $(vpp_ldp_pkg_deb_dir)/*.deb deb-ldp/.
endef

$(eval $(call package,vpp_ldp))