klibc: release 1.1.1
authorJohn Bowler <jbowler@nslu2-linux.org>
Fri, 30 Dec 2005 23:00:00 +0000 (23:00 +0000)
committerOpenEmbedded Project <openembedded-devel@lists.openembedded.org>
Fri, 30 Dec 2005 23:00:00 +0000 (23:00 +0000)
 - klibc.inc now works with 1.1.1, builds packages and stages the
 - klibc to the host staging directory.  klcc can be used to build
 - packages against klibc

packages/klibc/files/.mtn2git_empty [new file with mode: 0644]
packages/klibc/files/install.patch [new file with mode: 0644]
packages/klibc/klibc.inc
packages/klibc/klibc_1.1.1.bb [new file with mode: 0644]

diff --git a/packages/klibc/files/.mtn2git_empty b/packages/klibc/files/.mtn2git_empty
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/packages/klibc/files/install.patch b/packages/klibc/files/install.patch
new file mode 100644 (file)
index 0000000..b165e8b
--- /dev/null
@@ -0,0 +1,42 @@
+# These are OE specific patches which make the install stuff work
+# in the OE build environment and fix the problem that the gzip
+# stuff should be all links to one executable but end up being
+# copies
+--- klibc-1.1.1/Makefile.orig  2005-12-29 14:20:09.080981353 -0800
++++ klibc-1.1.1/Makefile       2005-12-29 14:20:25.634022970 -0800
+@@ -61,7 +61,7 @@ local-install: $(CROSS)klcc
+         mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(CROSS)include/$$d ; \
+         for r in $(KRNLSRC)/include $(KRNLOBJ)/include $(KRNLOBJ)/include2 ; do \
+           [ ! -d $$r/$$d ] || \
+-            cp -rfL $$r/$$d/. $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)include/$$d/. ; \
++            cp -rf $$r/$$d/. $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)include/$$d/. ; \
+         done ; \
+       done
+       cd $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)include && ln -sf asm-$(ARCH) asm
+--- klibc-1.1.1/gzip/Makefile.orig     2005-12-29 18:10:00.787869930 -0800
++++ klibc-1.1.1/gzip/Makefile  2005-12-29 18:11:21.084922705 -0800
+@@ -70,9 +70,12 @@ clean:
+ spotless: clean
+       rm -f *~
+-# These should presumably be shared...
+ install: all
+-      $(INSTALL_EXEC) gzip gunzip zcat $(INSTALLROOT)$(INSTALLDIR)/$(CROSS)bin
++      $(INSTALL_EXEC) gzip $(INSTALLROOT)$(INSTALLDIR)/$(CROSS)bin
++      rm -f $(INSTALLROOT)$(INSTALLDIR)/$(CROSS)bin/gunzip
++      ln $(INSTALLROOT)$(INSTALLDIR)/$(CROSS)bin/gzip $(INSTALLROOT)$(INSTALLDIR)/$(CROSS)bin/gunzip
++      rm -f $(INSTALLROOT)$(INSTALLDIR)/$(CROSS)bin/zcat
++      ln $(INSTALLROOT)$(INSTALLDIR)/$(CROSS)bin/gzip $(INSTALLROOT)$(INSTALLDIR)/$(CROSS)bin/zcat
+ ifneq ($(wildcard .*.d),)
+ include $(wildcard .*.d)
+--- klibc-1.1.1/klibc/Makefile.orig    2005-12-30 10:39:04.504930675 -0800
++++ klibc-1.1.1/klibc/Makefile 2005-12-30 10:39:52.755966921 -0800
+@@ -184,6 +184,7 @@ install: all
+               $(INSTALLROOT)$(INSTALLDIR)/$(CROSS)lib
+       $(INSTALL_EXEC) klibc-`cat $(SOLIB).hash`.so \
+               $(INSTALLROOT)$(INSTALLDIR)/$(CROSS)lib
++      test -z "$(INSTALLROOT)" || \
+       $(INSTALL_EXEC) klibc-`cat $(SOLIB).hash`.so \
+               $(INSTALLROOT)/$(SHLIBDIR)
index ef5b57d..7f1b503 100644 (file)
@@ -1,4 +1,4 @@
-DEPENDS = "virtual/kernel"
+DEPENDS = "virtual/kernel perl-native"
 SECTION = "libs"
 DESCRIPTION = "klibc is intended to be a minimalistic libc subset for \
 use with initramfs.  It is deliberately written for small size, \
@@ -6,6 +6,7 @@ minimal entaglement, and portability, not speed."
 MAINTAINER = "Chris Larson <kergoth@handhelds.org>"
 LICENSE = "BSD-ADV"
 SRC_URI = "http://www.kernel.org/pub/linux/libs/klibc/Stable/klibc-${PV}.tar.bz2"
