Often a package compiled against klibc is the same as a package
that is also compiled normally against glibc or ulibc, and needs a
separate directory to build in. klibc projects will be built in
${PTXDIST_PLATFORMDIR}/build-target-klibc/...

A template has been created that can be invoked with:
$ ptxdist newpacket klibc

Signed-off-by: Jon Ringle <[email protected]>
---
 bin/ptxdist                         |    7 ++-
 rules/Kconfig                       |    4 +
 rules/pre/Rules.make                |   25 ++++++++
 rules/templates/template-klibc-in   |    8 +++
 rules/templates/template-klibc-make |  110 +++++++++++++++++++++++++++++++++++
 scripts/ptxdist_vars.sh             |    1 +
 6 files changed, 154 insertions(+), 1 deletions(-)
 create mode 100644 rules/templates/template-klibc-in
 create mode 100644 rules/templates/template-klibc-make

diff --git a/bin/ptxdist b/bin/ptxdist
index 2a7af6b..4859a4c 100755
--- a/bin/ptxdist
+++ b/bin/ptxdist
@@ -1009,6 +1009,11 @@ newpacket() {
                class=cross-
                autoconf_class=HOST_CROSS_
                ;;
+       klibc)
+               template=template-klibc
+               class=
+               autoconf_class=
+               ;;
        src-autoconf-prog)
                template=template-src-autoconf
                
template_src="${PTXDIST_TOPDIR}/rules/templates/src-autoconf-prog"
@@ -1117,7 +1122,7 @@ newpacket() {
        esac
 
        case "$action" in
-       host|target|cross)
+       host|target|cross|klibc)
                echo -n "${PROMPT}enter URL of basedir....: "
                read url
                echo -n "${PROMPT}enter suffix............: "
diff --git a/rules/Kconfig b/rules/Kconfig
index 7166aa1..d8391ef 100644
--- a/rules/Kconfig
+++ b/rules/Kconfig
@@ -38,6 +38,10 @@ menu "Core (libc, locales)          "
 source "generated/core.in"
 endmenu
 
+menu "Core (initramfs)              "
+source "generated/initramfs.in"
+endmenu
+
 comment "------------------------------------"
 
 menu "Shell & Console Tools         "
diff --git a/rules/pre/Rules.make b/rules/pre/Rules.make
index 82663f0..bf3c968 100644
--- a/rules/pre/Rules.make
+++ b/rules/pre/Rules.make
@@ -284,6 +284,31 @@ CROSS_CMAKE_USR     := -DCMAKE_INSTALL_PREFIX=/usr
 CROSS_CMAKE_ROOT := -DCMAKE_INSTALL_PREFIX=/
 
 # ----------------------------------------------------------------------------
+# KLIBC stuff
+# ----------------------------------------------------------------------------
+KLIBC_ENV_CC := CC=klcc
+KLIBC_ENV_LD := LD=klcc
+
+KLIBC_ENV_PROGS := \
+       $(KLIBC_ENV_CC) \
+       $(KLIBC_ENV_LD)
+
+KLIBC_ENV_DESTDIR := \
+       DESTDIR=$(SYSROOT)/usr/lib/klibc
+
+KLIBC_ENV := \
+       $(CROSS_ENV_PROGS) \
+       $(KLIBC_ENV_PROGS) \
+       $(KLIBC_ENV_DESTDIR)
+
+KLIBC_AUTOCONF_SYSROOT_KLIBC := \
+       --prefix=/usr/lib/klibc
+
+KLIBC_AUTOCONF_ARCH := $(CROSS_AUTOCONF_ARCH)
+
+KLIBC_AUTOCONF_KLIBC := $(KLIBC_AUTOCONF_SYSROOT_KLIBC) $(KLIBC_AUTOCONF_ARCH)
+
+# ----------------------------------------------------------------------------
 # HOST stuff
 # ----------------------------------------------------------------------------
 
