opkg: drop S/MIME support
[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_RELEASE:=16
15
16 PKG_SOURCE_PROTO:=git
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)
22 PKG_FIXUP:=autoreconf
23 PKG_REMOVE_FILES = autogen.sh aclocal.m4
24
25 PKG_LICENSE:=GPL-2.0
26 PKG_LICENSE_FILES:=COPYING
27
28 PKG_MAINTAINER:=Jo-Philipp Wich <jo@mein.io>
29
30 PKG_FLAGS := nonshared
31 PKG_CONFIG_DEPENDS := CONFIG_SIGNED_PACKAGES
32
33 PKG_BUILD_PARALLEL:=1
34 HOST_BUILD_PARALLEL:=1
35 PKG_INSTALL:=1
36
37 include $(INCLUDE_DIR)/package.mk
38 include $(INCLUDE_DIR)/host-build.mk
39
40 define Package/opkg
41 SECTION:=base
42 CATEGORY:=Base system
43 TITLE:=opkg package manager
44 DEPENDS:=+uclient-fetch +libpthread
45 URL:=http://wiki.openmoko.org/wiki/Opkg
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/config
60 config OPKG_SUPPORT_MD5
61 bool
62 default n
63 depends on PACKAGE_opkg
64 prompt "Support reading old md5 hashes."
65 help
66 Old opkg used md5s, new uses sha. This options enables understanding both while prefering sha.
67 endef
68
69 define Package/opkg/conffiles
70 /etc/opkg.conf
71 /etc/opkg/keys/
72 /etc/opkg/customfeeds.conf
73 endef
74
75 TARGET_CFLAGS += -ffunction-sections -fdata-sections
76 EXTRA_CFLAGS += $(TARGET_CPPFLAGS)
77
78 CONFIGURE_ARGS += \
79 --disable-curl \
80 --disable-gpg \
81 --enable-sha256 \
82 --with-opkgetcdir=/etc \
83 --with-opkglockfile=/var/lock/opkg.lock
84
85 ifndef CONFIG_SIGNED_PACKAGES
86 CONFIGURE_ARGS += --disable-usign
87 endif
88 ifeq ($(CONFIG_OPKG_SUPPORT_MD5),y)
89 CONFIGURE_ARGS += --enable-md5
90 else
91 CONFIGURE_ARGS += --disable-md5
92 endif
93
94 MAKE_FLAGS = \
95 CC="$(TARGET_CC)" \
96 DESTDIR="$(PKG_INSTALL_DIR)" \
97 HOST_CPU="$(PKGARCH)" \
98 LDFLAGS="-Wl,--gc-sections" \
99
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
111 endef
112
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
117 endif
118 mkdir $(1)/usr/sbin
119 $(INSTALL_BIN) ./files/opkg-key $(1)/usr/sbin/
120 endef
121
122 define Build/InstallDev
123 mkdir -p $(1)/usr/include
124 $(CP) $(PKG_INSTALL_DIR)/usr/include/libopkg $(1)/usr/include/
125 endef
126
127
128 HOST_CONFIGURE_ARGS+= \
129 --disable-curl \
130 --disable-gpg \
131 --enable-sha256 \
132 --with-opkgetcdir=/etc \
133 --with-opkglockfile=/tmp/opkg.lock
134
135 define Host/Compile
136 +$(MAKE) $(HOST_JOBS) -C $(HOST_BUILD_DIR) CC="$(HOSTCC)" all
137 endef
138
139 define Host/Install
140 $(INSTALL_BIN) $(HOST_BUILD_DIR)/src/opkg-cl $(STAGING_DIR_HOST)/bin/opkg
141 endef
142
143 $(eval $(call BuildPackage,opkg))
144 $(eval $(call HostBuild))