[backfire] backport r31262
[openwrt-10.03/.git] / package / 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:=576
13 PKG_VERSION:=$(PKG_REV)
14 PKG_RELEASE:=2
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_FIXUP:=autoreconf
22 PKG_REMOVE_FILES = autogen.sh aclocal.m4
23
24 include $(INCLUDE_DIR)/package.mk
25 include $(INCLUDE_DIR)/host-build.mk
26
27 define Package/opkg
28   SECTION:=base
29   CATEGORY:=Base system
30   TITLE:=opkg package management system
31   MAINTAINER:=Jo-Philipp Wich <xm@subsignal.org>
32   URL:=http://wiki.openmoko.org/wiki/Opkg
33 endef
34
35 define Package/opkg/description
36   Lightweight package management system
37   opkg is the opkg Package Management System, for handling
38   installation and removal of packages on a system. It can
39   recursively follow dependencies and download all packages
40   necessary to install a particular package.
41
42   opkg knows how to install both .ipk and .deb packages.
43 endef
44
45 define Package/opkg/conffiles
46 /etc/opkg.conf
47 endef
48
49 TARGET_CFLAGS += $(if $(CONFIG_GCC_VERSION_4_3)$(CONFIG_GCC_VERSION_4_4),-Wno-array-bounds)
50 EXTRA_CFLAGS += $(TARGET_CPPFLAGS)
51
52 CONFIGURE_ARGS += \
53         --disable-curl \
54         --disable-gpg \
55         --with-opkgetcdir=/etc \
56         --with-opkglockfile=/var/lock/opkg.lock
57
58 define Build/Compile
59         $(MAKE) -C $(PKG_BUILD_DIR) \
60                 CC="$(TARGET_CC)" \
61                 DESTDIR="$(PKG_INSTALL_DIR)" \
62                 HOST_CPU="$(PKGARCH)" \
63                 all install
64 endef
65
66 define Package/opkg/install
67         $(INSTALL_DIR) $(1)/usr/lib/opkg
68         $(INSTALL_DIR) $(1)/bin
69         $(INSTALL_DIR) $(1)/etc
70         $(INSTALL_DATA) ./files/opkg.conf $(1)/etc/
71         $(VERSION_SED) $(1)/etc/opkg.conf
72         $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/opkg-cl $(1)/bin/opkg
73 endef
74
75 define Build/InstallDev
76         mkdir -p $(1)/usr/include
77         $(CP) $(PKG_INSTALL_DIR)/usr/include/libopkg $(1)/usr/include/
78 endef
79
80
81 HOST_CONFIGURE_ARGS+= \
82         --disable-curl \
83         --disable-gpg \
84         --with-opkgetcdir=/etc \
85         --with-opkglockfile=/tmp/opkg.lock
86
87 define Host/Compile
88         $(MAKE) -C $(HOST_BUILD_DIR) CC="$(HOSTCC)" all
89 endef
90
91 define Host/Install
92         $(INSTALL_BIN) $(HOST_BUILD_DIR)/src/opkg-cl $(STAGING_DIR_HOST)/bin/opkg
93 endef
94
95 $(eval $(call BuildPackage,opkg))
96 $(eval $(call HostBuild))