499de217cc537c7c279fb2c126de2c2207621865
[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 include $(INCLUDE_DIR)/version.mk
11 include $(INCLUDE_DIR)/feeds.mk
12
13 PKG_NAME:=opkg
14 PKG_RELEASE:=1
15 PKG_FLAGS:=essential
16
17 PKG_SOURCE_PROTO:=git
18 PKG_SOURCE_URL:=https://git.lede-project.org/project/opkg-lede.git
19 PKG_SOURCE_DATE:=2017-07-28
20 PKG_SOURCE_VERSION:=4bd8601ebd95c130e504cc724b0c5eb163050982
21 PKG_MIRROR_HASH:=adb2d610185a83fb630ccd3f0c80cb8acfd89260e0a5e598aadb8c8f0d903cf5
22
23 PKG_LICENSE:=GPL-2.0
24 PKG_LICENSE_FILES:=COPYING
25
26 PKG_MAINTAINER:=Jo-Philipp Wich <jo@mein.io>
27
28 PKG_FLAGS := nonshared
29
30 PKG_CONFIG_DEPENDS := \
31 CONFIG_SIGNED_PACKAGES \
32 CONFIG_TARGET_INIT_PATH \
33 CONFIG_PER_FEED_REPO \
34 CONFIG_PER_FEED_REPO_ADD_DISABLED \
35 CONFIG_PER_FEED_REPO_ADD_COMMENTED \
36 $(foreach feed,$(FEEDS_INSTALLED),CONFIG_FEED_$(feed))
37
38 PKG_BUILD_PARALLEL:=1
39 HOST_BUILD_PARALLEL:=1
40 PKG_INSTALL:=1
41
42 HOST_BUILD_DEPENDS:=libubox/host
43
44 include $(INCLUDE_DIR)/package.mk
45 include $(INCLUDE_DIR)/host-build.mk
46 include $(INCLUDE_DIR)/cmake.mk
47
48 define Package/opkg
49 SECTION:=base
50 CATEGORY:=Base system
51 TITLE:=opkg package manager
52 DEPENDS:=+uclient-fetch +libpthread +libubox
53 URL:=https://git.lede-project.org/?p=project/opkg-lede.git
54 MENU:=1
55 endef
56
57 define Package/opkg/description
58 Lightweight package management system
59 opkg is the opkg Package Management System, for handling
60 installation and removal of packages on a system. It can
61 recursively follow dependencies and download all packages
62 necessary to install a particular package.
63
64 opkg knows how to install both .ipk and .deb packages.
65 endef
66
67 define Package/opkg/conffiles
68 /etc/opkg.conf
69 /etc/opkg/keys/
70 /etc/opkg/customfeeds.conf
71 endef
72
73 TARGET_CFLAGS += -ffunction-sections -fdata-sections
74 EXTRA_CFLAGS += $(TARGET_CPPFLAGS)
75
76 CMAKE_OPTIONS += \
77 -DBUILD_TESTS=OFF \
78 -DHOST_CPU=$(PKGARCH) \
79 -DPATH_SPEC="$(TARGET_INIT_PATH)" \
80 -DVERSION="$(PKG_SOURCE_VERSION) ($(PKG_SOURCE_DATE))"
81
82 CMAKE_HOST_OPTIONS += \
83 -DSTATIC_UBOX=ON \
84 -DBUILD_TESTS=OFF \
85 -DHOST_CPU=$(PKGARCH) \
86 -DLOCK_FILE=/tmp/opkg.lock \
87 -DVERSION="$(PKG_SOURCE_VERSION) ($(PKG_SOURCE_DATE))"
88
89 define Package/opkg/install
90 $(INSTALL_DIR) $(1)/usr/lib/opkg
91 $(INSTALL_DIR) $(1)/bin
92 $(INSTALL_DIR) $(1)/etc/opkg
93 $(INSTALL_DIR) $(1)/etc/uci-defaults
94 $(INSTALL_DATA) ./files/customfeeds.conf $(1)/etc/opkg/customfeeds.conf
95 $(INSTALL_DATA) ./files/opkg$(2).conf $(1)/etc/opkg.conf
96 $(call FeedSourcesAppend,$(1)/etc/opkg/distfeeds.conf)
97 $(VERSION_SED) $(1)/etc/opkg/distfeeds.conf
98 $(INSTALL_BIN) ./files/20_migrate-feeds $(1)/etc/uci-defaults/
99 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/opkg-cl $(1)/bin/opkg
100 ifneq ($(CONFIG_SIGNED_PACKAGES),)
101 echo "option check_signature 1" >> $(1)/etc/opkg.conf
102 endif
103 $(INSTALL_DIR) $(1)/usr/sbin
104 $(INSTALL_BIN) ./files/opkg-key $(1)/usr/sbin/
105 endef
106
107 define Host/Install
108 $(INSTALL_BIN) $(HOST_BUILD_DIR)/src/opkg-cl $(STAGING_DIR_HOST)/bin/opkg
109 endef
110
111 $(eval $(call BuildPackage,opkg))
112 $(eval $(call HostBuild))