| 1 | # |
| 2 | # Copyright (C) 2006-2011 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:=618 |
| 12 | PKG_VERSION:=$(PKG_REV) |
| 13 | PKG_RELEASE:=1 |
| 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:=autoreconf |
| 21 | PKG_REMOVE_FILES = autogen.sh aclocal.m4 |
| 22 | |
| 23 | include $(INCLUDE_DIR)/package.mk |
| 24 | include $(INCLUDE_DIR)/host-build.mk |
| 25 | |
| 26 | define Package/opkg |
| 27 | SECTION:=base |
| 28 | CATEGORY:=Base system |
| 29 | TITLE:=opkg package management system |
| 30 | MAINTAINER:=Jo-Philipp Wich <xm@subsignal.org> |
| 31 | URL:=http://wiki.openmoko.org/wiki/Opkg |
| 32 | endef |
| 33 | |
| 34 | define Package/opkg/description |
| 35 | Lightweight package management system |
| 36 | opkg is the opkg Package Management System, for handling |
| 37 | installation and removal of packages on a system. It can |
| 38 | recursively follow dependencies and download all packages |
| 39 | necessary to install a particular package. |
| 40 | |
| 41 | opkg knows how to install both .ipk and .deb packages. |
| 42 | endef |
| 43 | |
| 44 | define Package/opkg/conffiles |
| 45 | /etc/opkg.conf |
| 46 | endef |
| 47 | |
| 48 | TARGET_CFLAGS += $(if $(CONFIG_GCC_VERSION_4_3)$(CONFIG_GCC_VERSION_4_4),-Wno-array-bounds) |
| 49 | TARGET_CFLAGS += -ffunction-sections -fdata-sections |
| 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 | LDFLAGS="-Wl,--gc-sections" \ |
| 64 | all install |
| 65 | endef |
| 66 | |
| 67 | define Package/opkg/install |
| 68 | $(INSTALL_DIR) $(1)/usr/lib/opkg |
| 69 | $(INSTALL_DIR) $(1)/bin |
| 70 | $(INSTALL_DIR) $(1)/etc |
| 71 | $(INSTALL_DATA) ./files/opkg.conf $(1)/etc/ |
| 72 | $(SED) 's,$$$$S,$(PKGARCH),g' $(1)/etc/opkg.conf |
| 73 | $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/opkg-cl $(1)/bin/opkg |
| 74 | endef |
| 75 | |
| 76 | define Build/InstallDev |
| 77 | mkdir -p $(1)/usr/include |
| 78 | $(CP) $(PKG_INSTALL_DIR)/usr/include/libopkg $(1)/usr/include/ |
| 79 | endef |
| 80 | |
| 81 | |
| 82 | HOST_CONFIGURE_ARGS+= \ |
| 83 | --disable-curl \ |
| 84 | --disable-gpg \ |
| 85 | --with-opkgetcdir=/etc \ |
| 86 | --with-opkglockfile=/tmp/opkg.lock |
| 87 | |
| 88 | define Host/Compile |
| 89 | $(MAKE) -C $(HOST_BUILD_DIR) CC="$(HOSTCC)" all |
| 90 | endef |
| 91 | |
| 92 | define Host/Install |
| 93 | $(INSTALL_BIN) $(HOST_BUILD_DIR)/src/opkg-cl $(STAGING_DIR_HOST)/bin/opkg |
| 94 | endef |
| 95 | |
| 96 | $(eval $(call BuildPackage,opkg)) |
| 97 | $(eval $(call HostBuild)) |
| 98 | |