From 41811345b79f7f918a569ab57434de85ba478cb3 Mon Sep 17 00:00:00 2001
From: nico <nico@3c298f89-4303-0410-b956-a3cf2f4a3e73>
Date: Fri, 7 Oct 2005 20:07:28 +0000
Subject: [PATCH] add util-linux for fdisk (thanks to Philipp Kewisch )

git-svn-id: svn://svn.openwrt.org/openwrt/trunk@2071 3c298f89-4303-0410-b956-a3cf2f4a3e73
---
 openwrt/package/Config.in                     |  6 +-
 openwrt/package/Makefile                      |  1 +
 openwrt/package/util-linux/Config.in          | 15 ++++
 openwrt/package/util-linux/Makefile           | 48 +++++++++++++
 openwrt/package/util-linux/ipkg/fdisk.control |  6 ++
 .../util-linux/patches/501-mconfig.patch      | 68 +++++++++++++++++++
 6 files changed, 141 insertions(+), 3 deletions(-)
 create mode 100644 openwrt/package/util-linux/Config.in
 create mode 100644 openwrt/package/util-linux/Makefile
 create mode 100644 openwrt/package/util-linux/ipkg/fdisk.control
 create mode 100644 openwrt/package/util-linux/patches/501-mconfig.patch

diff --git a/openwrt/package/Config.in b/openwrt/package/Config.in
index 06196904b..d16861113 100644
--- a/openwrt/package/Config.in
+++ b/openwrt/package/Config.in
@@ -185,8 +185,8 @@ source "package/irssi/Config.in"
 comment "Multimedia ---"
 source "package/gmediaserver/Config.in"
 source "package/icecast/Config.in"
-source "package/mt-daapd/Config.in"
 source "package/mpd/Config.in"
+source "package/mt-daapd/Config.in"
 source "package/palantir/Config.in"
 source "package/setpwc/Config.in"
 
@@ -201,14 +201,14 @@ source "package/madwifi-tools/Config.in"
 source "package/usbutils/Config.in"  # lsusb
 source "package/strace/Config.in"
 
-# what are we going to do with both of you
 comment "FileSystems related ---"
 source "package/dosfstools/Config.in"
 source "package/e2fsprogs/Config.in"
 source "package/fuse/Config.in"
 source "package/shfs/Config.in"
+source "package/util-linux/Config.in"
 
-comment "Bluetooth related"
+comment "Bluetooth related ---"
 source "package/bluez-libs/Config.in"
 source "package/bluez-utils/Config.in"
 
diff --git a/openwrt/package/Makefile b/openwrt/package/Makefile
index b6c3bcf9e..564fd926d 100644
--- a/openwrt/package/Makefile
+++ b/openwrt/package/Makefile
@@ -179,6 +179,7 @@ package-$(BR2_PACKAGE_UCLIBCXX) += uclibc++
 package-$(BR2_PACKAGE_ULOGD) += ulogd
 package-$(BR2_PACKAGE_UPDATEDD) += updatedd
 package-$(BR2_PACKAGE_USBUTILS) += usbutils
+package-$(BR2_COMPILE_UTIL_LINUX) += util-linux
 package-$(BR2_PACKAGE_VTUN) += vtun
 package-$(BR2_PACKAGE_VSFTPD) += vsftpd
 package-$(BR2_PACKAGE_WIFICONF) += wificonf
