2 # Linux-specific packaging script
5 ifndef OPENPILOT_IS_COOL
6 $(error Top level Makefile must be used to build this target
)
9 FW_DIR
:= $(PACKAGE_DIR
)/firmware
11 # Update this number for every formal release. The Deb packaging system relies on this to know to update a
12 # package or not. Otherwise, the user has to uninstall first.
13 # Until we do that, package name does NOT include $(VERNUM) and uses $(PACKAGE_LBL) only
15 VERSION_FULL
:= $(VERNUM
)-$(PACKAGE_LBL
)
16 DEB_BUILD_DIR
:= $(ROOT_DIR
)/debian
18 SED_DATE_STRG
= $(shell date
-R
)
19 SED_SCRIPT
= s
/<VERSION
>/$(VERNUM
)/;s
/<DATE
>/$(SED_DATE_STRG
)/
21 DEB_CFG_CMN
:= $(ROOT_DIR
)/package
/linux
/deb_common
22 DEB_CFG_I386_DIR
:= $(ROOT_DIR
)/package
/linux
/deb_i386
23 DEB_CFG_AMD64_DIR
:= $(ROOT_DIR
)/package
/linux
/deb_amd64
24 DEB_CFG_CMN_FILES
:= $(shell ls
$(DEB_CFG_CMN
))
25 DEB_CFG_I386_FILES
:= $(shell ls
$(DEB_CFG_I386_DIR
))
26 DEB_CFG_AMD64_FILES
:= $(shell ls
$(DEB_CFG_AMD64_DIR
))
29 DEB_MACHINE_DIR
:= $(DEB_CFG_AMD64_DIR
)
30 DEB_MACHINE_FILES
:= $(DEB_CFG_AMD64_FILES
)
31 MACHINE_TYPE
:= $(shell uname
-m
)
32 ifneq ($(MACHINE_TYPE
), x86_64
)
34 DEB_MACHINE_DIR
:= $(DEB_CFG_I386_DIR
)
35 DEB_MACHINE_FILES
:= $(DEB_CFG_I386_FILES
)
37 DEB_PACKAGE_NAME
:= openpilot_
$(VERNUM
)_
$(DEB_PLATFORM
)
38 FULL_PACKAGE_NAME
:= $(PACKAGE_NAME
)$(PACKAGE_SEP
)$(PACKAGE_LBL
)$(PACKAGE_SEP
)$(DEB_PLATFORM
)
40 ALL_DEB_FILES
= $(foreach f
, $(DEB_CFG_CMN_FILES
), $(DEB_BUILD_DIR
)/$(f
))
41 ALL_DEB_FILES
+= $(foreach f
, $(DEB_MACHINE_FILES
), $(DEB_BUILD_DIR
)/$(f
))
44 package
: $(ALL_DEB_FILES
)
45 $(V1
) echo
"Building Linux package, please wait..."
46 $(V1
) mkdir
-p
$(DEB_BUILD_DIR
)
47 $(V1
)$(shell echo
$(FW_DIR
) > $(BUILD_DIR
)/package_dir
)
48 $(V1
)sed
-i
-e
"$(SED_SCRIPT)" $(DEB_BUILD_DIR
)/changelog
49 $(V1
) cd ..
&& dpkg-buildpackage
-b
-us
-uc
50 $(V1
) mv
$(ROOT_DIR
)/..
/$(DEB_PACKAGE_NAME
).deb
$(BUILD_DIR
)/$(FULL_PACKAGE_NAME
).deb
51 $(V1
) mv
$(ROOT_DIR
)/..
/$(DEB_PACKAGE_NAME
).changes
$(BUILD_DIR
)/$(FULL_PACKAGE_NAME
).changes
52 $(V1
) rm -rf
$(DEB_BUILD_DIR
)
54 define CP_DEB_FILES_TEMPLATE
61 $(foreach cpfile
, $(DEB_CFG_CMN_FILES
), $(eval
$(call CP_DEB_FILES_TEMPLATE
,$(cpfile
),$(DEB_BUILD_DIR
),$(DEB_CFG_CMN
))))
62 $(foreach cpfile
, $(DEB_MACHINE_FILES
), $(eval
$(call CP_DEB_FILES_TEMPLATE
,$(cpfile
),$(DEB_BUILD_DIR
),$(DEB_MACHINE_DIR
))))