Makefile 4.32 KB
Newer Older
1
#
2
# Copyright (C) 2006-2014 OpenWrt.org
3
4
5
6
7
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.

include $(TOPDIR)/rules.mk
8
include $(INCLUDE_DIR)/kernel.mk
9
include $(INCLUDE_DIR)/version.mk
10
include $(INCLUDE_DIR)/feeds.mk
11
12

PKG_NAME:=opkg
13
PKG_REV:=9c97d5ecd795709c8584e972bfdf3aee3a5b846d
14
PKG_VERSION:=$(PKG_REV)
15
PKG_RELEASE:=7
16

17
PKG_SOURCE_PROTO:=git
18
19
PKG_SOURCE_VERSION:=$(PKG_REV)
PKG_SOURCE_SUBDIR:=opkg-$(PKG_VERSION)
20
PKG_SOURCE_URL:=http://git.yoctoproject.org/git/opkg
21
PKG_SOURCE:=$(PKG_SOURCE_SUBDIR).tar.gz
22
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
23
PKG_FIXUP:=autoreconf
24
PKG_REMOVE_FILES = autogen.sh aclocal.m4
25

John Crispin's avatar
John Crispin committed
26
PKG_LICENSE:=GPL-2.0
27
28
PKG_LICENSE_FILES:=COPYING

29
30
PKG_CONFIG_DEPENDS := CONFIG_SIGNED_PACKAGES

31
32
33
34
PKG_BUILD_PARALLEL:=1
HOST_BUILD_PARALLEL:=1
PKG_INSTALL:=1

35
include $(INCLUDE_DIR)/package.mk
36
include $(INCLUDE_DIR)/host-build.mk
37

38
define Package/opkg/Default
39
40
  SECTION:=base
  CATEGORY:=Base system
41
  TITLE:=opkg package manager
Jo-Philipp Wich's avatar
Jo-Philipp Wich committed
42
  MAINTAINER:=Jo-Philipp Wich <xm@subsignal.org>
43
44
45
  URL:=http://wiki.openmoko.org/wiki/Opkg
endef

46
define Package/opkg/Default/description
47
48
49
50
51
52
53
54
55
  Lightweight package management system
  opkg is the opkg Package Management System, for handling
  installation and removal of packages on a system. It can
  recursively follow dependencies and download all packages
  necessary to install a particular package.

  opkg knows how to install both .ipk and .deb packages.
endef

56
57
58
59
60
61
62
63
64
define Package/opkg
  $(call Package/opkg/Default)
  VARIANT:=unsigned
endef

define Package/opkg/description
  $(call Package/opkg/Default/description)
endef

65
define Package/opkg/conffiles
66
/etc/opkg.conf
67
68
endef

69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84

define Package/opkg-smime
  $(call Package/opkg/Default)
  TITLE+= (with S/MIME signature support)
  DEPENDS+=+libopenssl
  VARIANT:=smime
endef

define Package/opkg-smime/description
  $(call Package/opkg/Default/description)

  This package allows the Package index to be verified with S/MIME.
endef

Package/opkg-smime/conffiles = $(Package/opkg/conffiles)

85
TARGET_CFLAGS += $(if $(CONFIG_GCC_VERSION_4_3)$(CONFIG_GCC_VERSION_4_4),-Wno-array-bounds)
86
TARGET_CFLAGS += -ffunction-sections -fdata-sections
87
EXTRA_CFLAGS += $(TARGET_CPPFLAGS)
88
89
90
91

CONFIGURE_ARGS += \
	--disable-curl \
	--disable-gpg \
92
93
	--with-opkgetcdir=/etc \
	--with-opkglockfile=/var/lock/opkg.lock
94

95
ifeq ($(BUILD_VARIANT),smime)
96
97
98
99
100
	CONFIGURE_ARGS += --enable-openssl --enable-sha256 --disable-usign
else
  ifndef CONFIG_SIGNED_PACKAGES
    CONFIGURE_ARGS += --disable-usign
  endif
101
102
endif

103
MAKE_FLAGS = \
104
		CC="$(TARGET_CC)" \
105
		DESTDIR="$(PKG_INSTALL_DIR)" \
106
		HOST_CPU="$(PKGARCH)" \
107
		LDFLAGS="-Wl,--gc-sections" \
108

109
define Package/opkg/Default/install
110
	$(INSTALL_DIR) $(1)/usr/lib/opkg
111
	$(INSTALL_DIR) $(1)/bin
112
	$(INSTALL_DIR) $(1)/etc
113
	$(INSTALL_DATA) ./files/opkg$(2).conf $(1)/etc/opkg.conf
114
115
116
  ifneq ($(CONFIG_SIGNED_PACKAGES),)
	echo "option check_signature 1" >> $(1)/etc/opkg.conf
  endif
117
118
119
120
121
122
  ifeq ($(CONFIG_PER_FEED_REPO),)
	echo "src/gz %n %U" >> $(1)/etc/opkg.conf
  else
	for d in base $(FEEDS_ENABLED); do \
		echo "src/gz %n_$$$$d %U/$$$$d" >> $(1)/etc/opkg.conf; \
	done
123
124
    ifneq ($(CONFIG_PER_FEED_REPO_ADD_DISABLED),)
	for d in $(FEEDS_DISABLED); do \
125
		echo "$(if $(CONFIG_PER_FEED_REPO_ADD_COMMENTED),# )src/gz %n_$$$$d %U/$$$$d" >> $(1)/etc/opkg.conf; \
126
127
	done
    endif
128
  endif
129
	$(VERSION_SED) $(1)/etc/opkg.conf
130
131
132
	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/opkg-cl $(1)/bin/opkg
endef

133
134
135
136
137
define Package/opkg/install
	$(call Package/opkg/Default/install,$(1),)
	mkdir $(1)/usr/sbin
	$(INSTALL_BIN) ./files/opkg-key $(1)/usr/sbin/
endef
138

139
140
141
142
143
define Package/opkg-smime/install
	$(call Package/opkg/Default/install,$(1),-smime)
	$(INSTALL_DIR) $(1)/etc/ssl/certs
	$(if $(CONFIG_OPKGSMIME_CERT),$(INSTALL_DATA) $(call qstrip,$(CONFIG_OPKGSMIME_CERT)) $(1)/etc/ssl/certs/opkg.pem,)
endef
144

145
146
147
148
149
define Build/InstallDev
	mkdir -p $(1)/usr/include
	$(CP) $(PKG_INSTALL_DIR)/usr/include/libopkg $(1)/usr/include/
endef

150
151
152
153
154
155
156
157

HOST_CONFIGURE_ARGS+= \
	--disable-curl \
	--disable-gpg \
	--with-opkgetcdir=/etc \
	--with-opkglockfile=/tmp/opkg.lock

define Host/Compile
158
	+$(MAKE) $(HOST_JOBS) -C $(HOST_BUILD_DIR) CC="$(HOSTCC)" all
159
160
161
162
163
164
endef

define Host/Install
	$(INSTALL_BIN) $(HOST_BUILD_DIR)/src/opkg-cl $(STAGING_DIR_HOST)/bin/opkg
endef

165
$(eval $(call BuildPackage,opkg))
166
$(eval $(call BuildPackage,opkg-smime))
167
$(eval $(call HostBuild))