Re: [RFC] Un-staticise the toolchain

From: Konstantin Belousov <kostikbel_at_gmail.com>
Date: Fri, 27 Apr 2012 14:47:02 +0300
On Fri, Apr 27, 2012 at 02:58:06PM +0400, Ruslan Ermilov wrote:
> Regarding your patch...
> 
> By placing SHARED_TOOLCHAIN to __DEFAULT_NO_OPTIONS list in
> bsd.own.mk, you already had MK_SHARED_TOOLCHAIN set to "no" by
> default, which preserves the current status quo of building
> toolchain static.  But you misspelled
> tools/build/options/WITH_STATIC_TOOLCHAIN, probably as the result
> of iteratively modifying your change.  The option and this file
> should be named WITH_SHARED_TOOLCHAIN, the opposite of the
> default.  Anyway, checking that the resulting src.conf(5) manpage
> sounds sensible is a good idea.  As for the contents of this file,
> I wouldn't call "ar/ranlib" a "librarian" but rather a "library
> archives manager", as per POSIX.  Your diff also suggests that it
> misses a newline at EOF.
Thank you for the suggestions.

Below is the variant that should handle all the commentary.

diff --git a/gnu/usr.bin/binutils/ar/Makefile b/gnu/usr.bin/binutils/ar/Makefile
index 464445e..6fe22c8 100644
--- a/gnu/usr.bin/binutils/ar/Makefile
+++ b/gnu/usr.bin/binutils/ar/Makefile
_at__at_ -1,6 +1,7 _at__at_
 # $FreeBSD$
 
 .include "../Makefile.inc0"
+.include <bsd.own.mk>
 
 .PATH: ${SRCDIR}/binutils ${SRCDIR}/binutils/doc
 
_at__at_ -16,7 +17,9 _at__at_ CFLAGS+= -D_GNU_SOURCE
 CFLAGS+= -I${.CURDIR}/${RELTOP}/libbinutils
 CFLAGS+= -I${SRCDIR}/binutils
 CFLAGS+= -I${SRCDIR}/bfd
+.if ${MK_SHARED_TOOLCHAIN} == "no"
 NO_SHARED?= yes
+.endif
 DPADD=	${RELTOP}/libbinutils/libbinutils.a
 DPADD+=	${RELTOP}/libbfd/libbfd.a
 DPADD+=	${RELTOP}/libiberty/libiberty.a
diff --git a/gnu/usr.bin/binutils/as/Makefile b/gnu/usr.bin/binutils/as/Makefile
index bf8df81..5fef1f3 100644
--- a/gnu/usr.bin/binutils/as/Makefile
+++ b/gnu/usr.bin/binutils/as/Makefile
_at__at_ -4,6 +4,7 _at__at_
 # BINDIR
 .include "${.CURDIR}/../../Makefile.inc"
 .include "${.CURDIR}/../Makefile.inc0"
+.include <bsd.own.mk>
 
 .PATH: ${SRCDIR}/gas ${SRCDIR}/gas/config
 
_at__at_ -79,7 +80,9 _at__at_ CFLAGS+= -D_GNU_SOURCE
 CFLAGS+= -I${SRCDIR}/gas -I${SRCDIR}/bfd -I${SRCDIR}/gas/config -I${SRCDIR}
 CFLAGS+= -I${.CURDIR} -I${.CURDIR}/${TARGET_CPUARCH}-freebsd
 
+.if ${MK_SHARED_TOOLCHAIN} == "no"
 NO_SHARED?=	yes
+.endif
 
 DPADD=	${RELTOP}/libbfd/libbfd.a
 DPADD+=	${RELTOP}/libiberty/libiberty.a
diff --git a/gnu/usr.bin/binutils/ld/Makefile b/gnu/usr.bin/binutils/ld/Makefile
index d4420ed..ef19afa 100644
--- a/gnu/usr.bin/binutils/ld/Makefile
+++ b/gnu/usr.bin/binutils/ld/Makefile
_at__at_ -1,6 +1,7 _at__at_
 # $FreeBSD$
 
 .include "../Makefile.inc0"
