commit d749785180270f21f7856b9bbc5561b9f6ea7973
parent edfd5be2989a75d6a69e084a3dd6b002ce9fcbe3
Author: Kyle Milz <kyle@0x30.net>
Date: Sun, 25 Dec 2016 13:12:38 -0700
src: move CLANG_LIBS into configure script
Diffstat:
M | configure | | | 110 | +++++++++++++++++++++++++++++++++++-------------------------------------------- |
M | src/Jamfile | | | 27 | +++++---------------------- |
2 files changed, 53 insertions(+), 84 deletions(-)
diff --git a/configure b/configure
@@ -1,43 +1,50 @@
#!/bin/sh -eu
#
-# ░█▀▀░░░▀█▀░▀█▀░░░█▀▄░█░█░█▀█
-# ░█░░░░░░█░░░█░░░░█▀▄░█░█░█░█
-# ░▀▀▀░░░▀▀▀░░▀░░░░▀░▀░▀▀▀░▀░▀
-#
-# Creates Jamrules file.
+# Checks that a bunch of crap is installed, creates Jamrules file.
#
+uname=`uname`
+echo ░█▀▀░░░▀█▀░▀█▀░░░█▀▄░█░█░█▀█
+echo ░█░░░░░░█░░░█░░░░█▀▄░█░█░█░█
+echo ░▀▀▀░░░▀▀▀░░▀░░░░▀░▀░▀▀▀░▀░▀
+echo C It Run 0.0 on $uname
+echo
+
+# These binaries are assumed throughout so make sure they are available.
type pkg-config
type llvm-config
+type jam
+echo
-#
-# Check for C++11 compiler.
-#
-touch __test.cc
-${CXX-c++} -std=c++11 -c __test.cc
-
-#
-# llvm/clang versions must be >= 3.7
-#
-llvm-config --version
+# C++11 required.
+${CXX-c++} -x c++ -std=c++11 -E - < /dev/null > /dev/null
-#
-# Check for pkg-config available software. Try and print a nice missing list.
-#
+# citrun-gltest needs osmesa and both it and citrun-gl need the rest.
gl_pkgs="osmesa glfw3 glew freetype2"
-
-should_exit=0
for pkg in $gl_pkgs; do
- if ! pkg-config --exists $pkg; then
- echo "$pkg not found"
- should_exit=1
- fi
+ printf "%10s = " $pkg
+ pkg-config --modversion $pkg || (echo "not found" && exit 1)
done
-test $should_exit -eq 0 || exit 1
+echo
-#
-# Write Jamrules which consists of {llvm,pkg}-config calls getting various flags
-# and library names. Note any errors inside backticks will be ignored.
-#
+if [ $uname = OpenBSD ]; then
+ LDGROUP_START="-Wl,--start-group"
+ LDGROUP_END="-Wl,--end-group"
+ FONT_PATH="/usr/X11R6/lib/X11/fonts/TTF/DejaVuSansMono.ttf"
+elif [ $uname = Darwin ]; then
+ GL_EXTRALIB="-framework OpenGL"
+ FONT_PATH="/Library/Fonts/Andale Mono.ttf"
+elif [ $uname = Linux ]; then
+ GL_EXTRALIB="-lbsd"
+ INST_EXTRALIB="-lbsd"
+ LDGROUP_START="-Wl,--start-group"
+ LDGROUP_END="-Wl,--end-group"
+ FONT_PATH="/usr/share/fonts/truetype/dejavu/DejaVuSansMono.ttf"
+else
+ echo WARNING: Platform $uname not tested. Compilation may fail.
+ echo
+fi
+
+# Write top of Jamrules. Note any errors inside backticks will be ignored.
cat <<EOF > Jamrules
CC = ${CC-cc} ;
C++ = ${CXX-c++} ;
@@ -46,46 +53,25 @@ CCFLAGS += "${CFLAGS-}" ;
C++FLAGS += -std=c++11 -fno-exceptions -fno-rtti ${CFLAGS-} ;
LINKFLAGS += "${LDFLAGS-}" ;
+FONT_PATH = "${FONT_PATH}" ;
CITRUN_SRCDIR = "`pwd`/src" ;
GL_CFLAGS = "`pkg-config --cflags glfw3 glew freetype2`" ;
-GL_LIBS = "`pkg-config --libs glfw3 glew freetype2`" ;
+GL_LIBS = "${GL_EXTRALIB-} `pkg-config --libs glfw3 glew freetype2`" ;
GLTEST_LIBS = "`pkg-config --libs osmesa`" ;
INST_CFLAGS = "`llvm-config --cxxflags`" ;
INST_LDFLAGS = "`llvm-config --ldflags`" ;
-INST_LIBS = "`llvm-config --libs bitreader mcparser transformutils option`" ;
-INST_LIBS += "`llvm-config --system-libs`" ;
-
-# Generated by './configure' on `date`
-echo ...build C It Run on \$(OS)... ;
-
-if \$(OS) = OPENBSD {
- LDGROUP_START = -Wl,--start-group ;
- LDGROUP_END = -Wl,--end-group ;
- FONT_PATH = "/usr/X11R6/lib/X11/fonts/TTF/DejaVuSansMono.ttf" ;
-}
-else if \$(OS) = MACOSX {
- LINKLIBS on citrun-gl = -framework OpenGL ;
- FONT_PATH "/Library/Fonts/Andale Mono.ttf" ;
-}
-else if \$(OS) = LINUX {
- LINKLIBS on citrun-gl citrun-inst = -lbsd ;
- LDGROUP_START = -Wl,--start-group ;
- LDGROUP_END = -Wl,--end-group ;
- FONT_PATH = "/usr/share/fonts/truetype/dejavu/DejaVuSansMono.ttf" ;
-}
-else {
- echo "WARNING: FONT_PATH not configured" ;
-}
-
+INST_LIBS = "${INST_EXTRALIB-} ${LDGROUP_START-} -lclangAST -lclangAnalysis \
+-lclangBasic -lclangDriver \
+-lclangEdit -lclangFrontend -lclangFrontendTool -lclangLex -lclangParse \
+-lclangRewrite -lclangRewriteFrontend -lclangSema -lclangSerialization \
+-lclangTooling ${LDGROUP_END-} \
+`llvm-config --libs bitreader mcparser transformutils option` \
+`llvm-config --system-libs`" ;
EOF
+echo === Configuration Summary ===================================================
+cat Jamrules
+echo =============================================================================
cat Jamrules.tail >> Jamrules
-
-echo
-echo === Configuration Summary ==============================================
-head -n 8 Jamrules
-echo ========================================================================
-echo
-echo "...call \`jam\` to build..."
diff --git a/src/Jamfile b/src/Jamfile
@@ -40,8 +40,7 @@ ReplaceTokens citrun-wrap ;
# citrun-term
#
#LINKLIBS on citrun-term += -lcurses ;
-# XXX: Not the main focus right now.
-# Main citrun-term : term_main.cc ;
+#Main citrun-term : term_main.cc ;
#
# citrun-gl & citrun-gltest
@@ -70,9 +69,9 @@ ObjectC++Flags gl_main.cc gl_testmain.cc $(GL_SRCS) : $(GL_CFLAGS) ;
LINKLIBS on citrun-gl citrun-gltest += -lm $(GL_LIBS) ;
LinkLibraries citrun-gl citrun-gltest : gl_common libglyphy ;
-LINKLIBS on citrun-gltest += $(GLTEST_LIBS) ;
-
Main citrun-gl : gl_main.cc ;
+
+LINKLIBS on citrun-gltest += $(GLTEST_LIBS) ;
Main citrun-gltest : gl_testmain.cc ;
#
@@ -84,35 +83,19 @@ INST_SRCS =
inst_action.cc
inst_visitor.cc ;
-CLANG_LIBS =
- -lclangAST
- -lclangAnalysis
- -lclangBasic
- -lclangDriver
- -lclangEdit
- -lclangFrontend
- -lclangFrontendTool
- -lclangLex
- -lclangParse
- -lclangRewrite
- -lclangRewriteFrontend
- -lclangSema
- -lclangSerialization
- -lclangTooling ;
-
Stringize lib_h.h : lib.h ;
ObjectC++Flags $(INST_SRCS) : $(INST_CFLAGS) ;
ObjectDefines $(INST_SRCS) : CITRUN_SHARE=\\\"$(CITRUN_SHARE)\\\" ;
LINKFLAGS on citrun-inst = $(LINKFLAGS) $(INST_LDFLAGS) ;
-LINKLIBS on citrun-inst += $(LDGROUP_START) $(CLANG_LIBS) $(LDGROUP_END) $(INST_LIBS) ;
+LINKLIBS on citrun-inst += $(INST_LIBS) ;
Main citrun-inst : $(INST_SRCS) ;
# Link with the c++ compiler so that the matching c++ runtime library gets added
# automatically.
-LINK on citrun-inst citrun-term citrun-gl citrun-gltest = $(C++) ;
+LINK on citrun-inst citrun-gl citrun-gltest = $(C++) ;
#
# install