180f84b28313f3f86ef81f21e06fa63cb0b0d8c7
[openwrt.git] / package / opkg / Makefile
1 #
2 # Copyright (C) 2006-2010 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
10 PKG_NAME:=opkg
11 PKG_REV:=528
12 PKG_VERSION:=$(PKG_REV)
13 PKG_RELEASE:=2
14
15 PKG_SOURCE_PROTO:=svn
16 PKG_SOURCE_VERSION:=$(PKG_REV)
17 PKG_SOURCE_SUBDIR:=opkg-$(PKG_VERSION)
18 PKG_SOURCE_URL:=http://opkg.googlecode.com/svn/trunk/
19 PKG_SOURCE:=$(PKG_SOURCE_SUBDIR).tar.gz
20 PKG_FIXUP = libtool
21
22 include $(INCLUDE_DIR)/package.mk
23 include $(INCLUDE_DIR)/host-build.mk
24
25 define Package/opkg
26   SECTION:=base
27   CATEGORY:=Base system
28   TITLE:=opkg package management system
29   URL:=http://wiki.openmoko.org/wiki/Opkg
30 endef
31
32 define Package/opkg/description
33   Lightweight package management system
34   opkg is the opkg Package Management System, for handling
35   installation and removal of packages on a system. It can
36   recursively follow dependencies and download all packages
37   necessary to install a particular package.
38
39   opkg knows how to install both .ipk and .deb packages.
40 endef
41
42 define Package/opkg/conffiles
43 /etc/opkg.conf
44 endef
45
46 TARGET_CFLAGS += $(if $(CONFIG_GCC_VERSION_4_3)$(CONFIG_GCC_VERSION_4_4),-Wno-array-bounds)
47 EXTRA_CFLAGS += $(TARGET_CPPFLAGS)
48
49 CONFIGURE_ARGS += \
50         --disable-curl \
51         --disable-gpg \
52         --with-opkgetcdir=/etc \
53         --with-opkglockfile=/var/lock/opkg.lock
54
55 define Build/Configure
56         (cd $(PKG_BUILD_DIR); \
57                 autoreconf -v --install || exit 1 \
58         );
59         $(call Build/Configure/Default)
60 endef
61
62 define Build/Compile
63         $(MAKE) -C $(PKG_BUILD_DIR) \
64                 CC="$(TARGET_CC)" \
65                 DESTDIR="$(PKG_INSTALL_DIR)" \
66                 HOST_CPU="$(PKGARCH)" \
67                 all install
68 endef
69
70 define Package/opkg/install
71         $(INSTALL_DIR) $(1)/usr/lib/opkg
72         $(INSTALL_DIR) $(1)/bin
73         $(INSTALL_DIR) $(1)/etc
74         $(INSTALL_DATA) ./files/opkg.conf $(1)/etc/
75         $(SED) 's,$$$$S,$(PKGARCH),g' $(1)/etc/opkg.conf
76         $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/opkg-cl $(1)/bin/opkg
77 endef
78
79 define Build/InstallDev
80         mkdir -p $(1)/usr/include
81         $(CP) $(PKG_INSTALL_DIR)/usr/include/libopkg $(1)/usr/include/
82 endef
83
84
85 HOST_BUILD_DEPENDS:=libtool/host
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/Configure
94         (cd $(HOST_BUILD_DIR); autoreconf -v --install || exit 1)
95         $(call Host/Configure/Default)
96 endef
97
98 define Host/Compile
99         $(MAKE) -C $(HOST_BUILD_DIR) CC="$(HOSTCC)" all
100 endef
101
102 define Host/Install
103         $(INSTALL_BIN) $(HOST_BUILD_DIR)/src/opkg-cl $(STAGING_DIR_HOST)/bin/opkg
104 endef
105
106 $(eval $(call BuildPackage,opkg))
107 $(eval $(call HostBuild))