opkg: add build variant with signature support
[openwrt/svn-archive/archive.git] / package / system / opkg / Makefile
1 #
2 # Copyright (C) 2006-2012 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6
7 include $(TOPDIR)/rules.mk
8 include $(INCLUDE_DIR)/kernel.mk
9 include $(INCLUDE_DIR)/version.mk
10
11 PKG_NAME:=opkg
12 PKG_REV:=618
13 PKG_VERSION:=$(PKG_REV)
14 PKG_RELEASE:=4
15
16 PKG_SOURCE_PROTO:=svn
17 PKG_SOURCE_VERSION:=$(PKG_REV)
18 PKG_SOURCE_SUBDIR:=opkg-$(PKG_VERSION)
19 PKG_SOURCE_URL:=http://opkg.googlecode.com/svn/trunk/
20 PKG_SOURCE:=$(PKG_SOURCE_SUBDIR).tar.gz
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:=GPLv2
26 PKG_LICENSE_FILES:=COPYING
27
28 PKG_BUILD_PARALLEL:=1
29 HOST_BUILD_PARALLEL:=1
30 PKG_INSTALL:=1
31
32 include $(INCLUDE_DIR)/package.mk
33 include $(INCLUDE_DIR)/host-build.mk
34
35 define Package/opkg/Default
36 SECTION:=base
37 CATEGORY:=Base system
38 TITLE:=opkg package manager
39 MAINTAINER:=Jo-Philipp Wich <xm@subsignal.org>
40 URL:=http://wiki.openmoko.org/wiki/Opkg
41 endef
42
43 define Package/opkg/Default/description
44 Lightweight package management system
45 opkg is the opkg Package Management System, for handling
46 installation and removal of packages on a system. It can
47 recursively follow dependencies and download all packages
48 necessary to install a particular package.
49
50 opkg knows how to install both .ipk and .deb packages.
51 endef
52
53 define Package/opkg
54 $(call Package/opkg/Default)
55 VARIANT:=unsigned
56 endef
57
58 define Package/opkg/description
59 $(call Package/opkg/Default/description)
60 endef
61
62 define Package/opkg/conffiles
63 /etc/opkg.conf
64 endef
65
66
67 define Package/opkg-smime
68 $(call Package/opkg/Default)
69 TITLE+= (with S/MIME signature support)
70 DEPENDS+=+libopenssl
71 VARIANT:=smime
72 endef
73
74 define Package/opkg-smime/description
75 $(call Package/opkg/Default/description)
76
77 This package allows the Package index to be verified with S/MIME.
78 endef
79
80 Package/opkg-smime/conffiles = $(Package/opkg/conffiles)
81
82 TARGET_CFLAGS += $(if $(CONFIG_GCC_VERSION_4_3)$(CONFIG_GCC_VERSION_4_4),-Wno-array-bounds)
83 TARGET_CFLAGS += -ffunction-sections -fdata-sections
84 EXTRA_CFLAGS += $(TARGET_CPPFLAGS)
85
86 CONFIGURE_ARGS += \
87 --disable-curl \
88 --disable-gpg \
89 --with-opkgetcdir=/etc \
90 --with-opkglockfile=/var/lock/opkg.lock
91
92 ifeq ($(BUILD_VARIANT),smime)
93 CONFIGURE_ARGS += --enable-openssl
94 endif
95
96 MAKE_FLAGS = \
97 CC="$(TARGET_CC)" \
98 DESTDIR="$(PKG_INSTALL_DIR)" \
99 HOST_CPU="$(PKGARCH)" \
100 LDFLAGS="-Wl,--gc-sections" \
101
102 define Package/opkg/Default/install
103 $(INSTALL_DIR) $(1)/usr/lib/opkg
104 $(INSTALL_DIR) $(1)/bin
105 $(INSTALL_DIR) $(1)/etc
106 $(INSTALL_DATA) ./files/opkg$(2).conf $(1)/etc/opkg.conf
107 $(VERSION_SED) $(1)/etc/opkg.conf
108 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/opkg-cl $(1)/bin/opkg
109 endef
110
111 Package/opkg/install = $(call Package/opkg/Default/install,$(1),)
112 Package/opkg-smime/install = $(call Package/opkg/Default/install,$(1),-smime)
113
114
115 define Build/InstallDev
116 mkdir -p $(1)/usr/include
117 $(CP) $(PKG_INSTALL_DIR)/usr/include/libopkg $(1)/usr/include/
118 endef
119
120
121 HOST_CONFIGURE_ARGS+= \
122 --disable-curl \
123 --disable-gpg \
124 --with-opkgetcdir=/etc \
125 --with-opkglockfile=/tmp/opkg.lock
126
127 define Host/Compile
128 +$(MAKE) $(HOST_JOBS) -C $(HOST_BUILD_DIR) CC="$(HOSTCC)" all
129 endef
130
131 define Host/Install
132 $(INSTALL_BIN) $(HOST_BUILD_DIR)/src/opkg-cl $(STAGING_DIR_HOST)/bin/opkg
133 endef
134
135 $(eval $(call BuildPackage,opkg))
136 $(eval $(call BuildPackage,opkg-smime))
137 $(eval $(call HostBuild))