diff --git a/openwrt/package/util-linux/Config.in b/openwrt/package/util-linux/Config.in
new file mode 100644
index 000000000..b10b272b7
--- /dev/null
+++ b/openwrt/package/util-linux/Config.in
@@ -0,0 +1,15 @@
+config BR2_COMPILE_UTIL_LINUX
+	bool
+	default n
+	depends BR2_PACKAGE_FDISK
+
+config BR2_PACKAGE_FDISK
+	tristate "fdisk - A partition table manipulation utility"
+	default m if CONFIG_DEVEL
+	select BR2_COMPILE_UTIL_LINUX
+	help
+	  A partition table manipulation utility
+	  
+	  http://www.kernel.org/pub/linux/utils/util-linux/
+	  
+
diff --git a/openwrt/package/util-linux/Makefile b/openwrt/package/util-linux/Makefile
new file mode 100644
index 000000000..30a4398ae
--- /dev/null
+++ b/openwrt/package/util-linux/Makefile
@@ -0,0 +1,48 @@
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=fdisk
+PKG_VERSION:=2.12r
+PKG_RELEASE:=1
+PKG_MD5SUM:=c261230b27fc0fbcc287c76884caf2d3
+
+PKG_SOURCE_URL:=ftp://ftp.kernel.org/pub/linux/utils/util-linux/ \
+	http://ftp.kernel.org/pub/linux/utils/util-linux/ \
+	ftp://ftp.de.kernel.org/pub/linux/utils/util-linux/ \
+	http://ftp.de.kernel.org/pub/linux/utils/util-linux/
+PKG_SOURCE:=util-linux-$(PKG_VERSION).tar.gz
+PKG_CAT:=zcat
+PKG_BUILD_DIR:=$(BUILD_DIR)/util-linux-$(PKG_VERSION)
+PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install
+
+include $(TOPDIR)/package/rules.mk
+
+$(eval $(call PKG_template,FDISK,fdisk,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
+
+$(PKG_BUILD_DIR)/.configured: $(PKG_BUILD_DIR)/.prepared
+	(cd $(PKG_BUILD_DIR); \
+		$(TARGET_CONFIGURE_OPTS) \
+		CFLAGS="$(TARGET_CFLAGS) -I$(STAGING_DIR)/usr/include -I$(STAGING_DIR)/include" \
+		LDFLAGS="-L$(STAGING_DIR)/usr/lib -L$(STAGING_DIR)/lib" \
+		./configure \
+	);
+	touch $@
+
+$(PKG_BUILD_DIR)/.built:
+	rm -rf $(PKG_INSTALL_DIR)
+	mkdir -p $(PKG_INSTALL_DIR)
+	$(MAKE) -C $(PKG_BUILD_DIR)/fdisk \
+		$(TARGET_CONFIGURE_OPTS) \
+		OPT="$(TARGET_CFLAGS)" \
+		DESTDIR="$(PKG_INSTALL_DIR)" \
+		all install
+	touch $@
+
+$(IPKG_FDISK):
+	install -d -m0755 $(IDIR_FDISK)/usr/sbin
+	cp -fpR $(PKG_INSTALL_DIR)/sbin/fdisk $(IDIR_FDISK)/usr/sbin/
+	$(RSTRIP) $(IDIR_FDISK)
+	$(IPKG_BUILD) $(IDIR_FDISK) $(PACKAGE_DIR)
+
+mostlyclean:
+	-$(MAKE) -C $(PKG_BUILD_DIR) clean
+	rm -f $(PKG_BUILD_DIR)/.built
diff --git a/openwrt/package/util-linux/ipkg/fdisk.control b/openwrt/package/util-linux/ipkg/fdisk.control
new file mode 100644
index 000000000..30f37b445
--- /dev/null
+++ b/openwrt/package/util-linux/ipkg/fdisk.control
@@ -0,0 +1,6 @@
+Package: fdisk
+Priority: optional
+Section: sys
+Maintainer: Philipp Kewisch <openwrt@kewis.ch>
+Source: ftp://ftp.kernel.org/pub/linux/utils/util-linux/util-linux-2.1.2r.tar.gz
+Description: Util-linux is a suite of essential utilities for any Linux system. This is the fdisk component of util-linux. Note however that this release is not stripped in any way.
diff --git a/openwrt/package/util-linux/patches/501-mconfig.patch b/openwrt/package/util-linux/patches/501-mconfig.patch
new file mode 100644
index 000000000..67e6530de
--- /dev/null
+++ b/openwrt/package/util-linux/patches/501-mconfig.patch
@@ -0,0 +1,68 @@
+--- util-linux-2.12r-orig/MCONFIG	2004-12-13 00:15:48.000000000 +0100
++++ util-linux-2.12r/MCONFIG	2005-10-03 17:54:15.945049312 +0200
+@@ -16,8 +16,8 @@
+ # Select for ARCH one of intel, alpha, sparc, arm, m68k, mips
+ # Select for CPU i386 if the binaries must be able to run on an intel 386
+ # (by default i486 code is generated, see below)
+-CPU=$(shell uname -m)
+-ARCH=$(shell echo $(CPU) | sed 's/i.86/intel/;s/arm.*/arm/')
++CPU=
++ARCH=mips
+ 
+ # If HAVE_PAM is set to "yes", then login, chfn, chsh, and newgrp
+ # will use PAM for authentication. Additionally, passwd will not be
+@@ -64,12 +64,12 @@
+ # If HAVE_WRITE is set to "yes", then write will not be built or
+ # installed from the misc-utils subdirectory.
+ # (There is a network aware write in netwrite from NetKit 0.16 or later.)
+-HAVE_WRITE=no
++HAVE_WRITE=yes
+ 
+ # If HAVE_GETTY is set to "yes", then agetty will not be built or
+ # installed from the login-utils subdirectory.  Note that agetty can
+ # co-exist with other gettys, so this option should never be used.
+-HAVE_GETTY=no
++HAVE_GETTY=yes
+ 
+ # If USE_TTY_GROUP is set to "yes", then wall and write will be installed
+ # setgid to the "tty" group, and mesg will only set the group write bit.
+@@ -82,13 +82,13 @@
+ # If HAVE_KILL is set to "yes", then kill will not be built or
+ # installed from the misc-utils subdirectory.
+ # (There is also a kill in the procps package.)
+-HAVE_KILL=no
++HAVE_KILL=yes
+ 
+ # If ALLOW_VCS_USE is set to "yes", then login will chown /dev/vcsN
+ # to the current user, allowing her to make a screendump and do other
+ # nifty things on the console, but also allowing him to keep an open
+ # file descriptor after logging out to trick the next user.
+-ALLOW_VCS_USE=yes
++ALLOW_VCS_USE=no
+ 
+ # If DO_STAT_MAIL is set to "yes", then login will stat() the mailbox
+ # and tell the user that she has new mail. This can hang the login if
+@@ -102,19 +102,19 @@
+ # If HAVE_SLN is set to "yes", then sln won't be installed
+ # (but the man page sln.8 will be installed anyway).
+ # sln also comes with libc and glibc.
+-HAVE_SLN=no
++HAVE_SLN=yes
+ 
+ # If HAVE_FDUTILS is set to "yes", then setfdprm won't be installed.
+-HAVE_FDUTILS=no
++HAVE_FDUTILS=yes
+ 
+ # If SILENT_PG is set to "yes", then pg will not ring the bell
+ # when an invalid key is pressed
+-SILENT_PG=no
++SILENT_PG=yes
+ 
+ # If configure decides that Native Language Support (NLS) is available,
+ # it sets MAY_ENABLE_NLS in defines.h. If you don't want NLS, set
+ # DISABLE_NLS to "yes".
+-DISABLE_NLS=no
++DISABLE_NLS=yes
+ 
+ # Different optimizations for different cpus.
+ # Before gcc 2.8.0 only -m486
-- 
2.20.1