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
43 TITLE:=opkg package manager
44 DEPENDS:=+uclient-fetch +libpthread
45 URL:=http://wiki.openmoko.org/wiki/Opkg
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.
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.
69 define Package/opkg/conffiles
72 /etc/opkg/customfeeds.conf
75 TARGET_CFLAGS += -ffunction-sections -fdata-sections
76 EXTRA_CFLAGS += $(TARGET_CPPFLAGS)
82 --with-opkgetcdir=/etc \
83 --with-opkglockfile=/var/lock/opkg.lock
85 ifndef CONFIG_SIGNED_PACKAGES
86 CONFIGURE_ARGS += --disable-usign
88 ifeq ($(CONFIG_OPKG_SUPPORT_MD5),y)
89 CONFIGURE_ARGS += --enable-md5
91 CONFIGURE_ARGS += --disable-md5
96 DESTDIR="$(PKG_INSTALL_DIR)" \
97 HOST_CPU="$(PKGARCH)" \
98 LDFLAGS="-Wl,--gc-sections" \
100 define Package/opkg/Default/install
101 $(INSTALL_DIR) $(1)/usr/lib/opkg
102 $(INSTALL_DIR) $(1)/bin
103 $(INSTALL_DIR) $(1)/etc/opkg
104 $(INSTALL_DIR) $(1)/etc/uci-defaults
105 $(INSTALL_DATA) ./files/customfeeds.conf $(1)/etc/opkg/customfeeds.conf
106 $(INSTALL_DATA) ./files/opkg$(2).conf $(1)/etc/opkg.conf
107 $(call FeedSourcesAppend,$(1)/etc/opkg/distfeeds.conf)
108 $(VERSION_SED) $(1)/etc/opkg/distfeeds.conf
109 $(INSTALL_BIN) ./files/20_migrate-feeds $(1)/etc/uci-defaults/
110 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/opkg-cl $(1)/bin/opkg
113 define Package/opkg/install
114 $(call Package/opkg/Default/install,$(1),)
115 ifneq ($(CONFIG_SIGNED_PACKAGES),)
116 echo "option check_signature 1" >> $(1)/etc/opkg.conf
119 $(INSTALL_BIN) ./files/opkg-key $(1)/usr/sbin/
122 define Build/InstallDev
123 mkdir -p $(1)/usr/include
124 $(CP) $(PKG_INSTALL_DIR)/usr/include/libopkg $(1)/usr/include/
128 HOST_CONFIGURE_ARGS+= \
132 --with-opkgetcdir=/etc \
133 --with-opkglockfile=/tmp/opkg.lock
136 +$(MAKE) $(HOST_JOBS) -C $(HOST_BUILD_DIR) CC="$(HOSTCC)" all
140 $(INSTALL_BIN) $(HOST_BUILD_DIR)/src/opkg-cl $(STAGING_DIR_HOST)/bin/opkg
143 $(eval $(call BuildPackage,opkg))
144 $(eval $(call HostBuild))