treewide: Add extra CPE identifier
[openwrt/openwrt.git] / package / system / opkg / Makefile
1 #
2 # Copyright (C) 2006-2015 OpenWrt.org
3 # Copyright (C) 2016-2017 LEDE Project
4 #
5 # This is free software, licensed under the GNU General Public License v2.
6 # See /LICENSE for more information.
7
8 include $(TOPDIR)/rules.mk
9 include $(INCLUDE_DIR)/kernel.mk
10
11 PKG_NAME:=opkg
12 PKG_RELEASE:=1
13 PKG_FLAGS:=essential
14
15 PKG_SOURCE_PROTO:=git
16 PKG_SOURCE_URL:=https://git.openwrt.org/project/opkg-lede.git
17 PKG_SOURCE_DATE:=2021-01-31
18 PKG_SOURCE_VERSION:=c5dccea956b8be14eabf6ff69b331a3e9ac36749
19 PKG_MIRROR_HASH:=fdf42d4ecf66ebc1aded54fa29c3eb41a0e08c2c65da56b661ad1cfb275dd548
20
21 PKG_LICENSE:=GPL-2.0
22 PKG_LICENSE_FILES:=COPYING
23
24 PKG_MAINTAINER:=Jo-Philipp Wich <jo@mein.io>
25
26 # Extend depends from version.mk
27 PKG_CONFIG_DEPENDS += \
28 CONFIG_SIGNATURE_CHECK \
29 CONFIG_TARGET_INIT_PATH
30
31 PKG_BUILD_PARALLEL:=1
32 HOST_BUILD_PARALLEL:=1
33 PKG_INSTALL:=1
34
35 HOST_BUILD_DEPENDS:=libubox/host
36
37 include $(INCLUDE_DIR)/package.mk
38 include $(INCLUDE_DIR)/host-build.mk
39 include $(INCLUDE_DIR)/cmake.mk
40
41 define Package/opkg
42 SECTION:=base
43 CATEGORY:=Base system
44 TITLE:=opkg package manager
45 DEPENDS:=+uclient-fetch +libpthread +libubox
46 URL:=$(PKG_SOURCE_URL)
47 MENU:=1
48 endef
49
50 define Package/opkg/description
51 Lightweight package management system
52 opkg is the opkg Package Management System, for handling
53 installation and removal of packages on a system. It can
54 recursively follow dependencies and download all packages
55 necessary to install a particular package.
56
57 opkg knows how to install both .ipk and .deb packages.
58 endef
59
60 define Package/opkg/conffiles
61 /etc/opkg.conf
62 /etc/opkg/keys/
63 /etc/opkg/customfeeds.conf
64 endef
65
66 TARGET_CFLAGS += -ffunction-sections -fdata-sections
67 EXTRA_CFLAGS += $(TARGET_CPPFLAGS)
68
69 CMAKE_OPTIONS += \
70 -DBUILD_TESTS=OFF \
71 -DHOST_CPU=$(PKGARCH) \
72 -DPATH_SPEC="$(TARGET_INIT_PATH)" \
73 -DVERSION="$(PKG_SOURCE_VERSION) ($(PKG_SOURCE_DATE))"
74
75 CMAKE_HOST_OPTIONS += \
76 -DSTATIC_UBOX=ON \
77 -DBUILD_TESTS=OFF \
78 -DHOST_CPU=$(PKGARCH) \
79 -DLOCK_FILE=/tmp/opkg.lock \
80 -DVERSION="$(PKG_SOURCE_VERSION) ($(PKG_SOURCE_DATE))"
81
82 define Package/opkg/install
83 $(INSTALL_DIR) $(1)/usr/lib/opkg
84 $(INSTALL_DIR) $(1)/bin
85 $(INSTALL_DIR) $(1)/etc/opkg
86 $(INSTALL_DIR) $(1)/etc/uci-defaults
87 $(INSTALL_DATA) ./files/customfeeds.conf $(1)/etc/opkg/customfeeds.conf
88 $(INSTALL_DATA) ./files/opkg$(2).conf $(1)/etc/opkg.conf
89 $(INSTALL_BIN) ./files/20_migrate-feeds $(1)/etc/uci-defaults/
90 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/opkg-cl $(1)/bin/opkg
91 ifneq ($(CONFIG_SIGNATURE_CHECK),)
92 echo "option check_signature" >> $(1)/etc/opkg.conf
93 endif
94 $(INSTALL_DIR) $(1)/usr/sbin
95 $(INSTALL_BIN) ./files/opkg-key $(1)/usr/sbin/
96 endef
97
98 define Host/Install
99 $(INSTALL_BIN) $(HOST_BUILD_DIR)/src/opkg-cl $(STAGING_DIR_HOST)/bin/opkg
100 endef
101
102 $(eval $(call BuildPackage,opkg))
103 $(eval $(call HostBuild))