diff --git a/rules/templates/template-klibc-in 
b/rules/templates/template-klibc-in
new file mode 100644
index 0000000..5971763
--- /dev/null
+++ b/rules/templates/template-klibc-in
@@ -0,0 +1,8 @@
+## SECTION=initramfs
+
+config @PACKET@
+       tristate
+       select KLIBC
+       prompt "@packet@"
+       help
+         FIXME
diff --git a/rules/templates/template-klibc-make 
b/rules/templates/template-klibc-make
new file mode 100644
index 0000000..d85d4aa
--- /dev/null
+++ b/rules/templates/template-klibc-make
@@ -0,0 +1,110 @@
+# -*-makefile-*-
+# $Id$
+#
+# Copyright (C) @YEAR@ by @AUTHOR@
+#
+# See CREDITS for details about who has contributed to this project.
+#
+# For further information about the PTXdist project and license conditions
+# see the README file.
+#
+
+#
+# We provide this package
+#
+PACKAGES-$(ptxco...@packet@) += @packet@
+
+#
+# Paths and names
+#
+...@packet@_VERSION    := @VERSION@
+...@packet@            := @packet_filen...@-$(@pac...@_version)
+...@packet@_SUFFIX             := @SUFFIX@
+...@packet@_URL                := @URL@/$(@PACKET@).$(@pac...@_suffix)
+...@packet@_SOURCE             := $(SRCDIR)/$(@PACKET@).$(@pac...@_suffix)
+...@packet@_DIR                := $(KLIBC_BUILDDIR)/$(@PACKET@)
+
+ifdef ptxco...@packet@
+$(STATEDIR)/kernel.compile: $(STATEDIR)/@[email protected]
+endif
+
+# ----------------------------------------------------------------------------
+# Get
+# ----------------------------------------------------------------------------
+
+$(@pac...@_source):
+       @$(call targetinfo)
+       @$(call get, @PACKET@)
+
+# ----------------------------------------------------------------------------
+# Extract
+# ----------------------------------------------------------------------------
+
+$(STATEDIR)/@[email protected]:
+       @$(call targetinfo)
+       @$(call clean, $(@pac...@_dir))
+       @$(call extract, @PACKET@)
+       @$(call patchin, @PACKET@)
+       @$(call touch)
+
+# ----------------------------------------------------------------------------
+# Prepare
+# ----------------------------------------------------------------------------
+
+...@packet@_PATH       := PATH=$(CROSS_PATH)
+...@packet@_ENV        := $(KLIBC_ENV)
+
+#
+# autoconf
+#
+...@packet@_AUTOCONF := $(KLIBC_AUTOCONF_KLIBC)
+
+$(STATEDIR)/@[email protected]:
+       @$(call targetinfo)
+       @$(call clean, $(@pac...@_dir)/config.cache)
+       cd $(@pac...@_dir) && \
+               $(@pac...@_path) $(@pac...@_env) \
+               ./configure $(@pac...@_autoconf)
+       @$(call touch)
+
+# ----------------------------------------------------------------------------
+# Compile
+# ----------------------------------------------------------------------------
+
+$(STATEDIR)/@[email protected]:
+       @$(call targetinfo)
+       cd $(@pac...@_dir) && $(@pac...@_path) $(MAKE) $(PARALLELMFLAGS)
+       @$(call touch)
+
+# ----------------------------------------------------------------------------
+# Install
+# ----------------------------------------------------------------------------
+
+ifdef ptxco...@packet@
+$(STATEDIR)/klibc-user-spec.compile: $(STATEDIR)/@[email protected]
+endif
+
+$(STATEDIR)/@[email protected]:
+       @$(call targetinfo)
+       @$(call install, @PACKET@)
+       @$(call install_initramfs, @packet@, 0755, 0, 0, 
$(@pac...@_dir)/foobar, /foobar)
+       @$(call touch)
+
+# ----------------------------------------------------------------------------
+# Target-Install
+# ----------------------------------------------------------------------------
+
+$(STATEDIR)/@[email protected]:
+       @$(call targetinfo)
+       @$(call touch)
+
+# ----------------------------------------------------------------------------
+# Clean
+# ----------------------------------------------------------------------------
+
+...@packet@_clean:
+       rm -rf $(STATEDIR)/@pac...@.*
+       rm -rf $(PKGDIR)/@pac...@_*
+       rm -rf $(@pac...@_dir)
+
+# vim: syntax=make
diff --git a/scripts/ptxdist_vars.sh b/scripts/ptxdist_vars.sh
index feb395b..35dbdd5 100644
--- a/scripts/ptxdist_vars.sh
+++ b/scripts/ptxdist_vars.sh
@@ -15,6 +15,7 @@ PROJECTPOSTRULESDIR=${PTXDIST_WORKSPACE}/rules/post
 
 # created dirs during build
 BUILDDIR=${PTXDIST_PLATFORMDIR}/build-target
+KLIBC_BUILDDIR=${PTXDIST_PLATFORMDIR}/build-target-klibc
 CROSS_BUILDDIR=${PTXDIST_PLATFORMDIR}/build-cross
 HOST_BUILDDIR=${PTXDIST_PLATFORMDIR}/build-host
 PKGDIR=${PTXDIST_PLATFORMDIR}/packages
-- 
1.6.3.3.334.g916e1


--
ptxdist mailing list
[email protected]

Reply via email to