+.include <bsd.own.mk>
 
 .PATH: ${SRCDIR}/ld
 
_at__at_ -34,7 +35,9 _at__at_ CFLAGS+= -DBINDIR=\"${BINDIR}\" -DTARGET_SYSTEM_ROOT=\"${TOOLS_PREFIX}\"
 CFLAGS+= -DTOOLBINDIR=\"${TOOLS_PREFIX}/${BINDIR}/libexec\"
 CFLAGS+= -D_GNU_SOURCE
 CFLAGS+= -I${SRCDIR}/ld -I${SRCDIR}/bfd
+.if ${MK_SHARED_TOOLCHAIN} == "no"
 NO_SHARED?= yes
+.endif
 DPADD=	${RELTOP}/libbfd/libbfd.a
 DPADD+=	${RELTOP}/libiberty/libiberty.a
 LDADD=	${DPADD}
diff --git a/gnu/usr.bin/binutils/ranlib/Makefile b/gnu/usr.bin/binutils/ranlib/Makefile
index 8679375..052f9fe 100644
--- a/gnu/usr.bin/binutils/ranlib/Makefile
+++ b/gnu/usr.bin/binutils/ranlib/Makefile
_at__at_ -1,6 +1,7 _at__at_
 # $FreeBSD$
 
 .include "../Makefile.inc0"
+.include <bsd.own.mk>
 
 .PATH: ${SRCDIR}/binutils ${SRCDIR}/binutils/doc
 
_at__at_ -16,7 +17,9 _at__at_ CFLAGS+= -D_GNU_SOURCE
 CFLAGS+= -I${.CURDIR}/${RELTOP}/libbinutils
 CFLAGS+= -I${SRCDIR}/binutils
 CFLAGS+= -I${SRCDIR}/bfd
+.if ${MK_SHARED_TOOLCHAIN} == "no"
 NO_SHARED?= yes
+.endif
 DPADD=	${RELTOP}/libbinutils/libbinutils.a
 DPADD+=	${RELTOP}/libbfd/libbfd.a
 DPADD+=	${RELTOP}/libiberty/libiberty.a
diff --git a/gnu/usr.bin/cc/cc/Makefile b/gnu/usr.bin/cc/cc/Makefile
index 78c83a5..ba53565 100644
--- a/gnu/usr.bin/cc/cc/Makefile
+++ b/gnu/usr.bin/cc/cc/Makefile
_at__at_ -9,7 +9,9 _at__at_ PROG=	gcc
 MAN=	gcc.1
 SRCS+=  gccspec.c
 
+.if ${MK_SHARED_TOOLCHAIN} == "no"
 NO_SHARED?=yes
+.endif
 
 MLINKS=	gcc.1 g++.1
 .if ${MK_CLANG_IS_CC} == "no"
diff --git a/gnu/usr.bin/cc/cc1/Makefile b/gnu/usr.bin/cc/cc1/Makefile
index c65acd2..7b1e343 100644
--- a/gnu/usr.bin/cc/cc1/Makefile
+++ b/gnu/usr.bin/cc/cc1/Makefile
_at__at_ -1,14 +1,17 _at__at_
 # $FreeBSD$
 
 .include "../Makefile.inc"
+NO_MAN=
+.include <bsd.own.mk>
 
 .PATH: ${GCCDIR}
 
 PROG=	cc1
 SRCS=	main.c c-parser.c c-lang.c
 BINDIR=	/usr/libexec
-NO_MAN=
+.if ${MK_SHARED_TOOLCHAIN} == "no"
 NO_SHARED?=yes
+.endif
 
 OBJS+=  ${PROG}-checksum.o
 DPADD=	${LIBBACKEND} ${LIBCPP} ${LIBDECNUMBER} ${LIBIBERTY}
