Makefile 3.57 KB
Newer Older
1
#
2
# Copyright (C) 2006-2012 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
11

PKG_NAME:=opkg
12
PKG_REV:=9c97d5ecd795709c8584e972bfdf3aee3a5b846d
13
PKG_VERSION:=$(PKG_REV)
14
PKG_RELEASE:=6
15

16
PKG_SOURCE_PROTO:=git
17
18
PKG_SOURCE_VERSION:=$(PKG_REV)
PKG_SOURCE_SUBDIR:=opkg-$(PKG_VERSION)
19
PKG_SOURCE_URL:=http://git.yoctoproject.org/git/opkg
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
26
27
PKG_LICENSE:=GPLv2
PKG_LICENSE_FILES:=COPYING

28
29
30
31
PKG_BUILD_PARALLEL:=1
HOST_BUILD_PARALLEL:=1
PKG_INSTALL:=1

32
include $(INCLUDE_DIR)/package.mk
33
include $(INCLUDE_DIR)/host-build.mk
34

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

43
define Package/opkg/Default/description
44
45
46
47
48
49
50
51
52
  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

53
54
55
56
57
58
59
60
61
define Package/opkg
  $(call Package/opkg/Default)
  VARIANT:=unsigned
endef

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

62
define Package/opkg/conffiles
63
/etc/opkg.conf
64
65
endef

66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81

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)

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
87
88

CONFIGURE_ARGS += \
	--disable-curl \
	--disable-gpg \
89
90
	--with-opkgetcdir=/etc \
	--with-opkglockfile=/var/lock/opkg.lock
91

92
ifeq ($(BUILD_VARIANT),smime)
93
	CONFIGURE_ARGS += --enable-openssl --enable-sha256
94
95
endif

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
109
110
	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/opkg-cl $(1)/bin/opkg
endef

111
112
Package/opkg/install = $(call Package/opkg/Default/install,$(1),)

113
114
115
116
117
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
118

119
120
121
122
123
define Build/InstallDev
	mkdir -p $(1)/usr/include
	$(CP) $(PKG_INSTALL_DIR)/usr/include/libopkg $(1)/usr/include/
endef

124
125
126
127
128
129
130
131

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

define Host/Compile
132
	+$(MAKE) $(HOST_JOBS) -C $(HOST_BUILD_DIR) CC="$(HOSTCC)" all
133
134
135
136
137
138
endef

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

139
$(eval $(call BuildPackage,opkg))
140
$(eval $(call BuildPackage,opkg-smime))
141
$(eval $(call HostBuild))