Fix version string returned by clang --version.

Integrate the in-tree config file generation with the cross-building
toolchain.  Regenerate the files.
Keep version numbers all in one place.
This commit is contained in:
joerg 2012-06-17 07:40:25 +00:00
parent e11304f45e
commit 062cd24989
10 changed files with 122 additions and 60 deletions

View File

@ -1,12 +1,16 @@
# $NetBSD: Makefile.inc,v 1.36 2012/06/16 17:01:03 joerg Exp $
# $NetBSD: Makefile.inc,v 1.37 2012/06/17 07:40:25 joerg Exp $
.if !defined(LLVM_TOPLEVEL_MK)
LLVM_TOPLEVEL_MK=
.include <bsd.own.mk>
LLVM_REVISION= 158533
CLANG_REVISION= 158533
COMMON_REVISION= 158533
LLVM_REVISION= ${COMMON_REVISION}
CLANG_REVISION= ${COMMON_REVISION}
LLVM_VERSION= 3.2
CLANG_VERSION= 3.2
LLVM_SRCDIR:= ${.PARSEDIR}/dist/llvm
CLANG_SRCDIR:= ${.PARSEDIR}/dist/clang
@ -27,14 +31,16 @@ HOST_CXXFLAGS+= -O2 -g
LLVM_INCLUDE_CONFIG= ${LLVM_TOPLEVEL}/config
CLANG_INCLUDE_CONFIG= ${LLVM_TOPLEVEL}/config
LLVM_INCLUDE_OBJDIR!= cd ${LLVM_TOPLEVEL}/include && ${PRINTOBJDIR}
CPPFLAGS+= -DLLVM_DEFAULT_TARGET_TRIPLE="\"${MACHINE_GNU_PLATFORM}\""
.endif
CPPFLAGS+= -I${LLVM_INCLUDE_OBJDIR} -I${LLVM_INCLUDE_CONFIG} \
-I${CLANG_INCLUDE_CONFIG}
# ./configure --enable-targets=x86,powerpc,sparc,arm,mips \
# --with-c-include-dirs=/usr/include/clang-3.2:/usr/include \
# --disable-timestamps --prefix=/usr --sysconfdir=/etc/llvm \
# --disable-threads
LLVM_CONFIGURE_ARGS= \
--enable-targets=x86,powerpc,sparc,arm,mips \
--with-c-include-dirs=/usr/include/clang-${CLANG_VERSION}:/usr/include \
--disable-timestamps --prefix=/usr --sysconfdir=/etc/llvm \
--with-clang-srcdir=${CLANG_SRCDIR} \
--host=${MACHINE_GNU_PLATFORM} \
llvm_cv_gnu_make_command=${MAKE}
.endif

View File

@ -1,6 +0,0 @@
#define CLANG_VERSION 3.1
#define CLANG_VERSION_MAJOR 3
#define CLANG_VERSION_MINOR 1
#if 0
#define CLANG_VERSION_PATCHLEVEL
#endif

View File

@ -10,13 +10,16 @@
/* Relative directory for resource files */
#define CLANG_RESOURCE_DIR ""
/* Directory where gcc is installed. */
#define GCC_INSTALL_PREFIX ""
/* Directories clang will search for headers */
#define C_INCLUDE_DIRS "/usr/include/clang-3.2:/usr/include"
/* Linker version detected at compile time. */
#define HOST_LINK_VERSION "2.22"
/* Default <path> to all compiler invocations for --sysroot=<path>. */
#define DEFAULT_SYSROOT ""
/* Directory where gcc is installed. */
#define GCC_INSTALL_PREFIX ""
#endif

View File

@ -24,6 +24,6 @@
# error Please define the macro LLVM_DISASSEMBLER(TargetName)
#endif
LLVM_DISASSEMBLER(X86) LLVM_DISASSEMBLER(ARM)
LLVM_DISASSEMBLER(X86) LLVM_DISASSEMBLER(ARM) LLVM_DISASSEMBLER(Mips)
#undef LLVM_DISASSEMBLER

View File

