diff --git a/Makefile b/Makefile index 2ede0f32..18d5fdee 100644 --- a/Makefile +++ b/Makefile @@ -144,10 +144,12 @@ ICG_EXE := ${TRICK_HOME}/bin/trick-ICG # 1 Build Trick-core and Trick Data-products. all: no_dp webserver dp @ echo ; echo "Trick compilation complete:" ; date - +#ifeq ($(TRICK_OFFLINE), 1) +#all: copy_offline ifeq ($(USE_JAVA), 1) all: java endif +#endif #------------------------------------------------------------------------------- # 1.1 Build Trick-core @@ -214,7 +216,7 @@ dp: ${TRICK_HOME}/trick_source/trick_utils/units # .PHONY: webserver webserver: ${TRICK_LIB_DIR}/libmongoose.a ${TRICK_HOME}/include/mongoose/mongoose.h - @ $(MAKE) -C ${TRICK_HOME}/trick_source/web/HttpServer + $(MAKE) -C ${TRICK_HOME}/trick_source/web/HttpServer #------------------------------------------------------------------------------- TRICK_ICG_EXCLUDE += ${TRICK_HOME}/include/mongoose @@ -225,31 +227,51 @@ mongoose.h: mongoose.c: curl --retry 4 -O https://raw.githubusercontent.com/cesanta/mongoose/6.16/mongoose.c +${TRICK_LIB_DIR}/libmongoose.a: ${TRICK_HOME}/include/mongoose/mongoose.h | mongoose.o $(TRICK_LIB_DIR) + ar crs $@ mongoose.o + @ rm mongoose.o + @ rm -f mongoose.h + @ echo ; echo "Mongoose library compiled:" ; date + +ifeq (${TRICK_OFFLINE}, 0) + mongoose.o: mongoose.h mongoose.c $(CC) $(TRICK_CFLAGS) -c -o mongoose.o mongoose.c - rm mongoose.c - -${TRICK_LIB_DIR}/libmongoose.a: mongoose.o ${TRICK_HOME}/include/mongoose/mongoose.h | $(TRICK_LIB_DIR) - ar crs $@ mongoose.o - rm mongoose.o - rm mongoose.h - @ echo ; echo "Mongoose library compiled:" ; date + @ rm mongoose.c ${TRICK_HOME}/include/mongoose/mongoose.h: mongoose.h | ${TRICK_HOME}/include/mongoose @ cp mongoose.h $@ +else + +# if trick-offline gets updated, we should rebuild libmongoose +${TRICK_LIB_DIR}/libmongoose.a: ${TRICK_HOME}/trick-offline/mongoose.h ${TRICK_HOME}/trick-offline/mongoose.c + +mongoose.o: trick-offline/mongoose.h trick-offline/mongoose.c + $(CC) $(TRICK_CFLAGS) -c -I${TRICK_HOME}/trick-offline -o mongoose.o trick-offline/mongoose.c + +${TRICK_HOME}/include/mongoose/mongoose.h: trick-offline/mongoose.h | ${TRICK_HOME}/include/mongoose + @ cp ${TRICK_HOME}/trick-offline/mongoose.h $@ +endif + ${TRICK_HOME}/include/mongoose: @ mkdir $@ #------------------------------------------------------------------------------- # 1.3 Build Trick's Java Tools + +ifeq (${TRICK_OFFLINE}, 0) java: @ $(MAKE) -C ${TRICK_HOME}/trick_source/java .PHONY: javadoc javadoc: @ $(MAKE) -C ${TRICK_HOME}/trick_source/java $@ - +else +java: | ${TRICK_HOME}/trick-offline + mkdir ${TRICK_HOME}/libexec/trick/java/build + cp ${TRICK_HOME}/trick-offline/*.jar ${TRICK_HOME}/libexec/trick/java/build +endif #------------------------------------------------------------------------------- # 1.4 This target builds the Trick Documentation. .PHONY: doxygen diff --git a/autoconf/configure.ac b/autoconf/configure.ac index 7e23af95..63758bab 100644 --- a/autoconf/configure.ac +++ b/autoconf/configure.ac @@ -158,6 +158,9 @@ AC_DEFUN([AX_JAVA],[ [USE_JAVA="1"] ) AC_SUBST([USE_JAVA]) + + + AS_IF([test "$USE_JAVA" = "1"],[ AC_PROG_AWK AX_PROG_JAVA_CC(javac) @@ -167,8 +170,10 @@ AC_DEFUN([AX_JAVA],[ [AC_MSG_RESULT([no]) AC_MSG_ERROR([Trick requires javac version >= 1.8]) ]) - AC_PATH_PROG(MVN, mvn, nomvn) - AS_IF([test "$ac_cv_path_MVN" = "nomvn"],AC_MSG_ERROR([could not find maven]),[]) + AS_IF([test "$TRICK_OFFLINE" = "0"], [ + AC_PATH_PROG(MVN, mvn, nomvn) + AS_IF([test "$ac_cv_path_MVN" = "nomvn"],AC_MSG_ERROR([could not find maven]),[]) + ], []) ],[]) ]) @@ -285,6 +290,17 @@ AC_ARG_ENABLE([32bit], ) AC_SUBST([TRICK_FORCE_32BIT]) +# If offline is specified, set some compilation flags +AC_ARG_ENABLE([offline], + AS_HELP_STRING([--enable-offline], [Compile Trick in offline mode. Un-tar the trick-offline directory in TRICK_HOME to use this feature]), + AS_IF([test "x$enable_offline" = xyes], + [TRICK_OFFLINE="1"], + [TRICK_OFFLINE="0"] + ), + [TRICK_OFFLINE="0"] +) +AC_SUBST([TRICK_OFFLINE]) + dnl look for programs we need to compile and run AC_PROG_AWK AC_PROG_CC diff --git a/configure b/configure index bd294854..0722e342 100755 --- a/configure +++ b/configure @@ -674,6 +674,7 @@ ac_ct_CC CFLAGS CC AWK +TRICK_OFFLINE TRICK_FORCE_32BIT LIBXML X_LIB_DIR @@ -743,6 +744,7 @@ ac_user_opts=' enable_option_checking with_x enable_32bit +enable_offline with_swig enable_java with_llvm @@ -1402,6 +1404,9 @@ Optional Features: --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-32bit Force Trick and sims to compile 32bit + --enable-offline Compile Trick in offline mode. Un-tar the + trick-offline directory in TRICK_HOME to use this + feature --enable-java use java (default is yes) --enable-er7utils use er7_utils (default is yes) @@ -3835,6 +3840,22 @@ fi +# If offline is specified, set some compilation flags +# Check whether --enable-offline was given. +if test "${enable_offline+set}" = set; then : + enableval=$enable_offline; if test "x$enable_offline" = xyes; then : + TRICK_OFFLINE="1" +else + TRICK_OFFLINE="0" + +fi +else + TRICK_OFFLINE="0" + +fi + + + for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. @@ -5912,6 +5933,9 @@ else fi + + + if test "$USE_JAVA" = "1"; then : for ac_prog in gawk mawk nawk awk @@ -6110,7 +6134,9 @@ $as_echo "no" >&6; } fi - # Extract the first word of "mvn", so it can be a program name with args. + if test "$TRICK_OFFLINE" = "0"; then : + + # Extract the first word of "mvn", so it can be a program name with args. set dummy mvn; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } @@ -6151,12 +6177,14 @@ $as_echo "no" >&6; } fi - if test "$ac_cv_path_MVN" = "nomvn"; then : + if test "$ac_cv_path_MVN" = "nomvn"; then : as_fn_error $? "could not find maven" "$LINENO" 5 fi fi +fi + ac_ext=c ac_cpp='$CPP $CPPFLAGS' diff --git a/libexec/trick/pm/launch_java.pm b/libexec/trick/pm/launch_java.pm index 76aa8f44..08d003a1 100644 --- a/libexec/trick/pm/launch_java.pm +++ b/libexec/trick/pm/launch_java.pm @@ -46,7 +46,6 @@ sub launch_java($$) { $command .= "$_ "; } - print($command); system $command ; exit $? >> 8 ; } diff --git a/share/trick/makefiles/config_user.mk.in b/share/trick/makefiles/config_user.mk.in index c0f7c6b9..54b4e957 100644 --- a/share/trick/makefiles/config_user.mk.in +++ b/share/trick/makefiles/config_user.mk.in @@ -16,6 +16,8 @@ MVN = @MVN@ USE_JAVA = @USE_JAVA@ JAVAC = @JAVA_CC@ +TRICK_OFFLINE = @TRICK_OFFLINE@ + USE_X_WINDOWS = @USE_X_WINDOWS@ LLVM_HOME = @LLVM_HOME@ diff --git a/trick_source/java/Makefile b/trick_source/java/Makefile index 24abea92..146cce0f 100644 --- a/trick_source/java/Makefile +++ b/trick_source/java/Makefile @@ -12,5 +12,5 @@ javadoc: ${MVN} javadoc:javadoc clean: - @${MVN} -q clean -Dcmake=false + rm -rf ${JAVA_BUILD_DIR} @echo java build directory cleaned.