From a9871b39aabe025b26b673a35e568c83c29897f9 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Sat, 23 Feb 2019 16:17:58 -0600 Subject: [PATCH] vm: Fix DEBUG flag, make REPRODUCIBLE work like debug, minor fixes to build.sh - ``make DEBUG=0`` caused debug mode because the check was ``ifdef DEBUG`` which is true even if DEBUG=0 - no need to ``#pragma message`` that we are doing a reproducible build imo - clang warns about redefining builtin macros, turn the warning off for reproducible builds - add ``./build.sh info`` as an alias for ``./build.sh report`` - show if we a reproducible in report/info --- GNUmakefile | 12 ++++++++---- Nmakefile | 2 +- build.sh | 15 +++++++++++---- vm/Config.unix | 2 +- vm/master.hpp | 3 +-- 5 files changed, 22 insertions(+), 12 deletions(-) diff --git a/GNUmakefile b/GNUmakefile index 595a6c90ef..1418f71dcf 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -1,9 +1,9 @@ ifdef CONFIG VERSION = 0.99 GIT_LABEL = $(shell echo `git describe --all`-`git rev-parse HEAD`) - REPRODUCIBLE ?= 0 - BUNDLE = Factor.app + DEBUG ?= 0 + REPRODUCIBLE ?= 0 include $(CONFIG) @@ -11,17 +11,20 @@ ifdef CONFIG -pedantic \ -DFACTOR_VERSION="$(VERSION)" \ -DFACTOR_GIT_LABEL="$(GIT_LABEL)" \ - -DFACTOR_REPRODUCIBLE="$(REPRODUCIBLE)" \ $(SITE_CFLAGS) CXXFLAGS += -std=c++11 - ifdef DEBUG + ifneq ($(DEBUG), 0) CFLAGS += -g -DFACTOR_DEBUG else CFLAGS += -O3 endif + ifneq ($(REPRODUCIBLE), 0) + CFLAGS += -DFACTOR_REPRODUCIBLE -Wno-builtin-macro-redefined + endif + ENGINE = $(DLL_PREFIX)factor$(DLL_SUFFIX)$(DLL_EXTENSION) EXECUTABLE = factor$(EXE_SUFFIX)$(EXE_EXTENSION) CONSOLE_EXECUTABLE = factor$(EXE_SUFFIX)$(CONSOLE_EXTENSION) @@ -152,6 +155,7 @@ help: @echo "Additional modifiers:" @echo "" @echo "DEBUG=1 compile VM with debugging information" + @echo "REPRODUCIBLE=1 compile VM without timestamp" @echo "SITE_CFLAGS=... additional optimization flags" @echo "X11=1 force link with X11 libraries instead of Cocoa (only on Mac OS X)" diff --git a/Nmakefile b/Nmakefile index 441c7875e1..709befb1a0 100644 --- a/Nmakefile +++ b/Nmakefile @@ -66,7 +66,7 @@ CL_FLAGS = $(CL_FLAGS) /Zi /DFACTOR_DEBUG !ENDIF !IF DEFINED(REPRODUCIBLE) -CL_FLAGS = $(CL_FLAGS) /DFACTOR_REPRODUCIBLE=1 +CL_FLAGS = $(CL_FLAGS) /DFACTOR_REPRODUCIBLE !ENDIF ML_FLAGS = /nologo /safeseh diff --git a/build.sh b/build.sh index 7d99f7026b..9d0a76793b 100755 --- a/build.sh +++ b/build.sh @@ -357,6 +357,7 @@ echo_build_info() { $ECHO NUM_CORES=$NUM_CORES $ECHO WORD=$WORD $ECHO DEBUG=$DEBUG + $ECHO REPRODUCIBLE=$REPRODUCIBLE $ECHO CURRENT_BRANCH=$CURRENT_BRANCH $ECHO FACTOR_BINARY=$FACTOR_BINARY $ECHO FACTOR_LIBRARY=$FACTOR_LIBRARY @@ -731,7 +732,7 @@ usage() { $ECHO " bootstrap - bootstrap with existing boot image" $ECHO " net-bootstrap - recompile, download a boot image, bootstrap" $ECHO " make-target - find and print the os-arch-cpu string" - $ECHO " report - print the build variables" + $ECHO " report|info - print the build variables" $ECHO " update-boot-image - get the boot image for the current branch of for master" $ECHO "" $ECHO "If you are behind a firewall, invoke as:" @@ -747,6 +748,13 @@ MAKE_TARGET=unknown if [[ -n "$2" ]] ; then parse_build_info $2 fi +$ECHO "args $#" +if [ "$#" -gt 3 ]; then + usage + $ECHO "error: too many arguments" + exit 1 +fi + set_copy set_delete @@ -760,13 +768,12 @@ case "$1" in deps-pkg) install_deps_pkg ;; self-update) update; make_boot_image; bootstrap;; quick-update) update; refresh_image ;; - update) update; download_and_bootstrap ;; - latest) update; download_and_bootstrap ;; + update|latest) update; download_and_bootstrap ;; compile) find_build_info; make_factor ;; bootstrap) get_config_info; bootstrap ;; net-bootstrap) net_bootstrap_no_pull ;; make-target) FIND_MAKE_TARGET=true; ECHO=false; find_build_info; exit_script ;; - report) find_build_info ;; + report|info) find_build_info ;; full-report) find_build_info; check_installed_programs; check_libraries ;; update-boot-image) find_build_info; check_installed_programs; update_boot_image;; *) usage ;; diff --git a/vm/Config.unix b/vm/Config.unix index 82d1073e80..79fa467826 100644 --- a/vm/Config.unix +++ b/vm/Config.unix @@ -1,4 +1,4 @@ -ifndef DEBUG +ifneq ($(DEBUG), 0) SITE_CFLAGS += -fomit-frame-pointer endif diff --git a/vm/master.hpp b/vm/master.hpp index 7fd7b18a46..8aa0d9787c 100644 --- a/vm/master.hpp +++ b/vm/master.hpp @@ -52,8 +52,7 @@ #define FACTOR_COMPILER_VERSION "unknown" #endif -#if (FACTOR_REPRODUCIBLE == 1) - #pragma message "REPRODUCIBLE" +#if defined(FACTOR_REPRODUCIBLE) #define FACTOR_COMPILE_TIME "[reproducible]" #else // Record compilation time -- 2.34.1