[mirmince commits] {mirmince} branch master updated. c7ad5a0afbc5b529918526f03fd651e66f7eb417

tg at freewrt.org tg at freewrt.org
Thu Jan 24 19:44:24 UTC 2013


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Main git repository for FreeWRT project mirmince".

The branch, master has been updated
       via  c7ad5a0afbc5b529918526f03fd651e66f7eb417 (commit)
       via  f5998a2a0b635a8b38a94e0eb63edcbfe10da36e (commit)
       via  342d94eb9efdfddf3f2e0780b34d99c075a375ca (commit)
       via  3b3719ea5d75d11e3ed4ea61dc698389b9238697 (commit)
       via  172af8225e6aa363ccec870858414a8dc4fe1f11 (commit)
      from  12f146c45e6a2dc061d490d1614763cb6b8715ff (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit c7ad5a0afbc5b529918526f03fd651e66f7eb417
Author: Thorsten Glaser <tg at mirbsd.org>
Date:   Thu Jan 24 19:39:06 2013 +0000

    implement the LTO recompilation part

commit f5998a2a0b635a8b38a94e0eb63edcbfe10da36e
Author: Thorsten Glaser <tg at mirbsd.org>
Date:   Thu Jan 24 18:58:47 2013 +0000

    thoughts on more packaging issues: LTO

commit 342d94eb9efdfddf3f2e0780b34d99c075a375ca
Author: Thorsten Glaser <tg at mirbsd.org>
Date:   Thu Jan 24 18:52:49 2013 +0000

    add -regparm and -rtd ABI postfix to default target variant (M-A)
    
    of course, passing M-A options yourself, *you* have to do this

commit 3b3719ea5d75d11e3ed4ea61dc698389b9238697
Author: Thorsten Glaser <tg at mirbsd.org>
Date:   Thu Jan 24 18:49:28 2013 +0000

    DESTDIR support

commit 172af8225e6aa363ccec870858414a8dc4fe1f11
Author: Thorsten Glaser <tg at mirbsd.org>
Date:   Thu Jan 24 18:45:56 2013 +0000

    use proper /usr/lib*/ subdirectories for Multi-Arch

-----------------------------------------------------------------------

Summary of changes:
 Makefile             |   42 +++++++++++++++++++++---------
 Makefrag.inst        |   69 ++++++++++++++++++++++++++++++++++++++++++++++++++
 README               |   15 +++++++++++
 do-install           |   30 +++++++++++++++-------
 gcc-mk               |    6 ++---
 md/i386/Makefile.inc |    2 ++
 6 files changed, 140 insertions(+), 24 deletions(-)
 create mode 100644 Makefrag.inst

diff --git a/Makefile b/Makefile
index dbf7adc..edca1f0 100644
--- a/Makefile
+++ b/Makefile
@@ -49,18 +49,6 @@ all:
 obj:
 	mkdir -p ${.CURDIR:Q}/obj
 
-clean:
-	test -d ${.CURDIR:Q}/obj/.
-	rm -f *~ *.o *.a .conf-* ${CLEANFILES}
-
-cleandir: clean
-	rm -f ${DCLEANFILES}
-	rm -rf osdep
-
-install:
-	${SHELL} ${.CURDIR:Q}/do-install ${TG_CC:Q} ${DST:Q} \
-	    ${TG_ARCH:Q} ${TG_OS:Q} ${TG_CFLAGS:M*:Q}
-
 CPPFLAGS:=	-D_ALL_SOURCE
 CPPFLAGS+=	-I${LIBCDIR:Q}/include
 CPPFLAGS+=	-D__mirmincE_bootstrap -I${LIBCDIR:Q} -I${OBJADIR:Q}
@@ -74,11 +62,15 @@ LDADD:=
 .PATH: ${LIBCDIR}/md/${TG_ARCH}
 .PATH: ${LIBCDIR}/mi
 
+TG_VARIANT_DEF:=${TG_OS}-${TG_ARCH}
+
 .include "${LIBCDIR}/mi/Makefile.inc"
 .include "${LIBCDIR}/md/${TG_ARCH}/Makefile.inc"
 .include "${LIBCDIR}/osdep/${TG_OS}/Makefile.inc"
 .include "${LIBCDIR}/osdep/${TG_OS}/${TG_ARCH}/Makefile.inc"
 
+TG_VARIANT?=	${TG_VARIANT_DEF}
+
 .if !make(obj) && !make(depend) && !make(clean)
 .include "${LIBCDIR}/obj/Makefile.gen"
 .endif
@@ -180,8 +172,34 @@ libmince.a: ${COBJS}
 	ranlib $@~
 	mv -f $@~ $@
 
+install:
+	${SHELL} ${.CURDIR:Q}/do-install ${TG_CC:Q} ${DST:Q} \
+	    ${TG_ARCH:Q} ${TG_OS:Q} ${TG_CFLAGS:M*:Q} ${TG_VARIANT:Q}
+
+install-source: install .WAIT do-install-source
+do-install-source: gcc-mk gcc-spec gcc-wrap ${SRCS:M*.c}
+	mkdir -p "$$DESTDIR"${DST:Q}/libdata/${TG_VARIANT:Q}/source
+	print -r -- SRCS=${SRCS:M*.c:Q} \
+	    >"$$DESTDIR"${DST:Q}/libdata/${TG_VARIANT:Q}/source/Makefile
+.for _i in TG_CC DST TG_ARCH TG_OS TG_CFLAGS TG_VARIANT
+	print -r -- ${_i}=${${_i}:M*:Q} \
+	    >>"$$DESTDIR"${DST:Q}/libdata/${TG_VARIANT:Q}/source/Makefile
+.endfor
+	cat ${.CURDIR:Q}/Makefrag.inst \
+	    >>"$$DESTDIR"${DST:Q}/libdata/${TG_VARIANT:Q}/source/Makefile
+	cp -f ${.ALLSRC} "$$DESTDIR"${DST:Q}/libdata/${TG_VARIANT:Q}/source/
+.PHONY: install-source do-install-source
+
 regress:
 	@echo No regression tests here, but feel free to clone the
 	@echo mirmince/tests.git repository and play around with that.
 
+clean:
+	test -d ${.CURDIR:Q}/obj/.
+	rm -f *~ *.o *.a .conf-* ${CLEANFILES}
+
+cleandir: clean
+	rm -f ${DCLEANFILES}
+	rm -rf osdep
+
 .PHONY: obj clean cleandir depend all install regress
diff --git a/Makefrag.inst b/Makefrag.inst
new file mode 100644
index 0000000..46e88fe
--- /dev/null
+++ b/Makefrag.inst
@@ -0,0 +1,69 @@
+EXTRA_CFLAGS?=
+EXTRA_VARIANT?=
+USED_CFLAGS:=${TG_CFLAGS} ${EXTRA_CFLAGS}
+USED_VARIANT?=${TG_VARIANT}${EXTRA_VARIANT}
+OBJS=${SRCS:.c=.o}
+
+all:
+
+SHELL=		/bin/mksh
+OBJADIR!=	realpath .
+CC:=		${OBJADIR}/cc
+.if defined(V) && $V > 0
+CC+=		-v
+.endif
+
+obj:
+	mkdir -p ${.CURDIR:Q}/obj
+
+CPPFLAGS:=	-D_ALL_SOURCE
+CFLAGS:=
+.ifdef DEBUG
+CFLAGS+=	-g3
+.endif
+
+.SUFFIXES: .a .o .S .i .c .h
+.LIBS: .a
+
+COMPILE.S:=	${CC} -D_ASM_SOURCE ${CPPFLAGS} ${AFLAGS} -c
+COMPILE.c:=	${CC} ${CPPFLAGS} ${CFLAGS} -c
+
+.c.o:
+	${COMPILE.c} ${CFLAGS_${.TARGET:T:R}:M*} ${.IMPSRC}
+.c.i:
+	${COMPILE.c} ${CFLAGS_${.TARGET:T:R}:M*} ${.IMPSRC} -E -o $@
+
+cc:
+	${SHELL} ${.CURDIR:Q}/gcc-mk ${TG_CC:Q} ${DST:Q} \
+	    ${TG_ARCH:Q} ${TG_OS:Q} ${USED_CFLAGS:M*:Q} \
+	    ${OBJADIR:Q} ${OBJADIR:Q} ${OBJADIR:Q}
+
+all: cc .WAIT libmince.a
+
+libmince.a: ${OBJS}
+	ar rc $@~ ${OBJS}
+	ranlib $@~
+	mv -f $@~ $@
+
+install: all
+	mkdir -p "$$DESTDIR"${DST:Q}/lib{,data,exec}/${USED_VARIANT}
+	${SHELL} ${.CURDIR:Q}/gcc-mk ${TG_CC:Q} ${DST:Q} \
+	    ${TG_ARCH:Q} ${TG_OS:Q} ${USED_CFLAGS:M*:Q} \
+	    ${DST:Q}/libdata/${USED_VARIANT} \
+	    ${DST:Q}/libexec/${USED_VARIANT} \
+	    ${DST:Q}/lib/${USED_VARIANT}
+	-for y in libminze.a mince{beg,end}.o; do \
+		for x in {,"$$DESTDIR"}${DST:Q}/lib/${TG_VARIANT}/; do \
+			[[ -e $$x/$$y ]] || continue; \
+			cp "$$x/$$y" "$$DESTDIR"${DST:Q}/lib/${USED_VARIANT}/; \
+			break; \
+		done; \
+	done
+	cp libmince.a "$$DESTDIR"${DST:Q}/lib/${USED_VARIANT}/
+	@echo
+	@print -r -- "You can now use ${DST:Q}/libexec/${USED_VARIANT}/cc" \
+	    to compile.
+	@echo
+
+print-compiler-path:
+	@print -r -- ${DST:Q}/libexec/${USED_VARIANT}/cc
diff --git a/README b/README
index 747079c..b1107e9 100644
--- a/README
+++ b/README
@@ -14,11 +14,26 @@ variable expansion manipulation operators like :M :Q :S etc.
 
 On Debian/amd64 install pmake and expose CC='cc -m32' and
 LDEMULATION=elf_i386 to pmake depend and pmake install calls.
+You can set TG_VARIANT to DEB_HOST_MULTIARCH and even append
+things to further distinguish, like '-regparm-rtd' for ABI
+differences, or LTO GIMPLE versions, or '-bc' for an LLVM
+IR bytecode version. (The scripts-as-they-are-right-now are
+GCC specific, but that’s only by happenstance, not by design.)
+Some appropriate value may have been set by default.
 
 To use:
 
 $DST/bin/cc [-D_ALL_SOURCE] foo.c
 
+The install-source target additionally installs enough source
+code to recompile the part of the library implemented in C to
+add different CFLAGS e.g. to use a new GCC version’s “GIMPLE”
+form for LTO on the combination of libc and program. Example:
+	cd …/libdata/…/source
+	make install EXTRA_CFLAGS=-flto=jobserver \
+	    TG_CC=gcc-4.7 EXTRA_VARIANT=-gcc47_lto
+This will create a compiler wrapper: …/libexec/…-gcc47_lto/cc
+
 This is highly experimental and incomplete. New stuff is not
 added just so but only if needed and the code (users) cannot
 be rewritten to not need it. Even then, strcpy and things
diff --git a/do-install b/do-install
index 0cd2ac5..d0069ab 100644
--- a/do-install
+++ b/do-install
@@ -25,17 +25,29 @@ dst=$2
 arch=$3
 os=$4
 cflags=$5
+variant=$6
+
+vsub=${variant:+'/'$variant}
+vpfx=${variant:+$variant'-'}
+
+function linkfile {
+	ln -f "$1" "$2" || cp -f "$1" "$2"
+}
 
 cd "$(dirname "$0")"
-rm -rf "$dst"/{bin,include,lib,libdata}
-mkdir -p "$dst"/{bin,include,lib,libdata}
-cp LICENCE "$dst"/libdata/
-mksh gcc-mk "$cc" "$dst" "$arch" "$os" "$cflags"
-find include -name \*.h -print0 | pax -rw -0 "$dst"/
-find md osdep -name \*.h -print0 | pax -rw -0 "$dst"/include/mirmince/
-(cd obj; find osdep -name \*.h -print0 | pax -rw -0 "$dst"/include/mirmince/)
+rm -rf "$DESTDIR$dst"/{bin,include,lib{,data,exec}}
+mkdir -p "$DESTDIR$dst"/{bin,include,lib{,data,exec}$vsub}
+cp LICENCE "$DESTDIR$dst"/libdata/
+mksh gcc-mk "$cc" "$dst" "$arch" "$os" "$cflags" \
+    "$dst"/libdata$vsub "$dst"/libexec$vsub "$dst"/lib$vsub
+linkfile "$DESTDIR$dst"/libexec$vsub/cc "$DESTDIR$dst"/bin/${vpfx}cc
+linkfile "$DESTDIR$dst"/libexec$vsub/cc "$DESTDIR$dst"/bin/cc
+find include -name \*.h -print0 | pax -rw -0 "$DESTDIR$dst"/
+find md osdep -name \*.h -print0 | pax -rw -0 "$DESTDIR$dst"/include/mirmince/
+(cd obj; find osdep -name \*.h -print0 | \
+    pax -rw -0 "$DESTDIR$dst"/include/mirmince/)
 for f in obj/mince{beg,end}.o obj/*.a; do
 	[[ -s $f ]] || continue
-	cp "$f" "$dst"/lib/
+	cp "$f" "$DESTDIR$dst"/lib$vsub/
 done
-print "You can now use ${dst at Q}/bin/cc to compile."
+print -r "You can now use ${dst at Q}/bin/${vpfx}cc to compile."
diff --git a/gcc-mk b/gcc-mk
index e3f9f8b..b7a7f6c 100644
--- a/gcc-mk
+++ b/gcc-mk
@@ -53,7 +53,7 @@ cd "$(dirname "$0")"
 while IFS= read -r line; do
 	line=${line//@@LIBDIR@@/"${libodir at Q}"}
 	print -r -- "${line//@@DST@@/"${dst at Q}"}"
-done <gcc-spec >"$specdir"/cc-spec
+done <gcc-spec >"$DESTDIR$specdir"/cc-spec
 while IFS= read -r line; do
 	if [[ $line = @@DEFENV@@ ]]; then
 		if (( ${#defenv[*]} )); then
@@ -71,5 +71,5 @@ while IFS= read -r line; do
 	line=${line//@@DEFCFLAGS@@/"${cflags at Q}"}
 	line=${line//@@SPECDIR@@/"${specdir at Q}"}
 	print -r -- "${line//@@DST@@/"${dst at Q}"}"
-done <gcc-wrap >"$wrapdir"/cc
-chmod +x "$wrapdir"/cc
+done <gcc-wrap >"$DESTDIR$wrapdir"/cc
+chmod +x "$DESTDIR$wrapdir"/cc
diff --git a/md/i386/Makefile.inc b/md/i386/Makefile.inc
index acf40f0..c187f55 100644
--- a/md/i386/Makefile.inc
+++ b/md/i386/Makefile.inc
@@ -3,8 +3,10 @@ MD_USE_RTD?=		Yes
 
 .if ${MD_USE_REGPARM:L} == "yes"
 TG_CFLAGS+=		-mregparm=3 -D__mirmincE_use_regparm__=3
+TG_VARIANT_DEF:=	${TG_VARIANT_DEF}-regparm
 .endif
 
 .if ${MD_USE_RTD:L} == "yes"
 TG_CFLAGS+=		-mrtd -D__mirmincE_use_rtd__
+TG_VARIANT_DEF:=	${TG_VARIANT_DEF}-rtd
 .endif


hooks/post-receive
-- 
Main git repository for FreeWRT project mirmince
(FreeWRT project mirmince repository mirmince)


More information about the Mirmince-commits mailing list