Revert mirror hash fixes
[openwrt/openwrt.git] / package / system / opkg / Makefile
1 #
2 # Copyright (C) 2006-2015 OpenWrt.org
3 # Copyright (C) 2016 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_REV:=9c97d5ecd795709c8584e972bfdf3aee3a5b846d
15 PKG_VERSION:=$(PKG_REV)
16 PKG_RELEASE:=15
17
18 PKG_SOURCE_PROTO:=git
19 PKG_SOURCE_VERSION:=$(PKG_REV)
20 PKG_SOURCE_SUBDIR:=opkg-$(PKG_VERSION)
21 PKG_SOURCE_URL:=http://git.yoctoproject.org/git/opkg
22 PKG_SOURCE:=$(PKG_SOURCE_SUBDIR).tar.xz
23 PKG_MIRROR_HASH:=7accfabfb5cc1966b038b40130a50f3bbb4bdff4273150e9394c1ea8d7111d4e
24 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
25 PKG_FIXUP:=autoreconf
26 PKG_REMOVE_FILES = autogen.sh aclocal.m4
27
28 PKG_LICENSE:=GPL-2.0
29 PKG_LICENSE_FILES:=COPYING
30
31 PKG_MAINTAINER:=Jo-Philipp Wich <jo@mein.io>
32
33 PKG_FLAGS := nonshared
34 PKG_CONFIG_DEPENDS := CONFIG_SIGNED_PACKAGES
35
36 PKG_BUILD_PARALLEL:=1
37 HOST_BUILD_PARALLEL:=1
38 PKG_INSTALL:=1
39
40 include $(INCLUDE_DIR)/package.mk
41 include $(INCLUDE_DIR)/host-build.mk
42
43 define Package/opkg/Default
44 SECTION:=base
45 CATEGORY:=Base system
46 TITLE:=opkg package manager
47 DEPENDS:=+uclient-fetch
48 URL:=http://wiki.openmoko.org/wiki/Opkg
49 MENU:=1
50 endef
51
52 define Package/opkg/Default/description
53 Lightweight package management system
54 opkg is the opkg Package Management System, for handling
55 installation and removal of packages on a system. It can
56 recursively follow dependencies and download all packages
57 necessary to install a particular package.
58
59 opkg knows how to install both .ipk and .deb packages.
60 endef
61
62 define Package/opkg/config
63 config OPKG_SUPPORT_MD5
64 bool
65 default n
66 depends on PACKAGE_opkg
67 prompt "Support reading old md5 hashes."
68 help
69 Old opkg used md5s, new uses sha. This options enables understanding both while prefering sha.
70 endef
71
72 define Package/opkg
73 $(call Package/opkg/Default)
74 VARIANT:=unsigned
75 endef
76
77 define Package/opkg/description
78 $(call Package/opkg/Default/description)
79 endef
80
81 define Package/opkg/conffiles
82 /etc/opkg.conf
83 /etc/opkg/keys/
84 /etc/opkg/customfeeds.conf
85 endef
86
87
88 define Package/opkg-smime
89 $(call Package/opkg/Default)
90 TITLE+= (with S/MIME signature support)
91 DEPENDS+=+PACKAGE_opkg-smime:libopenssl
92 VARIANT:=smime
93 endef
94
95 define Package/opkg-smime/description
96 $(call Package/opkg/Default/description)
97
98 This package allows the Package index to be verified with S/MIME.
99 endef
100
101 define Package/opkg-smime/config
102 config OPKG_SMIME_SUPPORT_MD5
103 bool
104 default n
105 depends on PACKAGE_opkg-smime
106 prompt "Support reading old md5 hashes."
107 help
108 Old opkg used md5s, new uses sha. This options enables understanding both while prefering sha.
109 endef
110
111 Package/opkg-smime/conffiles = $(Package/opkg/conffiles)
112
113 TARGET_CFLAGS += -ffunction-sections -fdata-sections
114 EXTRA_CFLAGS += $(TARGET_CPPFLAGS)
115
116 CONFIGURE_ARGS += \
117 --disable-curl \
118 --disable-gpg \
119 --enable-sha256 \
120 --with-opkgetcdir=/etc \
121 --with-opkglockfile=/var/lock/opkg.lock
122
123 ifeq ($(BUILD_VARIANT),smime)
124 CONFIGURE_ARGS += --enable-openssl --disable-usign
125 ifeq ($(CONFIG_OPKG_SMIME_SUPPORT_MD5),y)
126 CONFIGURE_ARGS += --enable-md5
127 else
128 CONFIGURE_ARGS += --disable-md5
129 endif
130 else
131 ifndef CONFIG_SIGNED_PACKAGES
132 CONFIGURE_ARGS += --disable-usign
133 endif
134 ifeq ($(CONFIG_OPKG_SUPPORT_MD5),y)
135 CONFIGURE_ARGS += --enable-md5
136 else
137 CONFIGURE_ARGS += --disable-md5
138 endif
139 endif
140
141 MAKE_FLAGS = \
142 CC="$(TARGET_CC)" \
143 DESTDIR="$(PKG_INSTALL_DIR)" \
144 HOST_CPU="$(PKGARCH)" \
145 LDFLAGS="-Wl,--gc-sections" \
146
147 define Package/opkg/Default/install
148 $(INSTALL_DIR) $(1)/usr/lib/opkg
149 $(INSTALL_DIR) $(1)/bin
150 $(INSTALL_DIR) $(1)/etc/opkg
151 $(INSTALL_DIR) $(1)/etc/uci-defaults
152 $(INSTALL_DATA) ./files/customfeeds.conf $(1)/etc/opkg/customfeeds.conf
153 $(INSTALL_DATA) ./files/opkg$(2).conf $(1)/etc/opkg.conf
154 $(call FeedSourcesAppend,$(1)/etc/opkg/distfeeds.conf)
155 $(VERSION_SED) $(1)/etc/opkg/distfeeds.conf
156 $(INSTALL_BIN) ./files/20_migrate-feeds $(1)/etc/uci-defaults/
157 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/opkg-cl $(1)/bin/opkg
158 endef
159
160 define Package/opkg/install
161 $(call Package/opkg/Default/install,$(1),)
162 ifneq ($(CONFIG_SIGNED_PACKAGES),)
163 echo "option check_signature 1" >> $(1)/etc/opkg.conf
164 endif
165 mkdir $(1)/usr/sbin
166 $(INSTALL_BIN) ./files/opkg-key $(1)/usr/sbin/
167 endef
168
169 define Package/opkg-smime/install
170 $(call Package/opkg/Default/install,$(1),-smime)
171 $(INSTALL_DIR) $(1)/etc/ssl/certs
172 $(if $(CONFIG_OPKGSMIME_CERT),$(INSTALL_DATA) $(call qstrip,$(CONFIG_OPKGSMIME_CERT)) $(1)/etc/ssl/certs/opkg.pem,)
173 endef
174
175 define Build/InstallDev
176 mkdir -p $(1)/usr/include
177 $(CP) $(PKG_INSTALL_DIR)/usr/include/libopkg $(1)/usr/include/
178 endef
179
180
181 HOST_CONFIGURE_ARGS+= \
182 --disable-curl \
183 --disable-gpg \
184 --enable-sha256 \
185 --with-opkgetcdir=/etc \
186 --with-opkglockfile=/tmp/opkg.lock
187
188 define Host/Compile
189 +$(MAKE) $(HOST_JOBS) -C $(HOST_BUILD_DIR) CC="$(HOSTCC)" all
190 endef
191
192 define Host/Install
193 $(INSTALL_BIN) $(HOST_BUILD_DIR)/src/opkg-cl $(STAGING_DIR_HOST)/bin/opkg
194 endef
195
196 $(eval $(call BuildPackage,opkg))
197 $(eval $(call BuildPackage,opkg-smime))
198 $(eval $(call HostBuild))