2 # Copyright (C) 2006-2015 OpenWrt.org
3 # Copyright (C) 2016 LEDE Project
5 # This is free software, licensed under the GNU General Public License v2.
6 # See /LICENSE for more information.
8 include $(TOPDIR)/rules.mk
9 include $(INCLUDE_DIR)/kernel.mk
10 include $(INCLUDE_DIR)/version.mk
11 include $(INCLUDE_DIR)/feeds.mk
17 PKG_SOURCE_URL:=http://git.yoctoproject.org/git/opkg
18 PKG_SOURCE_DATE:=2011-04-08
19 PKG_SOURCE_VERSION:=9c97d5ecd795709c8584e972bfdf3aee3a5b846d
20 PKG_MIRROR_HASH:=55e05270f3eb2f3aff5d3791463ce3d13b8197ca7b301cd58e731a249552c48f
21 PKG_BUILD_DIR=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
23 PKG_REMOVE_FILES = autogen.sh aclocal.m4
26 PKG_LICENSE_FILES:=COPYING
28 PKG_MAINTAINER:=Jo-Philipp Wich <jo@mein.io>
30 PKG_FLAGS := nonshared
31 PKG_CONFIG_DEPENDS := CONFIG_SIGNED_PACKAGES
34 HOST_BUILD_PARALLEL:=1
37 include $(INCLUDE_DIR)/package.mk
38 include $(INCLUDE_DIR)/host-build.mk
40 define Package/opkg/Default
43 TITLE:=opkg package manager
44 DEPENDS:=+uclient-fetch
45 URL:=http://wiki.openmoko.org/wiki/Opkg
49 define Package/opkg/Default/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.
56 opkg knows how to install both .ipk and .deb packages.
59 define Package/opkg/config
60 config OPKG_SUPPORT_MD5
63 depends on PACKAGE_opkg
64 prompt "Support reading old md5 hashes."
66 Old opkg used md5s, new uses sha. This options enables understanding both while prefering sha.
70 $(call Package/opkg/Default)
74 define Package/opkg/description
75 $(call Package/opkg/Default/description)
78 define Package/opkg/conffiles
81 /etc/opkg/customfeeds.conf
85 define Package/opkg-smime
86 $(call Package/opkg/Default)
87 TITLE+= (with S/MIME signature support)
88 DEPENDS+=+PACKAGE_opkg-smime:libopenssl
92 define Package/opkg-smime/description
93 $(call Package/opkg/Default/description)
95 This package allows the Package index to be verified with S/MIME.
98 define Package/opkg-smime/config
99 config OPKG_SMIME_SUPPORT_MD5
102 depends on PACKAGE_opkg-smime
103 prompt "Support reading old md5 hashes."
105 Old opkg used md5s, new uses sha. This options enables understanding both while prefering sha.
108 Package/opkg-smime/conffiles = $(Package/opkg/conffiles)
110 TARGET_CFLAGS += -ffunction-sections -fdata-sections
111 EXTRA_CFLAGS += $(TARGET_CPPFLAGS)
117 --with-opkgetcdir=/etc \
118 --with-opkglockfile=/var/lock/opkg.lock
120 ifeq ($(BUILD_VARIANT),smime)
121 CONFIGURE_ARGS += --enable-openssl --disable-usign
122 ifeq ($(CONFIG_OPKG_SMIME_SUPPORT_MD5),y)
123 CONFIGURE_ARGS += --enable-md5
125 CONFIGURE_ARGS += --disable-md5
128 ifndef CONFIG_SIGNED_PACKAGES
129 CONFIGURE_ARGS += --disable-usign
131 ifeq ($(CONFIG_OPKG_SUPPORT_MD5),y)
132 CONFIGURE_ARGS += --enable-md5
134 CONFIGURE_ARGS += --disable-md5
140 DESTDIR="$(PKG_INSTALL_DIR)" \
141 HOST_CPU="$(PKGARCH)" \
142 LDFLAGS="-Wl,--gc-sections" \
144 define Package/opkg/Default/install
145 $(INSTALL_DIR) $(1)/usr/lib/opkg
146 $(INSTALL_DIR) $(1)/bin
147 $(INSTALL_DIR) $(1)/etc/opkg
148 $(INSTALL_DIR) $(1)/etc/uci-defaults
149 $(INSTALL_DATA) ./files/customfeeds.conf $(1)/etc/opkg/customfeeds.conf
150 $(INSTALL_DATA) ./files/opkg$(2).conf $(1)/etc/opkg.conf
151 $(call FeedSourcesAppend,$(1)/etc/opkg/distfeeds.conf)
152 $(VERSION_SED) $(1)/etc/opkg/distfeeds.conf
153 $(INSTALL_BIN) ./files/20_migrate-feeds $(1)/etc/uci-defaults/
154 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/opkg-cl $(1)/bin/opkg
157 define Package/opkg/install
158 $(call Package/opkg/Default/install,$(1),)
159 ifneq ($(CONFIG_SIGNED_PACKAGES),)
160 echo "option check_signature 1" >> $(1)/etc/opkg.conf
163 $(INSTALL_BIN) ./files/opkg-key $(1)/usr/sbin/
166 define Package/opkg-smime/install
167 $(call Package/opkg/Default/install,$(1),-smime)
168 $(INSTALL_DIR) $(1)/etc/ssl/certs
169 $(if $(CONFIG_OPKGSMIME_CERT),$(INSTALL_DATA) $(call qstrip,$(CONFIG_OPKGSMIME_CERT)) $(1)/etc/ssl/certs/opkg.pem,)
172 define Build/InstallDev
173 mkdir -p $(1)/usr/include
174 $(CP) $(PKG_INSTALL_DIR)/usr/include/libopkg $(1)/usr/include/
178 HOST_CONFIGURE_ARGS+= \
182 --with-opkgetcdir=/etc \
183 --with-opkglockfile=/tmp/opkg.lock
186 +$(MAKE) $(HOST_JOBS) -C $(HOST_BUILD_DIR) CC="$(HOSTCC)" all
190 $(INSTALL_BIN) $(HOST_BUILD_DIR)/src/opkg-cl $(STAGING_DIR_HOST)/bin/opkg
193 $(eval $(call BuildPackage,opkg))
194 $(eval $(call BuildPackage,opkg-smime))
195 $(eval $(call HostBuild))