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