+SRC_URI += "file://install.patch;patch=1"
 S = "${WORKDIR}/klibc-${PV}"
 
 # for the correct kernel staging path
@@ -13,8 +14,8 @@ S = "${WORKDIR}/klibc-${PV}"
 
 EXTRA_OEMAKE = "'ARCH=${KLIBC_ARCH}' \
                'CROSS=${TARGET_PREFIX}' \
-               'CC=${CC}' \
-               'LD=${LD}' \
+               'CC=${HOST_PREFIX}gcc' \
+               'LD=${HOST_PREFIX}ld' \
                'AR=${AR}' \
                'RANLIB=${RANLIB}' \
                'NM=${TARGET_PREFIX}nm' \
@@ -25,16 +26,51 @@ EXTRA_OEMAKE = "'ARCH=${KLIBC_ARCH}' \
                'HOST_LDFLAGS=${BUILD_LDFLAGS}' \
                'HOST_LIBS=' \
                'LDFLAGS=' \
-               'WARNFLAGS=${CFLAGS}' \
-               'OPTFLAGS='"
+               'ARCHREQFLAGS=${HOST_CC_ARCH}' \
+               'OPTFLAGS=${TARGET_CFLAGS}' \
+               'mandir=${mandir}'"
 
 KLIBC_ARCH = '${TARGET_ARCH}'
 KLIBC_ARCH_armeb = 'arm'
 KLIBC_ARCH_mipsel = 'mips'
 
-CFLAGS := "${@oe_filter_out('-I\S+', '${CFLAGS}', d)} -I${STAGING_KERNEL_DIR}/include"
-# CFLAGS := "${@oe_filter_out('-I\S+', '${CFLAGS}', d)}"
+# the klibc code contains ARM instructions (for ARM), this
+# could be fixed, but for the moment:
+ARM_INSTRUCTION_SET = "arm"
+
+TARGET_CFLAGS := "${@oe_filter_out('-I\S+', '${TARGET_CFLAGS}', d)} -I${STAGING_KERNEL_DIR}/include"
+
+INSTALLDIR = "/usr/lib/klibc"
+INSTALLPREFIX = "${INSTALLDIR}/${TARGET_PREFIX}"
+INSTALLBINDIR = "${INSTALLPREFIX}bin"
+INSTALLLIBDIR = "${INSTALLPREFIX}lib"
+INSTALLINCDIR = "${INSTALLPREFIX}include"
+
+PACKAGES = "${PN} ${PN}-dev ${PN}-doc"
+
+FILES_${PN} = "/lib/*.so* ${INSTALLBINDIR}"
+FILES_${PN}-dev = "/usr/bin ${INSTALLINCDIR} ${INSTALLLIBDIR}"
 
 do_configure () {
        ln -sf ${STAGING_KERNEL_DIR} linux
 }
+
+STAGING_KLIBC_DIR = "${STAGING_DIR}/${HOST_SYS}/klibc"
+
+do_stage() {
+       rm -rf "${STAGING_KLIBC_DIR}"
+       oe_runmake      'prefix=${STAGING_KLIBC_DIR}' \
+                       'bindir=${STAGING_BINDIR}' \
+                       'mandir=${STAGING_DIR}/${BUILD_SYS}/share/man' \
+                       install
+       # The following is sufficient, at least in klibc 1.1.1 to make klcc
+       # use the staged libraries and include files.
+       sed -i -e 's@^\$prefix = .*$@\$prefix = "${STAGING_KLIBC_DIR}/lib/klibc";@' \
+               '${STAGING_BINDIR}/${TARGET_PREFIX}klcc'
+}
+
+do_install() {
+       # The installed -dev won't work because it has the cross compiler
+       # path compiled in.
+       oe_runmake 'INSTALLROOT=${D}' install
+}
diff --git a/packages/klibc/klibc_1.1.1.bb b/packages/klibc/klibc_1.1.1.bb
new file mode 100644 (file)
index 0000000..750e152
--- /dev/null
@@ -0,0 +1 @@
+include klibc.inc