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