add opkg - symlink /usr/lib/ipkg to /usr/lib/opkg so that opkg can be used as a drop...
authorTravis Kemen <thepeople@openwrt.org>
Tue, 29 Jul 2008 04:16:43 +0000 (04:16 +0000)
committerTravis Kemen <thepeople@openwrt.org>
Tue, 29 Jul 2008 04:16:43 +0000 (04:16 +0000)
SVN-Revision: 11983

package/opkg/Makefile [new file with mode: 0644]
package/opkg/files/opkg.conf [new file with mode: 0644]
package/opkg/files/postinst [new file with mode: 0644]
package/opkg/patches/001-use-wget [new file with mode: 0644]
package/opkg/patches/002-fix-autogen [new file with mode: 0644]

diff --git a/package/opkg/Makefile b/package/opkg/Makefile
new file mode 100644 (file)
index 0000000..b9e3e29
--- /dev/null
@@ -0,0 +1,76 @@
+# 
+# Copyright (C) 2006-2008 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=opkg
+PKG_REV:=4561
+PKG_VERSION:=$(PKG_REV)
+PKG_RELEASE:=1
+
+PKG_SOURCE_PROTO:=svn
+PKG_SOURCE_VERSION:=$(PKG_REV)
+PKG_SOURCE_SUBDIR:=opkg-$(PKG_VERSION)
+PKG_SOURCE_URL:=http://svn.openmoko.org/trunk/src/target/opkg/
+PKG_SOURCE:=$(PKG_SOURCE_SUBDIR).tar.gz
+PKG_FIXUP = libtool
+include $(INCLUDE_DIR)/package.mk
+
+define Package/opkg
+  SECTION:=base
+  CATEGORY:=Base system
+  TITLE:=opkg package management system
+  URL:=http://wiki.openmoko.org/wiki/Opkg
+endef
+
+define Package/opkg/description
+  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
+
+EXTRA_CFLAGS+=-I$(STAGING_DIR)/usr/include -I$(STAGING_DIR)/include -I$(STAGING_DIR)/usr/lib
+EXTRA_LDFLAGS+=-L$(STAGING_DIR)/usr/lib -Wl,-rpath-link,$(STAGING_DIR)/usr/lib
+
+CONFIGURE_ARGS += \
+       --disable-curl \
+       --disable-gpg \
+
+define Build/Configure
+       (cd $(PKG_BUILD_DIR); \
+               ./autogen.sh \
+       );
+       $(call Build/Configure/Default)
+endef
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               CC=$(TARGET_CC) \
+               DESTDIR="$(PKG_INSTALL_DIR)" \
+               all install
+endef
+
+define Package/opkg/install
+       $(INSTALL_DIR) $(1)/etc
+       $(INSTALL_DATA) ./files/opkg.conf $(1)/etc/ 
+       $(SED) 's,$$$$S,$(BOARD),g' $(1)/etc/opkg.conf
+       $(INSTALL_BIN) ./files/postinst $(1)/CONTROL/postinst
+       $(INSTALL_DIR) $(1)/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/opkg-cl $(1)/bin/opkg
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libopkg.so.* $(1)/usr/lib/
+endef
+
+define Build/InstallDev
+       mkdir -p $(1)/usr/include
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/libopkg $(1)/usr/include/
+endef
+
+$(eval $(call BuildPackage,opkg))
diff --git a/package/opkg/files/opkg.conf b/package/opkg/files/opkg.conf
new file mode 100644 (file)
index 0000000..f7f96fe
--- /dev/null
@@ -0,0 +1,4 @@
+src snapshots http://downloads.openwrt.org/snapshots/$S/packages
+dest root /
+dest ram /tmp
+lists_dir ext /var/opkg-lists
diff --git a/package/opkg/files/postinst b/package/opkg/files/postinst
new file mode 100644 (file)
index 0000000..c479744
--- /dev/null
@@ -0,0 +1,2 @@
+#!/bin/sh
+ln -sf "${IPKG_INSTROOT}/usr/lib/ipkg" "${IPKG_INSTROOT}/usr/lib/opkg"
diff --git a/package/opkg/patches/001-use-wget b/package/opkg/patches/001-use-wget
new file mode 100644 (file)
index 0000000..a8ec7c5
--- /dev/null
@@ -0,0 +1,77 @@
+Index: opkg-4561/libopkg/opkg_download.c
+===================================================================
+--- opkg-4561/libopkg/opkg_download.c  (revision 4480)
++++ opkg-4561/libopkg/opkg_download.c  (working copy)
+@@ -17,7 +17,9 @@
+    General Public License for more details.
+ */
+ #include "config.h"
++#ifdef HAVE_CURL
+ #include <curl/curl.h>
++#endif
+ #ifdef HAVE_GPGME
+ #include <gpgme.h>
+ #endif
+@@ -74,6 +76,7 @@
+       setenv("no_proxy", conf->no_proxy, 1);
+     }
++#ifdef HAVE_CURL
+     CURL *curl;
+     CURLcode res;
+     FILE * file = fopen (tmp_file_location, "w");
+@@ -119,6 +122,31 @@
+         free(src_basec);
+       return -1;
+     }
++#else /* if wget is selected */
++    char *cmd;
++    /* XXX: BUG rewrite to use execvp or else busybox's internal wget -Jamey 7/23/2002 */
++    sprintf_alloc(&cmd, "wget --passive-ftp %s %s%s %s%s -P %s %s",
++                 (conf->http_proxy || conf->ftp_proxy) ? "--proxy=on" : "",
++                 conf->proxy_user ? "--proxy-user=" : "",
++                 conf->proxy_user ? conf->proxy_user : "",
++                 conf->proxy_passwd ? "--proxy-passwd=" : "",
++                 conf->proxy_passwd ? conf->proxy_passwd : "",
++                 conf->tmp_dir,
++                 src);
++    err = xsystem(cmd);
++    if (err) {
++       if (err != -1) {
++           opkg_message(conf,OPKG_ERROR, "%s: ERROR: Command failed with return value %d: `%s'\n",
++                   __FUNCTION__, err, cmd);
++       } 
++       unlink(tmp_file_location);
++       free(tmp_file_location);
++       free(src_basec);
++       free(cmd);
++       return EINVAL;
++    }
++    free(cmd);
++#endif
+     err = file_move(tmp_file_location, dest_file_name);
+Index: opkg-4561/configure.ac
+===================================================================
+--- opkg-4561/configure.ac     (revision 4480)
++++ opkg-4561/configure.ac     (working copy)
+@@ -22,9 +22,16 @@
+ # Checks for libraries
+-# check for libcurl
+-PKG_CHECK_MODULES(CURL, libcurl)
++AC_ARG_ENABLE(curl,
++    AC_HELP_STRING([--enable-curl], [Enable use of libcurl instead of wget
++      [[default=yes]] ]),
++    [want_curl="$enableval"], [want_curl="yes"])
++if test "x$want_curl" = "xyes"; then
++  # check for libcurl
++  PKG_CHECK_MODULES(CURL, libcurl)
++  AC_DEFINE(HAVE_CURL, 1, [Define if you want to use libcurl instead of wget])
++fi
+ dnl **********
diff --git a/package/opkg/patches/002-fix-autogen b/package/opkg/patches/002-fix-autogen
new file mode 100644 (file)
index 0000000..0d39c42
--- /dev/null
@@ -0,0 +1,8 @@
+--- opkg-4561/autogen.sh-orig  2008-07-28 18:00:33.000000000 -0500
++++ opkg-4561/autogen.sh       2008-07-28 18:00:45.000000000 -0500
+@@ -1,5 +1,3 @@
+ #! /bin/sh
+ autoreconf -v --install || exit 1
+ glib-gettextize --force --copy || exit 1
+-./configure --enable-maintainer-mode "$@"
+-