From 60a8dd1005a206e042f30ab0eaba554b2598b4f5 Mon Sep 17 00:00:00 2001 From: "M.Dinslage" Date: Thu, 23 Jan 2014 14:12:11 +0700 Subject: misc/klibc: Added (small C library). Signed-off-by: Willy Sudiarto Raharjo --- misc/klibc/README | 4 ++ misc/klibc/klibc-2.0.3-kernel-uapi.patch | 77 +++++++++++++++++++++++++ misc/klibc/klibc.SlackBuild | 98 ++++++++++++++++++++++++++++++++ misc/klibc/klibc.info | 10 ++++ misc/klibc/slack-desc | 19 +++++++ 5 files changed, 208 insertions(+) create mode 100644 misc/klibc/README create mode 100644 misc/klibc/klibc-2.0.3-kernel-uapi.patch create mode 100644 misc/klibc/klibc.SlackBuild create mode 100644 misc/klibc/klibc.info create mode 100644 misc/klibc/slack-desc diff --git a/misc/klibc/README b/misc/klibc/README new file mode 100644 index 000000000000..270e1a943e3d --- /dev/null +++ b/misc/klibc/README @@ -0,0 +1,4 @@ +klibc is intended to be a minimalistic libc subset for use with +initramfs. It is deliberately written for small size, minimal +entanglement, and portability rather than speed. It is definitely +a work in progress, and a lot of things are still missing. diff --git a/misc/klibc/klibc-2.0.3-kernel-uapi.patch b/misc/klibc/klibc-2.0.3-kernel-uapi.patch new file mode 100644 index 000000000000..c70ec3db6561 --- /dev/null +++ b/misc/klibc/klibc-2.0.3-kernel-uapi.patch @@ -0,0 +1,77 @@ +diff -Nuar klibc-2.0.3.orig/scripts/Kbuild.klibc klibc-2.0.3/scripts/Kbuild.klibc +--- klibc-2.0.3.orig/scripts/Kbuild.klibc 2013-12-03 10:53:46.000000000 -0800 ++++ klibc-2.0.3/scripts/Kbuild.klibc 2013-12-26 14:39:07.113906101 -0800 +@@ -77,7 +77,10 @@ + KLIBCCFLAGS := + + # Defaults for arch to override +-KLIBCARCHINCFLAGS = -I$(KLIBCKERNELOBJ)/arch/$(KLIBCARCH)/include ++KLIBCARCHINCFLAGS = -I$(KLIBCKERNELOBJ)/arch/$(KLIBCARCH)/include/uapi \ ++ -I$(KLIBCKERNELOBJ)/arch/$(KLIBCARCH)/include/generated/uapi \ ++ -I$(KLIBCKERNELOBJ)/arch/$(KLIBCARCH)/include/generated \ ++ -I$(KLIBCKERNELOBJ)/arch/$(KLIBCARCH)/include + + # Arch specific definitions for klibc + include $(srctree)/$(KLIBCSRC)/arch/$(KLIBCARCHDIR)/MCONFIG +@@ -116,6 +119,9 @@ +-KLIBCCPPFLAGS += -I$(KLIBCKERNELSRC)/include \ ++KLIBCCPPFLAGS += -I$(KLIBCKERNELSRC)/include/uapi \ ++ -I$(KLIBCKERNELSRC)/include/generated/uapi \ ++ -I$(KLIBCKERNELSRC)/include/generated \ ++ -I$(KLIBCKERNELSRC)/include \ + $(if $(KBUILD_SRC),-I$(KLIBCKERNELOBJ)/include2 \ + -I$(KLIBCKERNELOBJ)/include -I$(srctree)/include) \ + $(KLIBCARCHINCFLAGS) + + # klibc definitions +diff -Nuar klibc-2.0.3.orig/usr/klibc/arch/i386/MCONFIG klibc-2.0.3/usr/klibc/arch/i386/MCONFIG +--- klibc-2.0.3.orig/usr/klibc/arch/i386/MCONFIG 2013-12-03 10:53:46.000000000 -0800 ++++ klibc-2.0.3/usr/klibc/arch/i386/MCONFIG 2013-12-26 14:44:56.349161344 -0800 +@@ -34,3 +34,6 @@ + + # Asm includes for i386 are in the merged x86 tree +-KLIBCARCHINCFLAGS = -I$(KLIBCKERNELOBJ)/arch/x86/include ++KLIBCARCHINCFLAGS = -I$(KLIBCKERNELOBJ)/arch/x86/include/uapi \ ++ -I$(KLIBCKERNELOBJ)/arch/x86/include/generated/uapi \ ++ -I$(KLIBCKERNELOBJ)/arch/x86/include/generated \ ++ -I$(KLIBCKERNELOBJ)/arch/x86/include +diff -Nuar klibc-2.0.3.orig/usr/klibc/arch/ppc/MCONFIG klibc-2.0.3/usr/klibc/arch/ppc/MCONFIG +--- klibc-2.0.3.orig/usr/klibc/arch/ppc/MCONFIG 2013-12-03 10:53:46.000000000 -0800 ++++ klibc-2.0.3/usr/klibc/arch/ppc/MCONFIG 2013-12-26 14:44:56.350161362 -0800 +@@ -24,6 +24,9 @@ + + # The kernel so far has both asm-ppc* and asm-powerpc. +-KLIBCARCHINCFLAGS = -I$(KLIBCKERNELOBJ)/arch/powerpc/include ++KLIBCARCHINCFLAGS = -I$(KLIBCKERNELOBJ)/arch/powerpc/include/uapi \ ++ -I$(KLIBCKERNELOBJ)/arch/powerpc/include/generated/uapi \ ++ -I$(KLIBCKERNELOBJ)/arch/powerpc/include/generated \ ++ -I$(KLIBCKERNELOBJ)/arch/powerpc/include + + # The asm include files live in asm-powerpc + KLIBCASMARCH = powerpc +diff -Nuar klibc-2.0.3.orig/usr/klibc/arch/ppc64/MCONFIG klibc-2.0.3/usr/klibc/arch/ppc64/MCONFIG +--- klibc-2.0.3.orig/usr/klibc/arch/ppc64/MCONFIG 2013-12-03 10:53:46.000000000 -0800 ++++ klibc-2.0.3/usr/klibc/arch/ppc64/MCONFIG 2013-12-26 14:44:56.350161362 -0800 +@@ -22,6 +22,9 @@ + + # The kernel so far has both asm-ppc* and asm-powerpc. +-KLIBCARCHINCFLAGS = -I$(KLIBCKERNELOBJ)/arch/powerpc/include ++KLIBCARCHINCFLAGS = -I$(KLIBCKERNELOBJ)/arch/powerpc/include/uapi \ ++ -I$(KLIBCKERNELOBJ)/arch/powerpc/include/generated/uapi \ ++ -I$(KLIBCKERNELOBJ)/arch/powerpc/include/generated \ ++ -I$(KLIBCKERNELOBJ)/arch/powerpc/include + + # The asm include files live in asm-powerpc + KLIBCASMARCH = powerpc +diff -Nuar klibc-2.0.3.orig/usr/klibc/arch/x86_64/MCONFIG klibc-2.0.3/usr/klibc/arch/x86_64/MCONFIG +--- klibc-2.0.3.orig/usr/klibc/arch/x86_64/MCONFIG 2013-12-03 10:53:46.000000000 -0800 ++++ klibc-2.0.3/usr/klibc/arch/x86_64/MCONFIG 2013-12-26 14:44:54.522128579 -0800 +@@ -37,3 +37,6 @@ + + # Asm includes for x86_64 are in the merged x86 tree +-KLIBCARCHINCFLAGS = -I$(KLIBCKERNELOBJ)/arch/x86/include ++KLIBCARCHINCFLAGS = -I$(KLIBCKERNELOBJ)/arch/x86/include/uapi \ ++ -I$(KLIBCKERNELOBJ)/arch/x86/include/generated/uapi \ ++ -I$(KLIBCKERNELOBJ)/arch/x86/include/generated \ ++ -I$(KLIBCKERNELOBJ)/arch/x86/include + diff --git a/misc/klibc/klibc.SlackBuild b/misc/klibc/klibc.SlackBuild new file mode 100644 index 000000000000..e374d1d35ddf --- /dev/null +++ b/misc/klibc/klibc.SlackBuild @@ -0,0 +1,98 @@ +#!/bin/sh + +# Slackware build script for + +# Copyright 2014 Matt Dinslage (daedra1980@gmail.com), Springfield, MO, USA +# All rights reserved. +# +# Redistribution and use of this script, with or without modification, is +# permitted provided that the following conditions are met: +# +# 1. Redistributions of this script must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +PRGNAM=klibc +VERSION=${VERSION:-2.0.3} +BUILD=${BUILD:-1} +TAG=${TAG:-_SBo} + +KERNEL=${KERNEL:-$(uname -r)} + +if [ -z "$ARCH" ]; then + case "$( uname -m )" in + i?86) ARCH=i486 ;; + arm*) ARCH=arm ;; + *) ARCH=$( uname -m ) ;; + esac +fi + +CWD=$(pwd) +TMP=${TMP:-/tmp/SBo} +PKG=$TMP/package-$PRGNAM +OUTPUT=${OUTPUT:-/tmp} + +if [ "$ARCH" = "i486" ]; then + SLKCFLAGS="-O2 -march=i486 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "i686" ]; then + SLKCFLAGS="-O2 -march=i686 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "x86_64" ]; then + SLKCFLAGS="-O2 -fPIC" + LIBDIRSUFFIX="64" +else + SLKCFLAGS="-O2" + LIBDIRSUFFIX="" +fi + +set -e + +rm -rf $PKG +mkdir -p $TMP $PKG $OUTPUT +cd $TMP +rm -rf $PRGNAM-$VERSION +tar xvf $CWD/$PRGNAM-$VERSION.tar.?z* +cd $PRGNAM-$VERSION +chown -R root:root . +find -L . \ + \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \ + -o -perm 511 \) -exec chmod 755 {} \; -o \ + \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \ + -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \; + +if [ $ARCH = "x86_64" ]; then + sed -i 's,$(prefix)/lib,$(prefix)/lib64,g' Makefile +fi + +# Patch for building with newer kernels. +# Thanks to the gentoo team for the patch. +patch -p1 < $CWD/klibc-2.0.3-kernel-uapi.patch + +KLIBCKERNELSRC=/lib/modules/$KERNEL/source HOSTCFLAGS=$SLKCFLAGS make +KLIBCKERNELSRC=/lib/modules/$KERNEL/source make install INSTALLROOT=$PKG + +gzip -9 $PKG/usr/man/man?/*.? + +find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \ + | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true + +mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION +cp -a README $PKG/usr/doc/$PRGNAM-$VERSION +cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild + +mkdir -p $PKG/install +cat $CWD/slack-desc > $PKG/install/slack-desc + +cd $PKG +/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-${VERSION}_$KERNEL-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz} diff --git a/misc/klibc/klibc.info b/misc/klibc/klibc.info new file mode 100644 index 000000000000..d192b3ed42fa --- /dev/null +++ b/misc/klibc/klibc.info @@ -0,0 +1,10 @@ +PRGNAM="klibc" +VERSION="2.0.3" +HOMEPAGE="http://www.kernel.org" +DOWNLOAD="http://www.kernel.org/pub/linux/libs/klibc/2.0/klibc-2.0.3.tar.xz" +MD5SUM="5577b088509f8a2685206bcabbdc169b" +DOWNLOAD_x86_64="" +MD5SUM_x86_64="" +REQUIRES="" +MAINTAINER="M.Dinslage" +EMAIL="daedra1980{at}gmail{dot}com" diff --git a/misc/klibc/slack-desc b/misc/klibc/slack-desc new file mode 100644 index 000000000000..9d16cf15bb8c --- /dev/null +++ b/misc/klibc/slack-desc @@ -0,0 +1,19 @@ +# HOW TO EDIT THIS FILE: +# The "handy ruler" below makes it easier to edit a package description. +# Line up the first '|' above the ':' following the base package name, and +# the '|' on the right side marks the last column you can put a character in. +# You must make exactly 11 lines for the formatting to be correct. It's also +# customary to leave one space after the ':' except on otherwise blank lines. + + |-----handy-ruler------------------------------------------------------| +klibc: klibc (small C library) +klibc: +klibc: klibc is intended to be a minimalistic libc subset for use with +klibc: initramfs. It is deliberately written for small size, minimal +klibc: entanglement, and portability rather than speed. It is definitely +klibc: a work in progress, and a lot of things are still missing. +klibc: +klibc: +klibc: +klibc: +klibc: -- cgit v1.2.3