diff --git a/gnu/usr.bin/cc/cc1plus/Makefile b/gnu/usr.bin/cc/cc1plus/Makefile
index 964d20f..dd3d524 100644
--- a/gnu/usr.bin/cc/cc1plus/Makefile
+++ b/gnu/usr.bin/cc/cc1plus/Makefile
_at__at_ -1,6 +1,8 _at__at_
 # $FreeBSD$
 
 .include "../Makefile.inc"
+NO_MAN=
+.include <bsd.own.mk>
 
 .PATH: ${GCCDIR}/cp ${GCCDIR}
 
_at__at_ -13,8 +15,9 _at__at_ SRCS+=	main.c cp-lang.c c-opts.c call.c class.c cvt.c cxx-pretty-print.c \
 	cp-objcp-common.c cp-gimplify.c tree-mudflap.c
 
 BINDIR=	/usr/libexec
-NO_MAN=
+.if ${MK_SHARED_TOOLCHAIN} == "no"
 NO_SHARED?=yes
+.endif
 
 CFLAGS+= -I${GCCDIR}/cp -I.
 
diff --git a/share/mk/bsd.own.mk b/share/mk/bsd.own.mk
index 55d6ba2..b0acbfd 100644
--- a/share/mk/bsd.own.mk
+++ b/share/mk/bsd.own.mk
_at__at_ -425,7 +425,8 _at__at_ __DEFAULT_NO_OPTIONS = \
     ICONV \
     IDEA \
     LIBCPLUSPLUS \
-    OFED
+    OFED \
+    SHARED_TOOLCHAIN
 
 #
 # Default behaviour of some options depends on the architecture.  Unfortunately
diff --git a/tools/build/options/WITH_SHARED_TOOLCHAIN b/tools/build/options/WITH_SHARED_TOOLCHAIN
new file mode 100644
index 0000000..48eea6d
--- /dev/null
+++ b/tools/build/options/WITH_SHARED_TOOLCHAIN
_at__at_ -0,0 +1,6 _at__at_
+.\" $FreeBSD$
+Set to build the toolchain binaries shared.
+The set includes
+.Xr cc 1 ,
+.Xr make 1
+and neccessary utilites like assembler, linker and library archive manager.
diff --git a/usr.bin/ar/Makefile b/usr.bin/ar/Makefile
index e373120..e9bb893 100644
--- a/usr.bin/ar/Makefile
+++ b/usr.bin/ar/Makefile
_at__at_ -1,5 +1,7 _at__at_
 # $FreeBSD$
 
+.include <bsd.own.mk>
+
 PROG=	ar
 SRCS=	ar.c acplex.l acpyacc.y read.c util.c write.c y.tab.h
 
_at__at_ -8,7 +10,9 _at__at_ LDADD=	-larchive -lelf
 
 CFLAGS+=-I. -I${.CURDIR}
 
+.if ${MK_SHARED_TOOLCHAIN} == "no"
 NO_SHARED?=	yes
+.endif
 LINKS=	${BINDIR}/ar ${BINDIR}/ranlib
 MLINKS= ar.1 ranlib.1
 
diff --git a/usr.bin/make/Makefile b/usr.bin/make/Makefile
index 2dc7e58..f67cf50 100644
--- a/usr.bin/make/Makefile
+++ b/usr.bin/make/Makefile
_at__at_ -2,13 +2,17 _at__at_
 #	$Id: Makefile,v 1.6 1994/06/30 05:33:39 cgd Exp $
 # $FreeBSD$
 
+.include <bsd.own.mk>
+
 PROG=	make
 CFLAGS+=-I${.CURDIR}
 SRCS=	arch.c buf.c cond.c dir.c for.c hash.c hash_tables.c job.c	\
 	lst.c main.c make.c parse.c proc.c shell.c str.c suff.c targ.c	\
 	util.c var.c
 
+.if ${MK_SHARED_TOOLCHAIN} == "no"
 NO_SHARED?=	YES
+.endif
 
 # Version has the RYYYYMMDDX format, where R is from RELENG_<R>
 CFLAGS+=-DMAKE_VERSION=\"5201111300\"

Received on Fri Apr 27 2012 - 09:47:07 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:26 UTC