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
22 PKG_REMOVE_FILES = autogen.sh aclocal.m4
25 PKG_LICENSE_FILES:=COPYING
27 PKG_MAINTAINER:=Jo-Philipp Wich <jo@mein.io>
29 PKG_FLAGS := nonshared
30 PKG_CONFIG_DEPENDS := CONFIG_SIGNED_PACKAGES
33 HOST_BUILD_PARALLEL:=1
36 include $(INCLUDE_DIR)/package.mk
37 include $(INCLUDE_DIR)/host-build.mk
42 TITLE:=opkg package manager
43 DEPENDS:=+uclient-fetch +libpthread
44 URL:=http://wiki.openmoko.org/wiki/Opkg
48 define Package/opkg/description
49 Lightweight package management system
50 opkg is the opkg Package Management System, for handling
51 installation and removal of packages on a system. It can
52 recursively follow dependencies and download all packages
53 necessary to install a particular package.
55 opkg knows how to install both .ipk and .deb packages.
58 define Package/opkg/config
59 config OPKG_SUPPORT_MD5
62 depends on PACKAGE_opkg
63 prompt "Support reading old md5 hashes."
65 Old opkg used md5s, new uses sha. This options enables understanding both while prefering sha.
68 define Package/opkg/conffiles
71 /etc/opkg/customfeeds.conf
74 TARGET_CFLAGS += -ffunction-sections -fdata-sections
75 EXTRA_CFLAGS += $(TARGET_CPPFLAGS)
81 --with-opkgetcdir=/etc \
82 --with-opkglockfile=/var/lock/opkg.lock
84 ifndef CONFIG_SIGNED_PACKAGES
85 CONFIGURE_ARGS += --disable-usign
87 ifeq ($(CONFIG_OPKG_SUPPORT_MD5),y)
88 CONFIGURE_ARGS += --enable-md5
90 CONFIGURE_ARGS += --disable-md5
95 DESTDIR="$(PKG_INSTALL_DIR)" \
96 HOST_CPU="$(PKGARCH)" \
97 LDFLAGS="-Wl,--gc-sections" \
99 define Package/opkg/Default/install
100 $(INSTALL_DIR) $(1)/usr/lib/opkg
101 $(INSTALL_DIR) $(1)/bin
102 $(INSTALL_DIR) $(1)/etc/opkg
103 $(INSTALL_DIR) $(1)/etc/uci-defaults
104 $(INSTALL_DATA) ./files/customfeeds.conf $(1)/etc/opkg/customfeeds.conf
105 $(INSTALL_DATA) ./files/opkg$(2).conf $(1)/etc/opkg.conf
106 $(call FeedSourcesAppend,$(1)/etc/opkg/distfeeds.conf)
107 $(VERSION_SED) $(1)/etc/opkg/distfeeds.conf
108 $(INSTALL_BIN) ./files/20_migrate-feeds $(1)/etc/uci-defaults/
109 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/opkg-cl $(1)/bin/opkg
112 define Package/opkg/install
113 $(call Package/opkg/Default/install,$(1),)
114 ifneq ($(CONFIG_SIGNED_PACKAGES),)
115 echo "option check_signature 1" >> $(1)/etc/opkg.conf
118 $(INSTALL_BIN) ./files/opkg-key $(1)/usr/sbin/
121 define Build/InstallDev
122 mkdir -p $(1)/usr/include
123 $(CP) $(PKG_INSTALL_DIR)/usr/include/libopkg $(1)/usr/include/
127 HOST_CONFIGURE_ARGS+= \
131 --with-opkgetcdir=/etc \
132 --with-opkglockfile=/tmp/opkg.lock
135 +$(MAKE) $(HOST_JOBS) -C $(HOST_BUILD_DIR) CC="$(HOSTCC)" all
139 $(INSTALL_BIN) $(HOST_BUILD_DIR)/src/opkg-cl $(STAGING_DIR_HOST)/bin/opkg
142 $(eval $(call BuildPackage,opkg))
143 $(eval $(call HostBuild))