diff --git a/contrib/depends/Makefile b/contrib/depends/Makefile index 7eedee15e..28ec972e4 100644 --- a/contrib/depends/Makefile +++ b/contrib/depends/Makefile @@ -58,6 +58,7 @@ ifeq ($(host_os),) host_os:=$(findstring linux,$(full_host_os)) endif host_os+=$(findstring darwin,$(full_host_os)) +host_os+=$(findstring freebsd,$(full_host_os)) host_os+=$(findstring mingw32,$(full_host_os)) host_os:=$(strip $(host_os)) ifeq ($(host_os),) @@ -74,6 +75,9 @@ endif ifeq ($(host_os),linux) host_cmake=Linux endif +ifeq ($(host_os),freebsd) +host_cmake=FreeBSD +endif ifeq ($(host_os),darwin) host_cmake=Darwin endif diff --git a/contrib/depends/builders/default.mk b/contrib/depends/builders/default.mk index f097db65d..c4191435d 100644 --- a/contrib/depends/builders/default.mk +++ b/contrib/depends/builders/default.mk @@ -17,4 +17,4 @@ define add_build_flags_func build_$(build_arch)_$(build_os)_$1 += $(build_$(build_os)_$1) build_$1=$$(build_$(build_arch)_$(build_os)_$1) endef -$(foreach flags, CFLAGS CXXFLAGS LDFLAGS, $(eval $(call add_build_flags_func,$(flags)))) +$(foreach flags, CFLAGS CXXFLAGS ARFLAGS LDFLAGS, $(eval $(call add_build_flags_func,$(flags)))) diff --git a/contrib/depends/funcs.mk b/contrib/depends/funcs.mk index 469144361..355ae07eb 100644 --- a/contrib/depends/funcs.mk +++ b/contrib/depends/funcs.mk @@ -10,6 +10,7 @@ $(1)_libtool=$($($(1)_type)_LIBTOOL) $(1)_nm=$($($(1)_type)_NM) $(1)_cflags=$($($(1)_type)_CFLAGS) $($($(1)_type)_$(release_type)_CFLAGS) $(1)_cxxflags=$($($(1)_type)_CXXFLAGS) $($($(1)_type)_$(release_type)_CXXFLAGS) +$(1)_arflags=$($($(1)_type)_ARFLAGS) $($($(1)_type)_$(release_type)_ARFLAGS) $(1)_ldflags=$($($(1)_type)_LDFLAGS) $($($(1)_type)_$(release_type)_LDFLAGS) -L$($($(1)_type)_prefix)/lib $(1)_cppflags=$($($(1)_type)_CPPFLAGS) $($($(1)_type)_$(release_type)_CPPFLAGS) -I$($($(1)_type)_prefix)/include $(1)_recipe_hash:= @@ -102,6 +103,11 @@ $(1)_cxxflags+=$($(1)_cxxflags_$(host_arch)) $($(1)_cxxflags_$(host_arch)_$(rele $(1)_cxxflags+=$($(1)_cxxflags_$(host_os)) $($(1)_cxxflags_$(host_os)_$(release_type)) $(1)_cxxflags+=$($(1)_cxxflags_$(host_arch)_$(host_os)) $($(1)_cxxflags_$(host_arch)_$(host_os)_$(release_type)) +$(1)_arflags+=$($(1)_arflags_$(release_type)) +$(1)_arflags+=$($(1)_arflags_$(host_arch)) $($(1)_arflags_$(host_arch)_$(release_type)) +$(1)_arflags+=$($(1)_arflags_$(host_os)) $($(1)_arflags_$(host_os)_$(release_type)) +$(1)_arflags+=$($(1)_arflags_$(host_arch)_$(host_os)) $($(1)_arflags_$(host_arch)_$(host_os)_$(release_type)) + $(1)_cppflags+=$($(1)_cppflags_$(release_type)) $(1)_cppflags+=$($(1)_cppflags_$(host_arch)) $($(1)_cppflags_$(host_arch)_$(release_type)) $(1)_cppflags+=$($(1)_cppflags_$(host_os)) $($(1)_cppflags_$(host_os)_$(release_type)) @@ -143,6 +149,9 @@ endif ifneq ($($(1)_ar),) $(1)_autoconf += AR="$$($(1)_ar)" endif +ifneq ($($(1)_arflags),) +$(1)_autoconf += ARFLAGS="$$($(1)_arflags)" +endif ifneq ($($(1)_cflags),) $(1)_autoconf += CFLAGS="$$($(1)_cflags)" endif diff --git a/contrib/depends/hosts/android.mk b/contrib/depends/hosts/android.mk index 2a24435d4..d6f8b99dd 100644 --- a/contrib/depends/hosts/android.mk +++ b/contrib/depends/hosts/android.mk @@ -6,9 +6,11 @@ endif android_CC=$(host_toolchain)clang android_CXX=$(host_toolchain)clang++ +android_RANLIB=: android_CFLAGS=-pipe android_CXXFLAGS=$(android_CFLAGS) +android_ARFLAGS=crsD android_release_CFLAGS=-O2 android_release_CXXFLAGS=$(android_release_CFLAGS) diff --git a/contrib/depends/hosts/darwin.mk b/contrib/depends/hosts/darwin.mk index 6f8f2ffe2..7b5c8b051 100644 --- a/contrib/depends/hosts/darwin.mk +++ b/contrib/depends/hosts/darwin.mk @@ -7,6 +7,7 @@ darwin_CXX=clang++ -target $(host) -mmacosx-version-min=$(OSX_MIN_VERSION) --sys darwin_CFLAGS=-pipe darwin_CXXFLAGS=$(darwin_CFLAGS) +darwin_ARFLAGS=cr darwin_release_CFLAGS=-O1 darwin_release_CXXFLAGS=$(darwin_release_CFLAGS) diff --git a/contrib/depends/hosts/default.mk b/contrib/depends/hosts/default.mk index 6f60d6b3f..2e7f9fa23 100644 --- a/contrib/depends/hosts/default.mk +++ b/contrib/depends/hosts/default.mk @@ -23,4 +23,4 @@ host_$(release_type)_$1 = $$($(host_arch)_$(host_os)_$(release_type)_$1) endef $(foreach tool,CC CXX AR RANLIB STRIP NM LIBTOOL OTOOL INSTALL_NAME_TOOL,$(eval $(call add_host_tool_func,$(tool)))) -$(foreach flags,CFLAGS CXXFLAGS CPPFLAGS LDFLAGS, $(eval $(call add_host_flags_func,$(flags)))) +$(foreach flags,CFLAGS CXXFLAGS ARFLAGS CPPFLAGS LDFLAGS, $(eval $(call add_host_flags_func,$(flags)))) diff --git a/contrib/depends/hosts/freebsd.mk b/contrib/depends/hosts/freebsd.mk new file mode 100644 index 000000000..2e3b5933e --- /dev/null +++ b/contrib/depends/hosts/freebsd.mk @@ -0,0 +1,18 @@ +freebsd_CC=clang-8 +freebsd_CXX=clang++-8 +freebsd_AR=ar +freebsd_RANLIB=ranlib +freebsd_NM=nm + +freebsd_CFLAGS=-pipe +freebsd_CXXFLAGS=$(freebsd_CFLAGS) +freebsd_ARFLAGS=cr + +freebsd_release_CFLAGS=-O2 +freebsd_release_CXXFLAGS=$(freebsd_release_CFLAGS) + +freebsd_debug_CFLAGS=-g -O0 +freebsd_debug_CXXFLAGS=$(freebsd_debug_CFLAGS) + +freebsd_native_toolchain=freebsd_base + diff --git a/contrib/depends/hosts/linux.mk b/contrib/depends/hosts/linux.mk index b13a0f1ad..912fdb03c 100644 --- a/contrib/depends/hosts/linux.mk +++ b/contrib/depends/hosts/linux.mk @@ -1,5 +1,6 @@ linux_CFLAGS=-pipe linux_CXXFLAGS=$(linux_CFLAGS) +linux_ARFLAGS=cr linux_release_CFLAGS=-O2 linux_release_CXXFLAGS=$(linux_release_CFLAGS) diff --git a/contrib/depends/hosts/mingw32.mk b/contrib/depends/hosts/mingw32.mk index dbfb62fdc..ccc4c5082 100644 --- a/contrib/depends/hosts/mingw32.mk +++ b/contrib/depends/hosts/mingw32.mk @@ -1,5 +1,6 @@ mingw32_CFLAGS=-pipe mingw32_CXXFLAGS=$(mingw32_CFLAGS) +mingw32_ARFLAGS=cr mingw32_release_CFLAGS=-O2 mingw32_release_CXXFLAGS=$(mingw32_release_CFLAGS) diff --git a/contrib/depends/packages/boost.mk b/contrib/depends/packages/boost.mk index 3231df925..0d241928e 100644 --- a/contrib/depends/packages/boost.mk +++ b/contrib/depends/packages/boost.mk @@ -4,6 +4,7 @@ $(package)_download_path=https://dl.bintray.com/boostorg/release/1.64.0/source/ $(package)_file_name=$(package)_$($(package)_version).tar.bz2 $(package)_sha256_hash=7bcc5caace97baa948931d712ea5f37038dbb1c5d89b43ad4def4ed7cb683332 $(package)_dependencies=libiconv +$(package)_patches=fix_aroptions.patch define $(package)_set_vars $(package)_config_opts_release=variant=release @@ -24,10 +25,12 @@ $(package)_archiver_darwin=$($(package)_libtool) $(package)_config_libraries=chrono,filesystem,program_options,system,thread,test,date_time,regex,serialization,locale $(package)_cxxflags=-std=c++11 $(package)_cxxflags_linux=-fPIC +$(package)_cxxflags_freebsd=-fPIC endef define $(package)_preprocess_cmds - echo "using $(boost_toolset_$(host_os)) : : $($(package)_cxx) : \"$($(package)_cxxflags) $($(package)_cppflags)\" \"$($(package)_ldflags)\" \"$(boost_archiver_$(host_os))\" \"$(host_STR IP)\" \"$(host_RANLIB)\" \"$(host_WINDRES)\" : ;" > user-config.jam + patch -p1 < $($(package)_patch_dir)/fix_aroptions.patch &&\ + echo "using $(boost_toolset_$(host_os)) : : $($(package)_cxx) : \"$($(package)_cxxflags) $($(package)_cppflags)\" \"$($(package)_ldflags)\" \"$(boost_archiver_$(host_os))\" \"$($(package)_arflags)\" \"$(host_STRIP)\" \"$(host_RANLIB)\" \"$(host_WINDRES)\" : ;" > user-config.jam endef define $(package)_config_cmds diff --git a/contrib/depends/packages/eudev.mk b/contrib/depends/packages/eudev.mk index a7795b777..0e930df93 100644 --- a/contrib/depends/packages/eudev.mk +++ b/contrib/depends/packages/eudev.mk @@ -9,7 +9,7 @@ define $(package)_set_vars endef define $(package)_config_cmds - $($(package)_autoconf) + $($(package)_autoconf) AR_FLAGS=$($(package)_arflags) endef define $(package)_build_cmd diff --git a/contrib/depends/packages/freebsd_base.mk b/contrib/depends/packages/freebsd_base.mk new file mode 100644 index 000000000..c6a209dcd --- /dev/null +++ b/contrib/depends/packages/freebsd_base.mk @@ -0,0 +1,23 @@ +package=freebsd_base +$(package)_version=11.3 +$(package)_download_path=https://download.freebsd.org/ftp/releases/amd64/$($(package)_version)-RELEASE/ +$(package)_download_file=base.txz +$(package)_file_name=freebsd-base-$($(package)_version).txz +$(package)_sha256_hash=4599023ac136325b86f2fddeec64c1624daa83657e40b00b2ef944c81463a4ff + +define $(package)_extract_cmds + echo $($(package)_sha256_hash) $($(1)_source_dir)/$($(package)_file_name) | sha256sum -c &&\ + tar xf $($(1)_source_dir)/$($(package)_file_name) ./lib/ ./usr/lib/ ./usr/include/ +endef + +define $(package)_build_cmds + mkdir bin &&\ + echo "exec /usr/bin/clang-8 -target x86_64-unknown-freebsd$($(package)_version) --sysroot=$(host_prefix)/native $$$$""@" > bin/clang-8 &&\ + echo "exec /usr/bin/clang++-8 -target x86_64-unknown-freebsd$($(package)_version) --sysroot=$(host_prefix)/native $$$$""@" > bin/clang++-8 &&\ + chmod 755 bin/* +endef + +define $(package)_stage_cmds + mkdir $($(package)_staging_dir)/$(host_prefix)/native &&\ + mv bin lib usr $($(package)_staging_dir)/$(host_prefix)/native +endef diff --git a/contrib/depends/packages/hidapi.mk b/contrib/depends/packages/hidapi.mk index a27df04fa..b76ef1548 100644 --- a/contrib/depends/packages/hidapi.mk +++ b/contrib/depends/packages/hidapi.mk @@ -18,7 +18,7 @@ endef define $(package)_config_cmds ./bootstrap &&\ - $($(package)_autoconf) $($(package)_config_opts) + $($(package)_autoconf) $($(package)_config_opts) AR_FLAGS=$($(package)_arflags) endef define $(package)_build_cmds diff --git a/contrib/depends/packages/libiconv.mk b/contrib/depends/packages/libiconv.mk index d4995c1b7..eac8b4331 100644 --- a/contrib/depends/packages/libiconv.mk +++ b/contrib/depends/packages/libiconv.mk @@ -10,6 +10,7 @@ define $(package)_set_vars $(package)_config_opts=--enable-static $(package)_config_opts=--disable-shared $(package)_config_opts_linux=--with-pic + $(package)_config_opts_freebsd=--with-pic endef define $(package)_preprocess_cmds @@ -18,7 +19,7 @@ define $(package)_preprocess_cmds endef define $(package)_config_cmds - $($(package)_autoconf) + $($(package)_autoconf) AR_FLAGS=$($(package)_arflags) endef define $(package)_build_cmds diff --git a/contrib/depends/packages/libusb.mk b/contrib/depends/packages/libusb.mk index d865d2a17..348c410a7 100644 --- a/contrib/depends/packages/libusb.mk +++ b/contrib/depends/packages/libusb.mk @@ -19,11 +19,11 @@ ifneq ($(host_os),darwin) define $(package)_config_cmds cp -f $(BASEDIR)/config.guess config.guess &&\ cp -f $(BASEDIR)/config.sub config.sub &&\ - $($(package)_autoconf) + $($(package)_autoconf) AR_FLAGS=$($(package)_arflags) endef else define $(package)_config_cmds - $($(package)_autoconf) + $($(package)_autoconf) AR_FLAGS=$($(package)_arflags) endef endif diff --git a/contrib/depends/packages/native_cctools.mk b/contrib/depends/packages/native_cctools.mk index bcfe1af6b..8bf71254f 100644 --- a/contrib/depends/packages/native_cctools.mk +++ b/contrib/depends/packages/native_cctools.mk @@ -10,6 +10,7 @@ $(package)_clang_download_file=clang+llvm-$($(package)_clang_version)-x86_64-lin $(package)_clang_file_name=clang-llvm-$($(package)_clang_version)-x86_64-linux-gnu-ubuntu-14.04.tar.xz $(package)_clang_sha256_hash=99b28a6b48e793705228a390471991386daa33a9717cd9ca007fcdde69608fd9 $(package)_extra_sources=$($(package)_clang_file_name) +$(package)_patches=skip_otool.patch define $(package)_fetch_cmds $(call fetch_file,$(package),$($(package)_download_path),$($(package)_download_file),$($(package)_file_name),$($(package)_sha256_hash)) && \ @@ -37,7 +38,10 @@ $(package)_cc=$($(package)_extract_dir)/toolchain/bin/clang $(package)_cxx=$($(package)_extract_dir)/toolchain/bin/clang++ endef +# If clang gets updated to a version with a fix for https://reviews.llvm.org/D50559 +# then the patch that skips otool can be removed. define $(package)_preprocess_cmds + patch -p0 < $($(package)_patch_dir)/skip_otool.patch && \ cd $($(package)_build_subdir); ./autogen.sh && \ sed -i.old "/define HAVE_PTHREADS/d" ld64/src/ld/InputFiles.h endef diff --git a/contrib/depends/packages/ncurses.mk b/contrib/depends/packages/ncurses.mk index 1acf1faca..d8fdf351c 100644 --- a/contrib/depends/packages/ncurses.mk +++ b/contrib/depends/packages/ncurses.mk @@ -7,7 +7,7 @@ $(package)_patches=fallback.c define $(package)_set_vars $(package)_build_opts=CC="$($(package)_cc)" - $(package)_config_env=AR="$($(package)_ar)" RANLIB="$($(package)_ranlib)" CC="$($(package)_cc)" + $(package)_config_env=AR="$($(package)_ar)" RANLIB="$($(package)_ranlib)" CC="$($(package)_cc)" ARFLAGS=$($(package)_arflags) cf_cv_ar_flags="" $(package)_config_env_darwin=RANLIB="$(host_prefix)/native/bin/x86_64-apple-darwin11-ranlib" AR="$(host_prefix)/native/bin/x86_64-apple-darwin11-ar" CC="$(host_prefix)/native/bin/$($(package)_cc)" $(package)_config_opts=--prefix=$(host_prefix) $(package)_config_opts+=--disable-shared diff --git a/contrib/depends/packages/openssl.mk b/contrib/depends/packages/openssl.mk index f3b781f28..4b07d08ba 100644 --- a/contrib/depends/packages/openssl.mk +++ b/contrib/depends/packages/openssl.mk @@ -3,9 +3,10 @@ $(package)_version=1.0.2r $(package)_download_path=https://www.openssl.org/source $(package)_file_name=$(package)-$($(package)_version).tar.gz $(package)_sha256_hash=ae51d08bba8a83958e894946f15303ff894d75c2b8bbd44a852b64e3fe11d0d6 +$(package)_patches=fix_arflags.patch define $(package)_set_vars -$(package)_config_env=AR="$($(package)_ar)" RANLIB="$($(package)_ranlib)" CC="$($(package)_cc)" +$(package)_config_env=AR="$($(package)_ar)" ARFLAGS=$($(package)_arflags) RANLIB="$($(package)_ranlib)" CC="$($(package)_cc)" $(package)_config_opts=--prefix=$(host_prefix) --openssldir=$(host_prefix)/etc/openssl $(package)_config_opts+=no-capieng $(package)_config_opts+=no-dso @@ -36,6 +37,7 @@ $(package)_config_opts+=no-zlib $(package)_config_opts+=no-zlib-dynamic $(package)_config_opts+=$($(package)_cflags) $($(package)_cppflags) $(package)_config_opts_linux=-fPIC -Wa,--noexecstack +$(package)_config_opts_freebsd=-fPIC -Wa,--noexecstack $(package)_config_opts_x86_64_linux=linux-x86_64 $(package)_config_opts_i686_linux=linux-generic32 $(package)_config_opts_arm_linux=linux-generic32 @@ -49,12 +51,14 @@ $(package)_config_opts_powerpc_linux=linux-generic32 $(package)_config_opts_x86_64_darwin=darwin64-x86_64-cc $(package)_config_opts_x86_64_mingw32=mingw64 $(package)_config_opts_i686_mingw32=mingw +$(package)_config_opts_x86_64_freebsd=BSD-x86_64 endef define $(package)_preprocess_cmds sed -i.old "/define DATE/d" util/mkbuildinf.pl && \ sed -i.old "s|engines apps test|engines|" Makefile.org && \ - sed -i -e "s/-mandroid //" Configure + sed -i -e "s/-mandroid //" Configure && \ + patch < $($(package)_patch_dir)/fix_arflags.patch endef define $(package)_config_cmds diff --git a/contrib/depends/packages/packages.mk b/contrib/depends/packages/packages.mk index 9302d5b4d..95b23a37e 100644 --- a/contrib/depends/packages/packages.mk +++ b/contrib/depends/packages/packages.mk @@ -1,18 +1,22 @@ -ifeq ($(host_os),android) packages:=boost openssl zeromq libiconv -else -packages:=boost openssl zeromq expat ldns libiconv hidapi protobuf libusb -endif -native_packages := native_ccache native_protobuf +native_packages := native_ccache + +hardware_packages := hidapi protobuf libusb +hardware_native_packages := native_protobuf android_native_packages = android_ndk android_packages = ncurses readline sodium -darwin_native_packages = native_biplist native_ds_store native_mac_alias -darwin_packages = sodium-darwin ncurses readline +darwin_native_packages = native_biplist native_ds_store native_mac_alias $(hardware_native_packages) +darwin_packages = sodium ncurses readline $(hardware_packages) -linux_packages = eudev ncurses readline sodium +# not really native... +freebsd_native_packages = freebsd_base +freebsd_packages = ncurses readline sodium + +linux_packages = eudev ncurses readline sodium $(hardware_packages) +linux_native_packages = $(hardware_native_packages) qt_packages = qt ifeq ($(build_tests),ON) @@ -23,10 +27,8 @@ ifneq ($(host_arch),riscv64) linux_packages += unwind endif -ifeq ($(host_os),mingw32) -packages += icu4c -packages += sodium -endif +mingw32_packages = icu4c sodium $(hardware_packages) +mingw32_native_packages = $(hardware_native_packages) ifneq ($(build_os),darwin) darwin_native_packages += native_cctools native_cdrkit native_libdmg-hfsplus diff --git a/contrib/depends/packages/protobuf.mk b/contrib/depends/packages/protobuf.mk index 81fa78a3f..ad1098975 100644 --- a/contrib/depends/packages/protobuf.mk +++ b/contrib/depends/packages/protobuf.mk @@ -12,7 +12,7 @@ define $(package)_set_vars endef define $(package)_config_cmds - $($(package)_autoconf) + $($(package)_autoconf) AR_FLAGS=$($(package)_arflags) endef define $(package)_build_cmds diff --git a/contrib/depends/packages/readline.mk b/contrib/depends/packages/readline.mk index 29ae783a2..b6e6a451a 100644 --- a/contrib/depends/packages/readline.mk +++ b/contrib/depends/packages/readline.mk @@ -7,7 +7,7 @@ $(package)_dependencies=ncurses define $(package)_set_vars $(package)_build_opts=CC="$($(package)_cc)" - $(package)_config_env=AR="$($(package)_ar)" RANLIB="$($(package)_ranlib)" CC="$($(package)_cc)" LDFLAGS="-L$(host_prefix)/lib" + $(package)_config_env=AR="$($(package)_ar)" RANLIB="$($(package)_ranlib)" CC="$($(package)_cc)" LDFLAGS="-L$(host_prefix)/lib" ARFLAGS=$($(package)_arflags) $(package)_config_env_darwin=RANLIB="$(host_prefix)/native/bin/x86_64-apple-darwin11-ranlib" AR="$(host_prefix)/native/bin/x86_64-apple-darwin11-ar" CC="$(host_prefix)/native/bin/$($(package)_cc)" $(package)_config_opts+=--prefix=$(host_prefix) $(package)_config_opts+=--exec-prefix=$(host_prefix) diff --git a/contrib/depends/packages/sodium-darwin.mk b/contrib/depends/packages/sodium-darwin.mk deleted file mode 100644 index 9f11a9426..000000000 --- a/contrib/depends/packages/sodium-darwin.mk +++ /dev/null @@ -1,30 +0,0 @@ -package=sodium-darwin -$(package)_version=1.0.16 -$(package)_download_path=https://download.libsodium.org/libsodium/releases/ -$(package)_file_name=libsodium-$($(package)_version).tar.gz -$(package)_sha256_hash=eeadc7e1e1bcef09680fb4837d448fbdf57224978f865ac1c16745868fbd0533 - -define $(package)_set_vars -$(package)_build_opts_darwin=OS=Darwin LIBTOOL="$($(package)_libtool)" -$(package)_config_opts=--enable-static --disable-shared -$(package)_config_opts+=--prefix=$(host_prefix) -endef - -define $(package)_config_cmds - ./autogen.sh &&\ - $($(package)_autoconf) $($(package)_config_opts) RANLIB="$(host_prefix)/native/bin/x86_64-apple-darwin11-ranlib" AR="$(host_prefix)/native/bin/x86_64-apple-darwin11-ar" CC="$(host_prefix)/native/bin/$($(package)_cc)" -endef - -define $(package)_build_cmds - echo "path is problematic here" &&\ - make -endef - -define $(package)_stage_cmds - $(MAKE) DESTDIR=$($(package)_staging_dir) install -endef - -define $(package)_postprocess_cmds - rm lib/*.la -endef - diff --git a/contrib/depends/packages/sodium.mk b/contrib/depends/packages/sodium.mk index cdc690e69..dbf86fc5a 100644 --- a/contrib/depends/packages/sodium.mk +++ b/contrib/depends/packages/sodium.mk @@ -9,12 +9,13 @@ define $(package)_set_vars $(package)_config_opts=--enable-static --disable-shared $(package)_config_opts+=--prefix=$(host_prefix) $(package)_config_opts_android=RANLIB=$($(package)_ranlib) AR=$($(package)_ar) CC=$($(package)_cc) +$(package)_config_opts_darwin=RANLIB="$(host_prefix)/native/bin/x86_64-apple-darwin11-ranlib" AR="$(host_prefix)/native/bin/x86_64-apple-darwin11-ar" CC="$(host_prefix)/native/bin/$($(package)_cc)" endef define $(package)_config_cmds ./autogen.sh &&\ patch -p1 < $($(package)_patch_dir)/fix-whitespace.patch &&\ - $($(package)_autoconf) $($(package)_config_opts) + $($(package)_autoconf) $($(package)_config_opts) AR_FLAGS=$($(package)_arflags) endef define $(package)_build_cmds diff --git a/contrib/depends/packages/unwind.mk b/contrib/depends/packages/unwind.mk index fddbd0561..826a820c4 100644 --- a/contrib/depends/packages/unwind.mk +++ b/contrib/depends/packages/unwind.mk @@ -3,11 +3,16 @@ $(package)_version=1.2 $(package)_download_path=https://download.savannah.nongnu.org/releases/libunwind $(package)_file_name=lib$(package)-$($(package)_version).tar.gz $(package)_sha256_hash=1de38ffbdc88bd694d10081865871cd2bfbb02ad8ef9e1606aee18d65532b992 +$(package)_patches=fix_obj_order.patch + +define $(package)_preprocess_cmds + patch -p0 < $($(package)_patch_dir)/fix_obj_order.patch +endef define $(package)_config_cmds cp -f $(BASEDIR)/config.guess config/config.guess &&\ cp -f $(BASEDIR)/config.sub config/config.sub &&\ - $($(package)_autoconf) --disable-shared --enable-static + $($(package)_autoconf) --disable-shared --enable-static AR_FLAGS=$($(package)_arflags) endef define $(package)_build_cmds diff --git a/contrib/depends/packages/zeromq.mk b/contrib/depends/packages/zeromq.mk index 46caf14cb..55941e67d 100644 --- a/contrib/depends/packages/zeromq.mk +++ b/contrib/depends/packages/zeromq.mk @@ -8,6 +8,7 @@ $(package)_patches=9114d3957725acd34aa8b8d011585812f3369411.patch 9e6745c12e0b10 define $(package)_set_vars $(package)_config_opts=--without-documentation --disable-shared --without-libsodium --disable-curve $(package)_config_opts_linux=--with-pic + $(package)_config_opts_freebsd=--with-pic $(package)_cxxflags=-std=c++11 endef @@ -19,7 +20,7 @@ define $(package)_preprocess_cmds endef define $(package)_config_cmds - $($(package)_autoconf) + $($(package)_autoconf) AR_FLAGS=$($(package)_arflags) endef define $(package)_build_cmds diff --git a/contrib/depends/patches/boost/fix_aroptions.patch b/contrib/depends/patches/boost/fix_aroptions.patch new file mode 100644 index 000000000..5b2ec1006 --- /dev/null +++ b/contrib/depends/patches/boost/fix_aroptions.patch @@ -0,0 +1,28 @@ +--- boost_1_64_0/tools/build/src/tools/gcc.jam.O 2017-04-17 03:22:26.000000000 +0100 ++++ boost_1_64_0/tools/build/src/tools/gcc.jam 2019-11-15 15:46:16.957937137 +0000 +@@ -243,6 +243,8 @@ + { + ECHO notice: using gcc archiver :: $(condition) :: $(archiver[1]) ; + } ++ local arflags = [ feature.get-values : $(options) ] ; ++ toolset.flags gcc.archive .ARFLAGS $(condition) : $(arflags) ; + + # - Ranlib. + local ranlib = [ common.get-invocation-command gcc +@@ -970,6 +972,7 @@ + # logic in intel-linux, but that is hardly worth the trouble as on Linux, 'ar' + # is always available. + .AR = ar ; ++.ARFLAGS = rc ; + .RANLIB = ranlib ; + + toolset.flags gcc.archive AROPTIONS ; +@@ -1011,7 +1014,7 @@ + # + actions piecemeal archive + { +- "$(.AR)" $(AROPTIONS) rc "$(<)" "$(>)" ++ "$(.AR)" $(AROPTIONS) $(.ARFLAGS) "$(<)" "$(>)" + "$(.RANLIB)" "$(<)" + } + diff --git a/contrib/depends/patches/native_cctools/skip_otool.patch b/contrib/depends/patches/native_cctools/skip_otool.patch new file mode 100644 index 000000000..30c4ee524 --- /dev/null +++ b/contrib/depends/patches/native_cctools/skip_otool.patch @@ -0,0 +1,12 @@ +--- cctools/Makefile.am.O 2016-06-09 15:06:16.000000000 +0100 ++++ cctools/Makefile.am 2019-11-18 08:59:20.078663220 +0000 +@@ -1,7 +1,7 @@ + if ISDARWIN +-SUBDIRS=libstuff ar as misc otool ld64 $(LD_CLASSIC) ++SUBDIRS=libstuff ar as misc ld64 $(LD_CLASSIC) + else +-SUBDIRS=libstuff ar as misc libobjc2 otool ld64 $(LD_CLASSIC) ++SUBDIRS=libstuff ar as misc ld64 $(LD_CLASSIC) + endif + + ACLOCAL_AMFLAGS = -I m4 diff --git a/contrib/depends/patches/openssl/fix_arflags.patch b/contrib/depends/patches/openssl/fix_arflags.patch new file mode 100644 index 000000000..2d2900d80 --- /dev/null +++ b/contrib/depends/patches/openssl/fix_arflags.patch @@ -0,0 +1,24 @@ +--- Makefile.org.O 2019-02-26 14:20:20.000000000 +0000 ++++ Makefile.org 2019-11-15 13:05:54.370086856 +0000 +@@ -63,8 +63,8 @@ + PEX_LIBS= + EX_LIBS= + EXE_EXT= +-ARFLAGS= +-AR=ar $(ARFLAGS) r ++ARFLAGS= r ++AR=ar $(ARFLAGS) + RANLIB= ranlib + RC= windres + NM= nm +--- Configure.O 2019-02-26 14:20:20.000000000 +0000 ++++ Configure 2019-11-16 07:43:14.933990774 +0000 +@@ -1251,7 +1251,7 @@ + my $shared_extension = $fields[$idx_shared_extension]; + my $ranlib = $ENV{'RANLIB'} || $fields[$idx_ranlib]; + my $ar = $ENV{'AR'} || "ar"; +-my $arflags = $fields[$idx_arflags]; ++my $arflags = $ENV{'ARFLAGS'} || $fields[$idx_arflags]; + my $windres = $ENV{'RC'} || $ENV{'WINDRES'} || "windres"; + my $multilib = $fields[$idx_multilib]; + diff --git a/contrib/depends/patches/unwind/fix_obj_order.patch b/contrib/depends/patches/unwind/fix_obj_order.patch new file mode 100644 index 000000000..374a9f04a --- /dev/null +++ b/contrib/depends/patches/unwind/fix_obj_order.patch @@ -0,0 +1,11 @@ +--- config/ltmain.sh.O 2017-01-13 16:00:54.000000000 +0000 ++++ config/ltmain.sh 2019-11-17 06:46:51.994402494 +0000 +@@ -7957,6 +7957,8 @@ + esac + done + fi ++ oldobjs=`for obj in $oldobjs; do echo $obj; done | sort` ++ oldobjs=" `echo $oldobjs`" + eval cmds=\"$old_archive_cmds\" + + func_len " $cmds" diff --git a/contrib/depends/toolchain.cmake.in b/contrib/depends/toolchain.cmake.in index 13018ea26..c56f3eb2e 100644 --- a/contrib/depends/toolchain.cmake.in +++ b/contrib/depends/toolchain.cmake.in @@ -1,4 +1,4 @@ -# Set the system name to one of Android, Darwin, Linux, or Windows +# Set the system name to one of Android, Darwin, FreeBSD, Linux, or Windows SET(CMAKE_SYSTEM_NAME @depends@) SET(CMAKE_BUILD_TYPE @release_type@) @@ -23,13 +23,14 @@ SET(Readline_INCLUDE_DIR @prefix@/include) SET(Readline_LIBRARY @prefix@/lib/libreadline.a) SET(Terminfo_LIBRARY @prefix@/lib/libtinfo.a) -if(NOT CMAKE_SYSTEM_NAME STREQUAL "Android") SET(LRELEASE_PATH @prefix@/native/bin CACHE FILEPATH "path to lrelease" FORCE) +if(NOT CMAKE_SYSTEM_NAME STREQUAL "Android") SET(LIBUNWIND_INCLUDE_DIR @prefix@/include) SET(LIBUNWIND_LIBRARIES @prefix@/lib/libunwind.a) SET(LIBUNWIND_LIBRARY_DIRS @prefix@/lib) +if(NOT CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") SET(LIBUSB-1.0_LIBRARY @prefix@/lib/libusb-1.0.a) SET(LIBUDEV_LIBRARY @prefix@/lib/libudev.a) @@ -40,6 +41,8 @@ SET(Protobuf_INCLUDE_DIRS @prefix@/include CACHE PATH "Protobuf include dir") SET(Protobuf_LIBRARY @prefix@/lib/libprotobuf.a CACHE FILEPATH "Protobuf library") endif() +endif() + SET(ZMQ_INCLUDE_PATH @prefix@/include) SET(ZMQ_LIB @prefix@/lib/libzmq.a) diff --git a/contrib/gitian/gitian-android.yml b/contrib/gitian/gitian-android.yml index ce213e056..02614b1a5 100644 --- a/contrib/gitian/gitian-android.yml +++ b/contrib/gitian/gitian-android.yml @@ -39,14 +39,13 @@ script: | WRAP_DIR=$HOME/wrapped HOSTS="arm-linux-android aarch64-linux-android" - FAKETIME_HOST_PROGS="clang clang++ ar ranlib nm" + FAKETIME_HOST_PROGS="clang clang++ ar nm" FAKETIME_PROGS="date" HOST_CFLAGS="-O2 -g" HOST_CXXFLAGS="-O2 -g" HOST_LDFLAGS=-static-libstdc++ export GZIP="-9n" - export TAR_OPTIONS="--mtime="$REFERENCE_DATE\\\ $REFERENCE_TIME"" export TZ="UTC" export BUILD_DIR=`pwd` mkdir -p ${WRAP_DIR} @@ -89,14 +88,13 @@ script: | } # Faketime for depends so intermediate results are comparable - DUMMYTIME="2000-01-01 12:00:00" export PATH_orig=${PATH} - create_global_faketime_wrappers "$DUMMYTIME" - create_per-host_faketime_wrappers "$DUMMYTIME" + create_global_faketime_wrappers "2000-01-01 12:00:00" + create_per-host_faketime_wrappers "2000-01-01 12:00:00" export PATH=${WRAP_DIR}:${PATH} # gcc 7+ honors SOURCE_DATE_EPOCH, no faketime needed - export SOURCE_DATE_EPOCH=`date -d "$DUMMYTIME" +%s` + export SOURCE_DATE_EPOCH=`date -d 2000-01-01T12:00:00 +%s` git config --global core.abbrev 9 cd monero @@ -109,6 +107,7 @@ script: | BASEPREFIX=`pwd`/contrib/depends # Build dependencies for each host + export TAR_OPTIONS=--mtime=2000-01-01T12:00:00 for i in $HOSTS; do make ${MAKEOPTS} -C ${BASEPREFIX} HOST="${i}" done @@ -117,12 +116,11 @@ script: | export PATH=${PATH_orig} create_global_faketime_wrappers "${REFERENCE_DATETIME}" create_per-host_faketime_wrappers "${REFERENCE_DATETIME}" - export PATH=${WRAP_DIR}:${PATH} - ORIGPATH="$PATH" # Build in a new dir for each host + export TAR_OPTIONS=--mtime=${REFERENCE_DATE}T${REFERENCE_TIME} for i in ${HOSTS}; do - export PATH=${BASEPREFIX}/${i}/native/bin:${ORIGPATH} + export PATH=${WRAP_DIR}:${BASEPREFIX}/${i}/native/bin:${PATH_orig} mkdir build && cd build cmake .. -DCMAKE_TOOLCHAIN_FILE=${BASEPREFIX}/${i}/share/toolchain.cmake -DCMAKE_BUILD_TYPE=Release make ${MAKEOPTS} diff --git a/contrib/gitian/gitian-build.py b/contrib/gitian/gitian-build.py index b60cc9309..64eb218bb 100755 --- a/contrib/gitian/gitian-build.py +++ b/contrib/gitian/gitian-build.py @@ -8,6 +8,12 @@ import sys gsigs = 'https://github.com/monero-project/gitian.sigs.git' gbrepo = 'https://github.com/devrandom/gitian-builder.git' +platforms = {'l': ['Linux', 'linux', 'tar.bz2'], + 'a': ['Android', 'android', 'tar.bz2'], + 'f': ['FreeBSD', 'freebsd', 'tar.bz2'], + 'w': ['Windows', 'win', 'zip'], + 'm': ['MacOS', 'osx', 'tar.bz2'] } + def setup(): global args, workdir programs = ['apt-cacher-ng', 'ruby', 'git', 'make', 'wget'] @@ -22,11 +28,7 @@ def setup(): if not os.path.isdir('builder'): subprocess.check_call(['git', 'clone', gbrepo, 'builder']) os.chdir('builder') - subprocess.check_call(['git', 'config', 'user.email', 'gitianuser@localhost']) - subprocess.check_call(['git', 'config', 'user.name', 'gitianuser']) - subprocess.check_call(['git', 'checkout', '963322de8420c50502c4cc33d4d7c0d84437b576']) - subprocess.check_call(['git', 'fetch', 'origin', '72c51f0bd2adec4eedab4dbd06c9229b9c4eb0e3']) - subprocess.check_call(['git', 'cherry-pick', '72c51f0bd2adec4eedab4dbd06c9229b9c4eb0e3']) + subprocess.check_call(['git', 'checkout', 'c0f77ca018cb5332bfd595e0aff0468f77542c23']) os.makedirs('inputs', exist_ok=True) os.chdir('inputs') if not os.path.isdir('monero'): @@ -52,39 +54,32 @@ def rebuild(): print('\nBuilding Dependencies\n') os.makedirs('../out/' + args.version, exist_ok=True) - if args.linux: - print('\nCompiling ' + args.version + ' Linux') - subprocess.check_call(['bin/gbuild', '-j', args.jobs, '-m', args.memory, '--commit', 'monero='+args.commit, '--url', 'monero='+args.url, 'inputs/monero/contrib/gitian/gitian-linux.yml']) - subprocess.check_call(['bin/gsign', '-p', args.sign_prog, '--signer', args.signer, '--release', args.version+'-linux', '--destination', '../sigs/', 'inputs/monero/contrib/gitian/gitian-linux.yml']) - subprocess.check_call('mv build/out/monero-*.tar.bz2 ../out/'+args.version, shell=True) - if args.android: - print('\nCompiling ' + args.version + ' Android') - subprocess.check_call(['bin/gbuild', '-j', args.jobs, '-m', args.memory, '--commit', 'monero='+args.commit, '--url', 'monero='+args.url, 'inputs/monero/contrib/gitian/gitian-android.yml']) - subprocess.check_call(['bin/gsign', '-p', args.sign_prog, '--signer', args.signer, '--release', args.version+'-android', '--destination', '../sigs/', 'inputs/monero/contrib/gitian/gitian-android.yml']) - subprocess.check_call('mv build/out/monero-*.tar.bz2 ../out/'+args.version, shell=True) + for i in args.os: + if i is 'm' and args.nomac: + continue - if args.windows: - print('\nCompiling ' + args.version + ' Windows') - subprocess.check_call(['bin/gbuild', '-j', args.jobs, '-m', args.memory, '--commit', 'monero='+args.commit, '--url', 'monero='+args.url, 'inputs/monero/contrib/gitian/gitian-win.yml']) - subprocess.check_call(['bin/gsign', '-p', args.sign_prog, '--signer', args.signer, '--release', args.version+'-win', '--destination', '../sigs/', 'inputs/monero/contrib/gitian/gitian-win.yml']) - subprocess.check_call('mv build/out/monero*.zip ../out/'+args.version, shell=True) + os_name = platforms[i][0] + tag_name = platforms[i][1] + suffix = platforms[i][2] - if args.macos: - print('\nCompiling ' + args.version + ' MacOS') - subprocess.check_call(['bin/gbuild', '-j', args.jobs, '-m', args.memory, '--commit', 'monero='+args.commit, '--url', 'monero'+args.url, 'inputs/monero/contrib/gitian/gitian-osx.yml']) - subprocess.check_call(['bin/gsign', '-p', args.sign_prog, '--signer', args.signer, '--release', args.version+'-osx', '--destination', '../sigs/', 'inputs/monero/contrib/gitian/gitian-osx.yml']) - subprocess.check_call('mv build/out/monero*.tar.bz2 ../out/'+args.version, shell=True) + print('\nCompiling ' + args.version + ' ' + os_name) + infile = 'inputs/monero/contrib/gitian/gitian-' + tag_name + '.yml' + subprocess.check_call(['bin/gbuild', '-j', args.jobs, '-m', args.memory, '--commit', 'monero='+args.commit, '--url', 'monero='+args.url, infile]) + subprocess.check_call(['bin/gsign', '-p', args.sign_prog, '--signer', args.signer, '--release', args.version+'-linux', '--destination', '../sigs/', infile]) + subprocess.check_call('mv build/out/monero-*.' + suffix + ' ../out/'+args.version, shell=True) + print('Moving var/install.log to var/install-' + tag_name + '.log') + subprocess.check_call('mv var/install.log var/install-' + tag_name + '.log', shell=True) + print('Moving var/build.log to var/build-' + tag_name + '.log') + subprocess.check_call('mv var/build.log var/build-' + tag_name + '.log', shell=True) os.chdir(workdir) if args.commit_files: print('\nCommitting '+args.version+' Unsigned Sigs\n') os.chdir('sigs') - subprocess.check_call(['git', 'add', args.version+'-linux/'+args.signer]) - subprocess.check_call(['git', 'add', args.version+'-android/'+args.signer]) - subprocess.check_call(['git', 'add', args.version+'-win/'+args.signer]) - subprocess.check_call(['git', 'add', args.version+'-osx/'+args.signer]) + for i, v in platforms: + subprocess.check_call(['git', 'add', args.version+'-'+v[1]+'/'+args.signer]) subprocess.check_call(['git', 'commit', '-m', 'Add '+args.version+' unsigned sigs for '+args.signer]) os.chdir(workdir) @@ -109,14 +104,9 @@ def verify(): global args, workdir os.chdir('builder') - print('\nVerifying v'+args.version+' Linux\n') - subprocess.check_call(['bin/gverify', '-v', '-d', '../sigs/', '-r', args.version+'-linux', 'inputs/monero/contrib/gitian/gitian-linux.yml']) - print('\nVerifying v'+args.version+' Android\n') - subprocess.check_call(['bin/gverify', '-v', '-d', '../sigs/', '-r', args.version+'-android', 'inputs/monero/contrib/gitian/gitian-android.yml']) - print('\nVerifying v'+args.version+' Windows\n') - subprocess.check_call(['bin/gverify', '-v', '-d', '../sigs/', '-r', args.version+'-win', 'inputs/monero/contrib/gitian/gitian-win.yml']) - print('\nVerifying v'+args.version+' MacOS\n') - subprocess.check_call(['bin/gverify', '-v', '-d', '../sigs/', '-r', args.version+'-osx', 'inputs/monero/contrib/gitian/gitian-osx.yml']) + for i, v in platforms: + print('\nVerifying v'+args.version+' '+v[0]+'\n') + subprocess.check_call(['bin/gverify', '-v', '-d', '../sigs/', '-r', args.version+'-'+v[1], 'inputs/monero/contrib/gitian/gitian-'+v[1]+'.yml']) os.chdir(workdir) def main(): @@ -129,7 +119,7 @@ def main(): parser.add_argument('-v', '--verify', action='store_true', dest='verify', help='Verify the Gitian build') parser.add_argument('-b', '--build', action='store_true', dest='build', help='Do a Gitian build') parser.add_argument('-B', '--buildsign', action='store_true', dest='buildsign', help='Build both signed and unsigned binaries') - parser.add_argument('-o', '--os', dest='os', default='lawm', help='Specify which Operating Systems the build is for. Default is %(default)s. l for Linux, a for Android, w for Windows, m for MacOS') + parser.add_argument('-o', '--os', dest='os', default='lafwm', help='Specify which Operating Systems the build is for. Default is %(default)s. l for Linux, a for Android, f for FreeBSD, w for Windows, m for MacOS') parser.add_argument('-r', '--rebuild', action='store_true', dest='rebuild', help='Redo a Gitian build') parser.add_argument('-R', '--rebuildsign', action='store_true', dest='rebuildsign', help='Redo and sign a Gitian build') parser.add_argument('-j', '--jobs', dest='jobs', default='2', help='Number of processes to use. Default %(default)s') @@ -146,11 +136,6 @@ def main(): args = parser.parse_args() workdir = os.getcwd() - args.linux = 'l' in args.os - args.android = 'a' in args.os - args.windows = 'w' in args.os - args.macos = 'm' in args.os - args.is_bionic = b'bionic' in subprocess.check_output(['lsb_release', '-cs']) if args.buildsign: @@ -177,10 +162,11 @@ def main(): os.environ['LXC_GUEST_IP'] = '10.0.3.5' # Disable MacOS build if no SDK found - if args.macos and not os.path.isfile('builder/inputs/MacOSX10.11.sdk.tar.gz'): - args.macos = False + args.nomac = False + if 'm' in args.os and not os.path.isfile('builder/inputs/MacOSX10.11.sdk.tar.gz'): if args.build: print('Cannot build for MacOS, SDK does not exist. Will build for other OSes') + args.nomac = True script_name = os.path.basename(sys.argv[0]) # Signer and version shouldn't be empty diff --git a/contrib/gitian/gitian-freebsd.yml b/contrib/gitian/gitian-freebsd.yml new file mode 100644 index 000000000..0220b82a5 --- /dev/null +++ b/contrib/gitian/gitian-freebsd.yml @@ -0,0 +1,133 @@ +--- +name: "monero-freebsd-0.15" +enable_cache: true +suites: +- "bionic" +architectures: +- "amd64" +packages: +- "curl" +- "clang-8" +- "gperf" +- "gcc-7" +- "g++-7" +- "gcc" +- "g++" +- "binutils-gold" +- "git" +- "pkg-config" +- "build-essential" +- "autoconf" +- "libtool" +- "automake" +- "faketime" +- "bsdmainutils" +- "ca-certificates" +- "python" +- "cmake" +- "ccache" +- "protobuf-compiler" +- "libdbus-1-dev" +- "libharfbuzz-dev" +- "libprotobuf-dev" +- "python3-zmq" +remotes: +- "url": "https://github.com/monero-project/monero.git" + "dir": "monero" +files: [] +script: | + + WRAP_DIR=$HOME/wrapped + HOSTS="x86_64-unknown-freebsd" + FAKETIME_HOST_PROGS="" + FAKETIME_PROGS="clang-8 clang++-8 date" + HOST_CFLAGS="-O2 -g" + HOST_CXXFLAGS="-O2 -g" + HOST_LDFLAGS=-static-libstdc++ + + export GZIP="-9n" + export TZ="UTC" + export BUILD_DIR=`pwd` + mkdir -p ${WRAP_DIR} + if test -n "$GBUILD_CACHE_ENABLED"; then + export SOURCES_PATH=${GBUILD_COMMON_CACHE} + export BASE_CACHE=${GBUILD_PACKAGE_CACHE} + mkdir -p ${BASE_CACHE} ${SOURCES_PATH} + fi + + export ZERO_AR_DATE=1 + + function create_global_faketime_wrappers { + for prog in ${FAKETIME_PROGS}; do + echo '#!/usr/bin/env bash' > ${WRAP_DIR}/${prog} + echo "REAL=\`which -a ${prog} | grep -v ${WRAP_DIR}/${prog} | head -1\`" >> ${WRAP_DIR}/${prog} + echo 'export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/faketime/libfaketime.so.1' >> ${WRAP_DIR}/${prog} + echo "export FAKETIME=\"$1\"" >> ${WRAP_DIR}/${prog} + echo "\$REAL \$@" >> $WRAP_DIR/${prog} + chmod +x ${WRAP_DIR}/${prog} + done + } + + function create_per-host_faketime_wrappers { + for i in $HOSTS; do + for prog in ${FAKETIME_HOST_PROGS}; do + WRAPPER=${WRAP_DIR}/${i}-${prog} + echo '#!/usr/bin/env bash' > ${WRAPPER} + echo "REAL=\`which -a ${i}-${prog} | grep -v ${WRAP_DIR}/${i}-${prog} | head -1\`" >> ${WRAPPER} + echo 'export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/faketime/libfaketime.so.1' >> ${WRAPPER} + echo "export FAKETIME=\"$1\"" >> ${WRAPPER} + echo "$NDKDIR/${ABI}-$prog \$@" >> ${WRAPPER} + chmod +x ${WRAPPER} + done + done + } + + # Faketime for depends so intermediate results are comparable + export PATH_orig=${PATH} + create_global_faketime_wrappers "2000-01-01 12:00:00" + create_per-host_faketime_wrappers "2000-01-01 12:00:00" + export PATH=${WRAP_DIR}:${PATH} + + # gcc 7+ honors SOURCE_DATE_EPOCH, no faketime needed + export SOURCE_DATE_EPOCH=`date -d 2000-01-01T12:00:00 +%s` + + git config --global core.abbrev 9 + cd monero + # Set the version string that gets added to the tar archive name + version="`git describe`" + if [[ $version == *"-"*"-"* ]]; then + version="`git rev-parse --short=9 HEAD`" + version="`echo $version | head -c 9`" + fi + + BASEPREFIX=`pwd`/contrib/depends + # Build dependencies for each host + export TAR_OPTIONS=--mtime=2000-01-01T12:00:00 + for i in $HOSTS; do + make ${MAKEOPTS} -C ${BASEPREFIX} HOST="${i}" + done + + # Faketime for binaries + export PATH=${PATH_orig} + create_global_faketime_wrappers "${REFERENCE_DATETIME}" + create_per-host_faketime_wrappers "${REFERENCE_DATETIME}" + + ORIGPATH="$PATH" + # Build in a new dir for each host + export SOURCE_DATE_EPOCH=`date -d ${REFERENCE_DATE}T${REFERENCE_TIME} +%s` + export TAR_OPTIONS=--mtime=${REFERENCE_DATE}T${REFERENCE_TIME} + for i in ${HOSTS}; do + export PATH=${WRAP_DIR}:${BASEPREFIX}/${i}/native/bin:${ORIGPATH} + mkdir build && cd build + cmake .. -DCMAKE_TOOLCHAIN_FILE=${BASEPREFIX}/${i}/share/toolchain.cmake -DCMAKE_BUILD_TYPE=Release + make ${MAKEOPTS} + chmod 755 bin/* + cp ../LICENSE bin + chmod 644 bin/LICENSE + DISTNAME=monero-${i}-${version} + mv bin ${DISTNAME} + find ${DISTNAME}/ | sort | tar --no-recursion --owner=0 --group=0 -c -T - | bzip2 -9 > ${OUTDIR}/${DISTNAME}.tar.bz2 + cd .. + rm -rf build + done + diff --git a/contrib/gitian/gitian-linux.yml b/contrib/gitian/gitian-linux.yml index d2124e45c..9c2ebac9b 100644 --- a/contrib/gitian/gitian-linux.yml +++ b/contrib/gitian/gitian-linux.yml @@ -50,14 +50,13 @@ script: | WRAP_DIR=$HOME/wrapped HOSTS="x86_64-linux-gnu arm-linux-gnueabihf aarch64-linux-gnu i686-linux-gnu" - FAKETIME_HOST_PROGS="gcc g++" - FAKETIME_PROGS="date ar ranlib nm" + FAKETIME_HOST_PROGS="" + FAKETIME_PROGS="date" HOST_CFLAGS="-O2 -g" HOST_CXXFLAGS="-O2 -g" HOST_LDFLAGS=-static-libstdc++ export GZIP="-9n" - export TAR_OPTIONS="--mtime="$REFERENCE_DATE\\\ $REFERENCE_TIME"" export TZ="UTC" export BUILD_DIR=`pwd` mkdir -p ${WRAP_DIR} @@ -105,29 +104,15 @@ script: | # x86 needs /usr/include/i386-linux-gnu/asm pointed to /usr/include/x86_64-linux-gnu/asm, # but we can't write there. Instead, create a link here and force it to be included in the - # search paths by wrapping gcc/g++. + # search paths. + # This problem goes away if linux-libc-dev:i386 pkg exists, but it's not in bionic. - mkdir -p $EXTRA_INCLUDES_BASE/i686-pc-linux-gnu - rm -f $WRAP_DIR/extra_includes/i686-pc-linux-gnu/asm - ln -s /usr/include/x86_64-linux-gnu/asm $EXTRA_INCLUDES_BASE/i686-pc-linux-gnu/asm + mkdir -p $EXTRA_INCLUDES_BASE/i686-linux-gnu + rm -f $WRAP_DIR/extra_includes/i686-linux-gnu/asm + ln -s /usr/include/x86_64-linux-gnu/asm $EXTRA_INCLUDES_BASE/i686-linux-gnu/asm - for prog in gcc g++; do - rm -f ${WRAP_DIR}/${prog} - cat << EOF > ${WRAP_DIR}/${prog} - #!/usr/bin/env bash - REAL="`which -a ${prog}-7 | grep -v ${WRAP_DIR}/${prog} | head -1`" - for var in "\$@" - do - if [ "\$var" = "-m32" ]; then - export C_INCLUDE_PATH="$EXTRA_INCLUDES_BASE/i686-pc-linux-gnu" - export CPLUS_INCLUDE_PATH="$EXTRA_INCLUDES_BASE/i686-pc-linux-gnu" - break - fi - done - \$REAL \$@ - EOF - chmod +x ${WRAP_DIR}/${prog} - done + # gcc 7+ honors SOURCE_DATE_EPOCH, no faketime needed + export SOURCE_DATE_EPOCH=`date -d 2000-01-01T12:00:00 +%s` git config --global core.abbrev 9 cd monero @@ -140,13 +125,17 @@ script: | BASEPREFIX=`pwd`/contrib/depends # Build dependencies for each host + export TAR_OPTIONS=--mtime=2000-01-01T12:00:00 for i in $HOSTS; do EXTRA_INCLUDES="$EXTRA_INCLUDES_BASE/$i" if [ -d "$EXTRA_INCLUDES" ]; then - export HOST_ID_SALT="$EXTRA_INCLUDES" + export C_INCLUDE_PATH="$EXTRA_INCLUDES" + export CPLUS_INCLUDE_PATH="$EXTRA_INCLUDES" + else + unset C_INCLUDE_PATH + unset CPLUS_INCLUDE_PATH fi make ${MAKEOPTS} -C ${BASEPREFIX} HOST="${i}" V=1 - unset HOST_ID_SALT done # Faketime for binaries @@ -157,9 +146,19 @@ script: | ORIGPATH="$PATH" # Build in a new dir for each host + export SOURCE_DATE_EPOCH=`date -d ${REFERENCE_DATE}T${REFERENCE_TIME} +%s` + export TAR_OPTIONS=--mtime=${REFERENCE_DATE}T${REFERENCE_TIME} for i in ${HOSTS}; do export PATH=${BASEPREFIX}/${i}/native/bin:${ORIGPATH} mkdir build && cd build + EXTRA_INCLUDES="$EXTRA_INCLUDES_BASE/$i" + if [ -d "$EXTRA_INCLUDES" ]; then + export C_INCLUDE_PATH="$EXTRA_INCLUDES" + export CPLUS_INCLUDE_PATH="$EXTRA_INCLUDES" + else + unset C_INCLUDE_PATH + unset CPLUS_INCLUDE_PATH + fi cmake .. -DCMAKE_TOOLCHAIN_FILE=${BASEPREFIX}/${i}/share/toolchain.cmake -DBACKCOMPAT=ON make ${MAKEOPTS} chmod 755 bin/* diff --git a/contrib/gitian/gitian-osx.yml b/contrib/gitian/gitian-osx.yml index 1f9928bb5..ecc7d4b59 100644 --- a/contrib/gitian/gitian-osx.yml +++ b/contrib/gitian/gitian-osx.yml @@ -32,10 +32,9 @@ script: | WRAP_DIR=$HOME/wrapped HOSTS="x86_64-apple-darwin11" FAKETIME_HOST_PROGS="" - FAKETIME_PROGS="ar ranlib date dmg genisoimage" + FAKETIME_PROGS="ar ranlib date dmg genisoimage python" export GZIP="-9n" - export TAR_OPTIONS="--mtime="$REFERENCE_DATE\\\ $REFERENCE_TIME"" export TZ="UTC" export BUILD_DIR=`pwd` mkdir -p ${WRAP_DIR} @@ -92,6 +91,7 @@ script: | tar -C ${BASEPREFIX}/SDKs -xf ${BUILD_DIR}/MacOSX10.11.sdk.tar.gz # Build dependencies for each host + export TAR_OPTIONS=--mtime=2000-01-01T12:00:00 for i in $HOSTS; do make ${MAKEOPTS} -C ${BASEPREFIX} HOST="${i}" done @@ -104,6 +104,7 @@ script: | ORIGPATH="$PATH" # Build in a new dir for each host + export TAR_OPTIONS=--mtime=${REFERENCE_DATE}T${REFERENCE_TIME} for i in ${HOSTS}; do export PATH=${BASEPREFIX}/${i}/native/bin:${ORIGPATH} mkdir build && cd build diff --git a/contrib/gitian/gitian-win.yml b/contrib/gitian/gitian-win.yml index 7bfb14a95..bd85695c1 100644 --- a/contrib/gitian/gitian-win.yml +++ b/contrib/gitian/gitian-win.yml @@ -22,6 +22,19 @@ packages: - "python" - "rename" - "cmake" +alternatives: +- + package: "i686-w64-mingw32-g++" + path: "/usr/bin/i686-w64-mingw32-g++-posix" +- + package: "i686-w64-mingw32-gcc" + path: "/usr/bin/i686-w64-mingw32-gcc-posix" +- + package: "x86_64-w64-mingw32-g++" + path: "/usr/bin/x86_64-w64-mingw32-g++-posix" +- + package: "x86_64-w64-mingw32-gcc" + path: "/usr/bin/x86_64-w64-mingw32-gcc-posix" remotes: - "url": "https://github.com/monero-project/monero.git" "dir": "monero" @@ -29,13 +42,12 @@ files: [] script: | WRAP_DIR=$HOME/wrapped HOSTS="i686-w64-mingw32 x86_64-w64-mingw32" - FAKETIME_HOST_PROGS="ar ranlib nm windres strip objcopy" + FAKETIME_HOST_PROGS="windres objcopy" FAKETIME_PROGS="date zip" HOST_CFLAGS="-O2 -g" HOST_CXXFLAGS="-O2 -g" export GZIP="-9n" - export TAR_OPTIONS="--mtime="$REFERENCE_DATE\\\ $REFERENCE_TIME"" export TZ="UTC" export BUILD_DIR=`pwd` mkdir -p ${WRAP_DIR} @@ -69,37 +81,15 @@ script: | done } - function create_per-host_linker_wrapper { - # This is only needed for trusty, as the mingw linker leaks a few bytes of - # heap, causing non-determinism. See discussion in https://github.com/bitcoin/bitcoin/pull/6900 - for i in $HOSTS; do - mkdir -p ${WRAP_DIR}/${i} - for prog in collect2; do - echo '#!/usr/bin/env bash' > ${WRAP_DIR}/${i}/${prog} - REAL=$(${i}-gcc -print-prog-name=${prog}) - echo "export MALLOC_PERTURB_=255" >> ${WRAP_DIR}/${i}/${prog} - echo "${REAL} \$@" >> $WRAP_DIR/${i}/${prog} - chmod +x ${WRAP_DIR}/${i}/${prog} - done - for prog in gcc g++; do - echo '#!/usr/bin/env bash' > ${WRAP_DIR}/${i}-${prog} - echo "REAL=\`which -a ${i}-${prog}-posix | grep -v ${WRAP_DIR}/${i}-${prog} | head -1\`" >> ${WRAP_DIR}/${i}-${prog} - echo 'export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/faketime/libfaketime.so.1' >> ${WRAP_DIR}/${i}-${prog} - echo "export FAKETIME=\"$1\"" >> ${WRAP_DIR}/${i}-${prog} - echo "export COMPILER_PATH=${WRAP_DIR}/${i}" >> ${WRAP_DIR}/${i}-${prog} - echo "\$REAL \$@" >> $WRAP_DIR/${i}-${prog} - chmod +x ${WRAP_DIR}/${i}-${prog} - done - done - } - # Faketime for depends so intermediate results are comparable export PATH_orig=${PATH} create_global_faketime_wrappers "2000-01-01 12:00:00" create_per-host_faketime_wrappers "2000-01-01 12:00:00" - create_per-host_linker_wrapper "2000-01-01 12:00:00" export PATH=${WRAP_DIR}:${PATH} + # gcc 7+ honors SOURCE_DATE_EPOCH, no faketime needed + export SOURCE_DATE_EPOCH=`date -d 2000-01-01T12:00:00 +%s` + git config --global core.abbrev 9 cd monero # Set the version string that gets added to the tar archive name @@ -111,6 +101,7 @@ script: | BASEPREFIX=`pwd`/contrib/depends # Build dependencies for each host + export TAR_OPTIONS=--mtime=2000-01-01T12:00:00 for i in $HOSTS; do EXTRA_INCLUDES="$EXTRA_INCLUDES_BASE/$i" if [ -d "$EXTRA_INCLUDES" ]; then @@ -129,6 +120,8 @@ script: | ORIGPATH="$PATH" # Run cmake and make, for each create a new build/ directory, # compile from there, archive, export and delete the archive again + export SOURCE_DATE_EPOCH=`date -d ${REFERENCE_DATE}T${REFERENCE_TIME} +%s` + export TAR_OPTIONS=--mtime=${REFERENCE_DATE}T${REFERENCE_TIME} for i in ${HOSTS}; do export PATH=${BASEPREFIX}/${i}/native/bin:${ORIGPATH} mkdir build && cd build