@ -25,6 +25,9 @@
/* Directory where gcc is installed. */
#define GCC_INSTALL_PREFIX ""
/* Define to 1 if you have the `arc4random' function. */
#define HAVE_ARC4RANDOM 1
/* Define to 1 if you have the `argz_append' function. */
/* #undef HAVE_ARGZ_APPEND */
@ -112,7 +115,7 @@
/* #undef HAVE_ERROR_T */
/* Define to 1 if you have the <execinfo.h> header file. */
/* #undef HAVE_EXECINFO_H */
#define HAVE_EXECINFO_H 1
/* Define to 1 if you have the <fcntl.h> header file. */
#define HAVE_FCNTL_H 1
@ -199,7 +202,7 @@
/* #undef HAVE_LIBPSAPI */
/* Define to 1 if you have the `pthread' library (-lpthread). */
/* #undef HAVE_LIBPTHREAD */
#define HAVE_LIBPTHREAD 1
/* Define to 1 if you have the `udis86' library (-ludis86). */
/* #undef HAVE_LIBUDIS86 */
@ -294,16 +297,16 @@
#define HAVE_PRINTF_A 1
/* Have pthread_getspecific */
/* #undef HAVE_PTHREAD_GETSPECIFIC */
#define HAVE_PTHREAD_GETSPECIFIC 1
/* Define to 1 if you have the <pthread.h> header file. */
/* #undef HAVE_PTHREAD_H */
#define HAVE_PTHREAD_H 1
/* Have pthread_mutex_lock */
/* #undef HAVE_PTHREAD_MUTEX_LOCK */
#define HAVE_PTHREAD_MUTEX_LOCK 1
/* Have pthread_rwlock_init */
/* #undef HAVE_PTHREAD_RWLOCK_INIT */
#define HAVE_PTHREAD_RWLOCK_INIT 1
/* Define to 1 if srand48/lrand48/drand48 exist in <stdlib.h> */
#define HAVE_RAND48 1
@ -363,7 +366,7 @@
#define HAVE_STDLIB_H 1
/* Set to 1 if the std::isinf function is found in <cmath> */
/* #undef HAVE_STD_ISINF_IN_CMATH */
#define HAVE_STD_ISINF_IN_CMATH 1
/* Set to 1 if the std::isnan function is found in <cmath> */
#define HAVE_STD_ISNAN_IN_CMATH 1
@ -524,27 +527,25 @@
/* #undef HAVE____CHKSTK */
/* Linker version detected at compile time. */
#define HOST_LINK_VERSION "1"
#define HOST_LINK_VERSION "2.22"
/* Installation directory for binary executables */
#define LLVM_BINDIR "/usr/bin"
/* Time at which LLVM was configured */
#define LLVM_CONFIGTIME "Tue Feb 28 15:53:15 UTC 2012"
#define LLVM_CONFIGTIME "(timestamp not enabled)"
/* Installation directory for data files */
#define LLVM_DATADIR "/usr/share/llvm"
/* Target triple LLVM will generate code for by default */
#if 0
#define LLVM_DEFAULT_TARGET_TRIPLE "x86_64--netbsd"
#endif
/* Installation directory for documentation */
#define LLVM_DOCSDIR "/usr/share/doc/llvm"
/* Define if threads enabled */
#define LLVM_ENABLE_THREADS 0
#define LLVM_ENABLE_THREADS 1
/* Installation directory for config files */
#define LLVM_ETCDIR "/usr/etc/llvm"
@ -573,6 +574,9 @@
/* LLVM name for the native AsmPrinter init function, if available */
#define LLVM_NATIVE_ASMPRINTER LLVMInitializeX86AsmPrinter
/* LLVM name for the native Disassembler init function, if available */
#define LLVM_NATIVE_DISASSEMBLER LLVMInitializeX86Disassembler
/* LLVM name for the native Target init function, if available */
#define LLVM_NATIVE_TARGET LLVMInitializeX86Target
@ -618,11 +622,17 @@
/* Installation prefix directory */
#define LLVM_PREFIX "/usr"
/* Define if we have the Intel JIT API runtime support library */
#define LLVM_USE_INTEL_JITEVENTS 0
/* Define if we have the oprofile JIT-support library */
#define LLVM_USE_OPROFILE 0
/* Major version of the LLVM API */
#define LLVM_VERSION_MAJOR 3
/* Minor version of the LLVM API */
#define LLVM_VERSION_MINOR 1
#define LLVM_VERSION_MINOR 2
/* Define if the OS needs help to load dependent libraries for dlopen(). */
/* #undef LTDL_DLOPEN_DEPLIBS */
@ -655,13 +665,13 @@
#define PACKAGE_NAME "LLVM"
/* Define to the full name and version of this package. */
#define PACKAGE_STRING "LLVM 3.1svn"
#define PACKAGE_STRING "LLVM 3.2svn"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "llvm"
/* Define to the version of this package. */
#define PACKAGE_VERSION "3.1svn"
#define PACKAGE_VERSION "3.2svn"
/* Define as the return type of signal handlers (`int' or `void'). */
#define RETSIGTYPE void
@ -678,9 +688,6 @@
/* Define to 1 if your <sys/time.h> declares `struct tm'. */
/* #undef TM_IN_SYS_TIME */
/* Define if we have the oprofile JIT-support library */
#define USE_OPROFILE 0
/* Define if use udis86 library */
#define USE_UDIS86 0

View File

