From f99d48db78e21a94725de4302e6ce9f7824bc70c Mon Sep 17 00:00:00 2001
From: Mike Staszel <mikestaszel@gmail.com>
Date: Mon, 8 Feb 2010 02:28:58 -0600
Subject: [PATCH] Added glibc to core

---
 core/gcc/PKGBUILD             | 14 +++---
 core/glibc/PKGBUILD           | 87 +++++++++++++++++++++++++++++++++++
 core/glibc/glibc.install      |  5 ++
 core/glibc/locale-gen         | 42 +++++++++++++++++
 core/glibc/locale.gen.txt     | 23 +++++++++
 core/glibc/nscd               | 40 ++++++++++++++++
 core/glibc/pkg/etc/ld.so.conf |  0
 7 files changed, 204 insertions(+), 7 deletions(-)
 create mode 100644 core/glibc/PKGBUILD
 create mode 100644 core/glibc/glibc.install
 create mode 100644 core/glibc/locale-gen
 create mode 100644 core/glibc/locale.gen.txt
 create mode 100644 core/glibc/nscd
 create mode 100644 core/glibc/pkg/etc/ld.so.conf

diff --git a/core/gcc/PKGBUILD b/core/gcc/PKGBUILD
index 1b2da8622..8004b65f2 100644
--- a/core/gcc/PKGBUILD
+++ b/core/gcc/PKGBUILD
@@ -2,18 +2,18 @@
 
 pkgbase=gcc
 pkgname=('gcc' 'gcc-libs')
-pkgver=4.4.2
+pkgver=4.4.3
 pkgrel=1
 pkgdesc='The GNU Compiler Collection'
 arch=(arm)
 license=(GPL LGPL custom)
 url='http://gcc.gnu.org'
 makedepends=(flex 'gcc>=3.4' 'gawk>=3.1.5' 'make>=3.80')
-source=(ftp://gcc.gnu.org/pub/gcc/releases/gcc-$pkgver/gcc-{core,g++,fortran,objc}-$pkgver.tar.bz2)
-md5sums=('d50ec5af20508974411d0c83c5f4e396'
-         '43b1e4879eb282dc4b05e4c016d356d7'
-         '184897e1b5e8c76760813c1955ee02c2'
-         'd8d26187d386a0591222a580b5a5b3d3')
+source=(http://gcc-uk.internet.bs/releases/gcc-$pkgver/gcc-{core,g++,fortran,objc}-$pkgver.tar.bz2)
+md5sums=('054b66f315b3d04ad06544ce26e72365'
+         'cd179ec4f05ee17ce76464da25a2674c'
+         '0f8fa5e9edbcf156a061312cae0715ee'
+         '34711c4de46eaf79aa018206dbec4389')
 options=('!libtool')
 
 build() {
@@ -46,7 +46,7 @@ package_gcc() {
 }
 
 package_gcc-libs() {
-  depends=('glibc>=2.10.1')
+  depends=('glibc>=2.11')
   groups=(base)
   pkgdesc='Runtime libraries shipped by GCC for C and C++ languages'
   license=(LGPL custom)
diff --git a/core/glibc/PKGBUILD b/core/glibc/PKGBUILD
new file mode 100644
index 000000000..926e4e6de
--- /dev/null
+++ b/core/glibc/PKGBUILD
@@ -0,0 +1,87 @@
+# Maintainer: Mike Staszel <mikestaszel@plugapps.com>
+
+pkgname=glibc
+pkgver=2.11
+pkgrel=2
+install=glibc.install
+backup=(etc/locale.gen
+        etc/nscd.conf)
+pkgdesc="GNU C Library"
+arch=('arm')
+license=('GPL' 'LGPL')
+url="http://www.gnu.org/software/libc"
+groups=('base' 'small-base')
+depends=('kernel-headers>=2.6.29' 'tzdata')
+makedepends=('gcc>=4.4.0')
+source=(http://ftp.gnu.org/gnu/glibc/glibc-ports-$pkgver.tar.gz
+        http://ftp.gnu.org/gnu/glibc/glibc-$pkgver.tar.gz
+        nscd
+	locale.gen.txt
+	locale-gen)
+
+build() {
+  cd $srcdir/glibc-$pkgver
+  ln -s $srcdir/glibc-ports-$pkgver .
+
+  install -dm755 $pkgdir/etc
+  touch $pkgdir/etc/ld.so.conf
+
+  # Remove timezone from build targets. This is supplied by the tzdata
+  # package.
+  sed -i '/^all-subdirs =/,/^$/s/timezone //' Makeconfig
+
+  mkdir glibc-build
+  cd glibc-build
+
+  echo "slibdir=/lib" >> configparms
+
+  ../configure --prefix=/usr \
+      --host=arm-none-linux-gnueabi \
+      --build=arm-none-linux-gnueabi \
+      --enable-add-ons \
+      --enable-kernel=2.6.22 \
+      --enable-bind-now \
+      --disable-profile \
+      --disable-debug \
+      --disable-gd \
+      --libexecdir=/usr/lib \
+      --libdir=/usr/lib \
+      --with-tls \
+      --with-__thread \
+      --with-headers=/usr/include \
+      --without-cvs \
+      --without-gd \
+      --without-fp \
+      --without-selinux || return 1
+
+  make || return 1
+  make install_root="$pkgdir" install || return 1
+
+  rm -f "$pkgdir/etc/ld.so.cache" "$pkgdir/etc/ld.so.conf" \
+        "$pkgdir/etc/localtime"
+
+  install -dm755 ${pkgdir}/etc/rc.d
+  install -dm755 ${pkgdir}/usr/sbin
+  install -dm755 ${pkgdir}/usr/lib/locale
+  install -Dm644 "$srcdir/glibc-$pkgver/nscd/nscd.conf" \
+                 "$pkgdir/etc/nscd.conf"
+  install -Dm755 "$srcdir/nscd" "$pkgdir/etc/rc.d/nscd"
+  install -Dm755 "$srcdir/locale-gen" "$pkgdir/usr/sbin/locale-gen"
+
+  sed -i -e 's/^\tserver-user/#\tserver-user/' \
+            "$pkgdir/etc/nscd.conf" || return 1
+
+  # Create /etc/locale.gen
+  install -m644 "$srcdir/locale.gen.txt" "$pkgdir/etc/locale.gen"
+  sed -i 's|/| |g' "$srcdir/libc/localedata/SUPPORTED"
+  sed -i 's|\\| |g' "$srcdir/libc/localedata/SUPPORTED"
+  sed -i 's|SUPPORTED-LOCALES=||' "$srcdir/libc/localedata/SUPPORTED"
+  cat "$srcdir/libc/localedata/SUPPORTED" >> "$pkgdir/etc/locale.gen"
+  sed -i 's|^|#|g' "$pkgdir/etc/locale.gen"
+}
+
+md5sums=('7100d8ba81c52e90e7fb4795d2f736c9'
+         '55d50abb2d7c366bde6fb5e35e681f9b'
+         'b587ee3a70c9b3713099295609afde49'
+         '1dfde0f12c99c7ec4d4054caf8ee5373'
+         '476e9113489f93b348b21e144b6a8fcf')
diff --git a/core/glibc/glibc.install b/core/glibc/glibc.install
new file mode 100644
index 000000000..61ec88c6e
--- /dev/null
+++ b/core/glibc/glibc.install
@@ -0,0 +1,5 @@
+post_upgrade() {
+  ldconfig -r .
+  init u
+  locale-gen
+}
diff --git a/core/glibc/locale-gen b/core/glibc/locale-gen
new file mode 100644
index 000000000..5aff344c4
--- /dev/null
+++ b/core/glibc/locale-gen
@@ -0,0 +1,42 @@
+#!/bin/sh
+
+set -e
+
+LOCALEGEN=/etc/locale.gen
+LOCALES=/usr/share/i18n/locales
+if [ -n "$POSIXLY_CORRECT" ]; then
+  unset POSIXLY_CORRECT
+fi
+
+
+[ -f $LOCALEGEN -a -s $LOCALEGEN ] || exit 0;
+
+# Remove all old locale dir and locale-archive before generating new
+# locale data.
+rm -rf /usr/lib/locale/* || true
+
+umask 022
+
+is_entry_ok() {
+  if [ -n "$locale" -a -n "$charset" ] ; then
+    true
+  else
+    echo "error: Bad entry '$locale $charset'"
+    false
+  fi
+}
+
+echo "Generating locales..."
+while read locale charset; do \
+	case $locale in \#*) continue;; "") continue;; esac; \
+	is_entry_ok || continue
+	echo -n "  `echo $locale | sed 's/\([^.\@]*\).*/\1/'`"; \
+	echo -n ".$charset"; \
+	echo -n `echo $locale | sed 's/\([^\@]*\)\(\@.*\)*/\2/'`; \
+	echo -n '...'; \
+        if [ -f $LOCALES/$locale ]; then input=$locale; else \
+        input=`echo $locale | sed 's/\([^.]*\)[^@]*\(.*\)/\1\2/'`; fi; \
+	localedef -i $input -c -f $charset -A /usr/share/locale/locale.alias $locale; \
+	echo ' done'; \
+done < $LOCALEGEN
+echo "Generation complete."
diff --git a/core/glibc/locale.gen.txt b/core/glibc/locale.gen.txt
new file mode 100644
index 000000000..ec1c5d68e
--- /dev/null
+++ b/core/glibc/locale.gen.txt
@@ -0,0 +1,23 @@
+# Configuration file for locale-gen
+#
+# lists of locales that are to be generated by the locale-gen command.
+#
+# Each line is of the form:
+#
+#     <locale> <charset>
+#
+#  where <locale> is one of the locales given in /usr/share/i18n/locales
+#  and <charset> is one of the character sets listed in /usr/share/i18n/charmaps
+#
+#  Examples:
+  en_US ISO-8859-1
+  en_US.UTF-8 UTF-8
+#  de_DE ISO-8859-1
+#  de_DE@euro ISO-8859-15
+#
+#  The locale-gen command will generate all the locales,
+#  placing them in /usr/lib/locale.
+#
+#  A list of supported locales is included in this file.
+#  Uncomment the ones you need.
+#
diff --git a/core/glibc/nscd b/core/glibc/nscd
new file mode 100644
index 000000000..8b14f2a3f
--- /dev/null
+++ b/core/glibc/nscd
@@ -0,0 +1,40 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+PID=`pidof -o %PPID /usr/sbin/nscd`
+case "$1" in
+  start)
+    stat_busy "Starting nscd"
+    # create necessary directories if they don't already exist
+    mkdir -p /var/run/nscd /var/db/nscd 2>/dev/null
+    # remove stale files
+    rm -f /var/db/nscd/* /var/run/nscd/* 2>/dev/null
+    [ -z "$PID" ] && /usr/sbin/nscd
+    if [ $? -gt 0 ]; then
+      stat_fail
+    else
+      add_daemon nscd
+      stat_done
+    fi
+    ;;
+  stop)
+    stat_busy "Stopping nscd"
+    [ ! -z "$PID" ]  && kill $PID &> /dev/null
+    if [ $? -gt 0 ]; then
+      stat_fail
+    else
+      rm_daemon nscd
+      stat_done
+    fi
+    ;;
+  restart)
+    $0 stop
+    sleep 1
+    $0 start
+    ;;
+  *)
+    echo "usage: $0 {start|stop|restart}"  
+esac
+exit 0
diff --git a/core/glibc/pkg/etc/ld.so.conf b/core/glibc/pkg/etc/ld.so.conf
new file mode 100644
index 000000000..e69de29bb