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