@ -21,21 +21,19 @@
#define LLVM_BINDIR "/usr/bin"
/* Time at which LLVM was configured */
#define LLVM_CONFIGTIME "Tue Feb 28 15:53:15 UTC 2012"
#define LLVM_CONFIGTIME "(timestamp not enabled)"
/* Installation directory for data files */
#define LLVM_DATADIR "/usr/share/llvm"
/* Target triple LLVM will generate code for by default */
#if 0
#define LLVM_DEFAULT_TARGET_TRIPLE "x86_64--netbsd"
#endif
/* Installation directory for documentation */
#define LLVM_DOCSDIR "/usr/share/doc/llvm"
/* Define if threads enabled */
#define LLVM_ENABLE_THREADS 0
#define LLVM_ENABLE_THREADS 1
/* Installation directory for config files */
#define LLVM_ETCDIR "/usr/etc/llvm"
@ -64,6 +62,9 @@
/* LLVM name for the native AsmPrinter init function, if available */
#define LLVM_NATIVE_ASMPRINTER LLVMInitializeX86AsmPrinter
/* LLVM name for the native Disassembler init function, if available */
#define LLVM_NATIVE_DISASSEMBLER LLVMInitializeX86Disassembler
/* LLVM name for the native Target init function, if available */
#define LLVM_NATIVE_TARGET LLVMInitializeX86Target
@ -113,6 +114,6 @@
#define LLVM_VERSION_MAJOR 3
/* Minor version of the LLVM API */
#define LLVM_VERSION_MINOR 1
#define LLVM_VERSION_MINOR 2
#endif

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.10 2012/06/16 17:01:03 joerg Exp $
# $NetBSD: Makefile,v 1.11 2012/06/17 07:40:26 joerg Exp $
.include <bsd.init.mk>
@ -30,7 +30,7 @@ INCS= ammintrin.h \
.elif ${MACHINE_ARCH} == "powerpc"
INCS= altivec.h
.endif
INCSDIR= /usr/include/clang-3.2
INCSDIR= /usr/include/clang-${CLANG_VERSION}
HEADER= \
float.h \
@ -101,6 +101,64 @@ CLANG_TABLEGEN_OUTPUT.CC1AsOptions.td= \
.include "${.PARSEDIR}/../tablegen.mk"
DPSRCS+= clang/Basic/Version.inc
CLEANFILES+= clang/Basic/Version.inc
clang/Basic/Version.inc: ${LLVM_TOPLEVEL}/Makefile.inc
mkdir -p ${.TARGET:H}
printf '#define CLANG_VERSION ${CLANG_VERSION}\n' > ${.TARGET}.tmp
printf '#define CLANG_VERSION_MAJOR ${CLANG_VERSION:C,\.[0-9]*,,}\n' >> ${.TARGET}.tmp
printf '#define CLANG_VERSION_MINOR ${CLANG_VERSION:C,[0-9]*\.,,}\n' >> ${.TARGET}.tmp
mv ${.TARGET}.tmp ${.TARGET}
.ifndef HOST_BUILD
DPSRCS+= llvm/Config/config.h llvm/Config/llvm-config.h
CLEANFILES+= llvm/Config/config.h llvm/Config/llvm-config.h
llvm/Config/config.h: ${LLVM_TOPLEVEL}/Makefile.inc ${LLVM_TOPLEVEL}/config/llvm/Config/config.h.in
mkdir -p ${.TARGET:H}
${TOOL_SED} -e /LLVM_DEFAULT_TARGET_TRIPLE/d -e /LLVM_NATIVE_/d \
-e /LLVM_VERSION_/d -e /PACKAGE_VERSION/d \
-e /\#endif/d \
< ${LLVM_TOPLEVEL}/config/llvm/Config/config.h.in \
> ${.TARGET}.tmp
printf '#define LLVM_DEFAULT_TARGET_TRIPLE "${MACHINE_GNU_PLATFORM}"\n' >> ${.TARGET}.tmp
printf '#define PACKAGE_VERSION "${LLVM_VERSION} (trunk ${LLVM_REVISION})"\n' >> ${.TARGET}.tmp
printf '#define LLVM_VERSION_MAJOR ${LLVM_VERSION:C,\.[0-9]*,,}\n' >> ${.TARGET}.tmp
printf '#define LLVM_VERSION_MINOR ${LLVM_VERSION:C,[0-9]*\.,,}\n' >> ${.TARGET}.tmp
printf '#endif\n' >> ${.TARGET}.tmp
mv ${.TARGET}.tmp ${.TARGET}
llvm/Config/llvm-config.h: ${LLVM_TOPLEVEL}/Makefile.inc ${LLVM_TOPLEVEL}/config/llvm/Config/llvm-config.h.in
mkdir -p ${.TARGET:H}
${TOOL_SED} -e /LLVM_DEFAULT_TARGET_TRIPLE/d -e /LLVM_NATIVE_/d \
-e /LLVM_VERSION_/d -e /PACKAGE_VERSION/d \
-e /\#endif/d \
< ${LLVM_TOPLEVEL}/config/llvm/Config/llvm-config.h.in \
> ${.TARGET}.tmp
printf '#define LLVM_DEFAULT_TARGET_TRIPLE "${MACHINE_GNU_PLATFORM}"\n' >> ${.TARGET}.tmp
printf '#define LLVM_VERSION_MAJOR ${LLVM_VERSION:C,\.[0-9]*,,}\n' >> ${.TARGET}.tmp
printf '#define LLVM_VERSION_MINOR ${LLVM_VERSION:C,[0-9]*\.,,}\n' >> ${.TARGET}.tmp
printf '#endif\n' >> ${.TARGET}.tmp
mv ${.TARGET}.tmp ${.TARGET}
run-configure:
[ ! -d tmp ] || rm -r tmp
mkdir -p tmp
cd tmp && ${LLVM_SRCDIR}/configure ${LLVM_CONFIGURE_ARGS} \
CC=${CC:Q} CFLAGS=${CFLAGS:N-Werror:Q} CXX=${CXX:Q} CXXFLAGS=${CXXFLAGS:N-Werror:Q} \
CPPFLAGS=${CPPFLAGS:Q} LDFLAGS=${LDFLAGS:Q} LD=${LD:Q} LIBS=-lm \
ac_cv_func_mmap_fixed_mapped=yes ac_cv_func_mmap_file=yes llvm_cv_c_printf_a=yes
cp -r tmp/include/llvm/* ${LLVM_INCLUDE_CONFIG}/llvm/
mv ${LLVM_INCLUDE_CONFIG}/llvm/Config/config.h \
${LLVM_INCLUDE_CONFIG}/llvm/Config/config.h.in
mv ${LLVM_INCLUDE_CONFIG}/llvm/Config/llvm-config.h \
${LLVM_INCLUDE_CONFIG}/llvm/Config/llvm-config.h.in
cp -r tmp/tools/clang/include/clang/* ${CLANG_INCLUDE_CONFIG}/clang/
rm -r tmp
.endif
depend dependall all: ${DPSRCS}
.include <bsd.prog.mk>

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.4 2011/12/11 14:58:50 joerg Exp $
# $NetBSD: Makefile,v 1.5 2012/06/17 07:40:26 joerg Exp $
LIB= clangBasic
@ -23,7 +23,8 @@ SRCS+= Builtins.cpp \
Version.cpp \
VersionTuple.cpp
CPPFLAGS.version.cpp= -DSVN_REVISON=\"${CLANG_REVISION}\"
CPPFLAGS.Version.cpp= -DSVN_REVISION=\"${CLANG_REVISION}\" \
-DLLVM_REVISION=\"${LLVM_REVISION}\"
.if defined(HOSTLIB)
.include <bsd.hostlib.mk>

View File

@ -1,4 +1,6 @@
# $NetBSD: Makefile,v 1.1 2011/02/06 01:14:11 joerg Exp $
# $NetBSD: Makefile,v 1.2 2012/06/17 07:40:25 joerg Exp $
HOST_BUILD=
.include "${.PARSEDIR}/../llvm/Makefile.inc"

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.14 2012/06/16 17:01:04 joerg Exp $
# $NetBSD: Makefile,v 1.15 2012/06/17 07:40:25 joerg Exp $
.include <bsd.init.mk>
@ -9,22 +9,12 @@
.include "Makefile.inc"
.include "${LLVM_TOPLEVEL}/lib/Makefile.inc"
realdepends realall: config/config.status need-dl \
config/include/clang/Basic/Version.inc
config/include/clang/Basic/Version.inc: \
${LLVM_TOPLEVEL}/config/clang/Basic/Version.inc
mkdir -p ${.TARGET:H}
cat < ${.ALLSRC} > ${.TARGET}
realdepends realall: config/config.status need-dl
config/config.status: ${LLVM_SRCDIR}/configure
mkdir -p config
cd config && ${LLVM_SRCDIR}/configure CC=${HOST_CC:Q} --prefix=/usr \
--enable-targets=x86,powerpc,sparc,arm,mips \
--host=${MACHINE_GNU_PLATFORM} \
--with-c-include-dirs=/usr/include/clang-3.2:/usr/include \
--with-clang-srcdir=${CLANG_SRCDIR} \
--enable-optimized llvm_cv_gnu_make_command=${MAKE}
cd config && ${LLVM_SRCDIR}/configure ${LLVM_CONFIGURE_ARGS} \
--enable-optimized CC=${HOST_CC:Q}
# --disable-assertions
need-dl: