diff --git a/.gitignore b/.gitignore index 911e6a31f5..9b23096aed 100644 --- a/.gitignore +++ b/.gitignore @@ -1,11 +1,13 @@ /.vs /autoconf /automake +/bison /build /elfutils +/flex /gettext /glib -/glib-openssl +/glib-networking /glib-schannel /gn /ipch diff --git a/Makefile.linux.mk b/Makefile.linux.mk index 0cd0614251..c9f459e526 100644 --- a/Makefile.linux.mk +++ b/Makefile.linux.mk @@ -89,7 +89,7 @@ build/$1-%/lib/pkgconfig/capstone.pc: build/$1-env-%.rc build/.capstone-submodul *-mips64) capstone_archs="mips64" ;; \ *-mips64el) capstone_archs="mips64" ;; \ esac \ - && CFLAGS="$$$$CPPFLAGS $$$$CFLAGS" make -C capstone \ + && CFLAGS="$$$$CPPFLAGS $$$$CFLAGS -w" make -C capstone \ PREFIX=$$$$frida_prefix \ BUILDDIR=../build/$2-$$*/capstone \ CAPSTONE_BUILD_CORE_ONLY=yes \ @@ -129,7 +129,7 @@ build/.$1-gum-npm-stamp: build/$1-env-linux-$$(build_arch).rc @touch $$@ build/$1-%/lib/pkgconfig/frida-gum-1.0.pc: build/.frida-gum-submodule-stamp build/.$1-gum-npm-stamp build/$1-%/lib/pkgconfig/capstone.pc - . build/$1-meson-env-linux-$$(build_arch).rc; \ + . build/$1-meson-env-$$*.rc; \ builddir=build/$2-$$*/frida-gum; \ if [ ! -f $$$$builddir/build.ninja ]; then \ mkdir -p $$$$builddir; \ @@ -183,7 +183,7 @@ core-qnx-arm: build/frida_thin-qnx-arm/lib/pkgconfig/frida-core-1.0.pc ##@core B core-qnx-armeabi: build/frida_thin-qnx-armeabi/lib/pkgconfig/frida-core-1.0.pc ##@core Build for QNX/ARMEABI build/tmp-linux-x86/frida-core/.frida-ninja-stamp: build/.frida-core-submodule-stamp build/frida-linux-x86/lib/pkgconfig/frida-gum-1.0.pc - . build/frida-meson-env-linux-$(build_arch).rc; \ + . build/frida-meson-env-linux-x86.rc; \ builddir=$(@D); \ if [ ! -f $$builddir/build.ninja ]; then \ mkdir -p $$builddir; \ @@ -205,7 +205,7 @@ build/tmp-linux-x86/frida-core/.frida-ninja-stamp: build/.frida-core-submodule-s fi @touch $@ build/tmp-linux-x86_64/frida-core/.frida-ninja-stamp: build/.frida-core-submodule-stamp build/frida-linux-x86_64/lib/pkgconfig/frida-gum-1.0.pc - . build/frida-meson-env-linux-$(build_arch).rc; \ + . build/frida-meson-env-linux-x86_64.rc; \ builddir=$(@D); \ if [ ! -f $$builddir/build.ninja ]; then \ mkdir -p $$builddir; \ @@ -227,7 +227,7 @@ build/tmp-linux-x86_64/frida-core/.frida-ninja-stamp: build/.frida-core-submodul fi @touch $@ build/tmp-android-x86/frida-core/.frida-ninja-stamp: build/.frida-core-submodule-stamp build/frida-android-x86/lib/pkgconfig/frida-gum-1.0.pc - . build/frida-meson-env-linux-$(build_arch).rc; \ + . build/frida-meson-env-android-x86.rc; \ builddir=$(@D); \ if [ ! -f $$builddir/build.ninja ]; then \ mkdir -p $$builddir; \ @@ -240,7 +240,7 @@ build/tmp-android-x86/frida-core/.frida-ninja-stamp: build/.frida-core-submodule fi @touch $@ build/tmp-android-x86_64/frida-core/.frida-ninja-stamp: build/.frida-core-submodule-stamp build/frida-android-x86_64/lib/pkgconfig/frida-gum-1.0.pc - . build/frida-meson-env-linux-$(build_arch).rc; \ + . build/frida-meson-env-android-x86_64.rc; \ builddir=$(@D); \ if [ ! -f $$builddir/build.ninja ]; then \ mkdir -p $$builddir; \ @@ -257,7 +257,7 @@ build/tmp-android-x86_64/frida-core/.frida-ninja-stamp: build/.frida-core-submod fi @touch $@ build/tmp-android-arm/frida-core/.frida-ninja-stamp: build/.frida-core-submodule-stamp build/frida-android-arm/lib/pkgconfig/frida-gum-1.0.pc - . build/frida-meson-env-linux-$(build_arch).rc; \ + . build/frida-meson-env-android-arm.rc; \ builddir=$(@D); \ if [ ! -f $$builddir/build.ninja ]; then \ mkdir -p $$builddir; \ @@ -270,7 +270,7 @@ build/tmp-android-arm/frida-core/.frida-ninja-stamp: build/.frida-core-submodule fi @touch $@ build/tmp-android-arm64/frida-core/.frida-ninja-stamp: build/.frida-core-submodule-stamp build/frida-android-arm64/lib/pkgconfig/frida-gum-1.0.pc - . build/frida-meson-env-linux-$(build_arch).rc; \ + . build/frida-meson-env-android-arm64.rc; \ builddir=$(@D); \ if [ ! -f $$builddir/build.ninja ]; then \ mkdir -p $$builddir; \ @@ -287,7 +287,7 @@ build/tmp-android-arm64/frida-core/.frida-ninja-stamp: build/.frida-core-submodu fi @touch $@ build/tmp_thin-%/frida-core/.frida-ninja-stamp: build/.frida-core-submodule-stamp build/frida_thin-%/lib/pkgconfig/frida-gum-1.0.pc - . build/frida_thin-meson-env-linux-$(build_arch).rc; \ + . build/frida_thin-meson-env-$*.rc; \ builddir=$(@D); \ if [ ! -f $$builddir/build.ninja ]; then \ mkdir -p $$builddir; \ @@ -361,7 +361,7 @@ python-linux-arm64: build/tmp_thin-linux-arm64/frida-$(PYTHON_NAME)/.frida-stamp define make-python-rule build/$2-%/frida-$$(PYTHON_NAME)/.frida-stamp: build/.frida-python-submodule-stamp build/$1-%/lib/pkgconfig/frida-core-1.0.pc - . build/$1-meson-env-linux-$$(build_arch).rc; \ + . build/$1-meson-env-$$*.rc; \ builddir=$$(@D); \ if [ ! -f $$$$builddir/build.ninja ]; then \ mkdir -p $$$$builddir; \ @@ -465,7 +465,7 @@ tools-linux-arm64: build/tmp_thin-linux-arm64/frida-tools-$(PYTHON_NAME)/.frida- define make-tools-rule build/$2-%/frida-tools-$$(PYTHON_NAME)/.frida-stamp: build/.frida-tools-submodule-stamp build/$2-%/frida-$$(PYTHON_NAME)/.frida-stamp - . build/$1-meson-env-linux-$$(build_arch).rc; \ + . build/$1-meson-env-$$*.rc; \ builddir=$$(@D); \ if [ ! -f $$$$builddir/build.ninja ]; then \ mkdir -p $$$$builddir; \ diff --git a/Makefile.macos.mk b/Makefile.macos.mk index 348321ae74..8f553a1b7a 100644 --- a/Makefile.macos.mk +++ b/Makefile.macos.mk @@ -83,7 +83,7 @@ build/$1-%/lib/pkgconfig/capstone.pc: build/$1-env-%.rc build/.capstone-submodul frida-ios-arm64) capstone_archs="aarch64 arm" ;; \ *-arm64*) capstone_archs="aarch64" ;; \ esac \ - && CFLAGS="$$$$CPPFLAGS $$$$CFLAGS" make -C capstone \ + && CFLAGS="$$$$CPPFLAGS $$$$CFLAGS -w" make -C capstone \ PREFIX=$$$$frida_prefix \ BUILDDIR=../build/$2-$$*/capstone \ CAPSTONE_BUILD_CORE_ONLY=yes \ @@ -113,7 +113,7 @@ build/.$1-gum-npm-stamp: build/$1-env-macos-$$(build_arch).rc @touch $$@ build/$1-%/lib/pkgconfig/frida-gum-1.0.pc: build/.frida-gum-submodule-stamp build/.$1-gum-npm-stamp build/$1-%/lib/pkgconfig/capstone.pc - . build/$1-meson-env-macos-$$(build_arch).rc; \ + . build/$1-meson-env-$$*.rc; \ builddir=build/$2-$$*/frida-gum; \ if [ ! -f $$$$builddir/build.ninja ]; then \ mkdir -p $$$$builddir; \ @@ -151,7 +151,7 @@ core-android-arm: build/frida-android-arm/lib/pkgconfig/frida-core-1.0.pc ##@cor core-android-arm64: build/frida-android-arm64/lib/pkgconfig/frida-core-1.0.pc ##@core Build for Android/ARM64 build/tmp-macos-%/frida-core/.frida-ninja-stamp: build/.frida-core-submodule-stamp build/frida-macos-%/lib/pkgconfig/frida-gum-1.0.pc - . build/frida-meson-env-macos-$(build_arch).rc; \ + . build/frida-meson-env-macos-$*.rc; \ builddir=$(@D); \ if [ ! -f $$builddir/build.ninja ]; then \ mkdir -p $$builddir; \ @@ -171,7 +171,7 @@ build/tmp-macos-%/frida-core/.frida-ninja-stamp: build/.frida-core-submodule-sta fi @touch $@ build/tmp-ios-x86/frida-core/.frida-ninja-stamp: build/.frida-core-submodule-stamp build/frida-ios-x86/lib/pkgconfig/frida-gum-1.0.pc - . build/frida-meson-env-macos-$(build_arch).rc; \ + . build/frida-meson-env-ios-x86.rc; \ builddir=$(@D); \ if [ ! -f $$builddir/build.ninja ]; then \ mkdir -p $$builddir; \ @@ -183,7 +183,7 @@ build/tmp-ios-x86/frida-core/.frida-ninja-stamp: build/.frida-core-submodule-sta fi @touch $@ build/tmp-ios-x86_64/frida-core/.frida-ninja-stamp: build/.frida-core-submodule-stamp build/frida-ios-x86_64/lib/pkgconfig/frida-gum-1.0.pc - . build/frida-meson-env-macos-$(build_arch).rc; \ + . build/frida-meson-env-ios-x86_64.rc; \ builddir=$(@D); \ if [ ! -f $$builddir/build.ninja ]; then \ mkdir -p $$builddir; \ @@ -198,7 +198,7 @@ build/tmp-ios-x86_64/frida-core/.frida-ninja-stamp: build/.frida-core-submodule- fi @touch $@ build/tmp-ios-arm/frida-core/.frida-ninja-stamp: build/.frida-core-submodule-stamp build/frida-ios-arm/lib/pkgconfig/frida-gum-1.0.pc - . build/frida-meson-env-macos-$(build_arch).rc; \ + . build/frida-meson-env-ios-arm.rc; \ builddir=$(@D); \ if [ ! -f $$builddir/build.ninja ]; then \ mkdir -p $$builddir; \ @@ -210,7 +210,7 @@ build/tmp-ios-arm/frida-core/.frida-ninja-stamp: build/.frida-core-submodule-sta fi @touch $@ build/tmp-ios-arm64/frida-core/.frida-ninja-stamp: build/.frida-core-submodule-stamp build/frida-ios-arm64/lib/pkgconfig/frida-gum-1.0.pc - . build/frida-meson-env-macos-$(build_arch).rc; \ + . build/frida-meson-env-ios-arm64.rc; \ builddir=$(@D); \ if [ ! -f $$builddir/build.ninja ]; then \ mkdir -p $$builddir; \ @@ -225,7 +225,7 @@ build/tmp-ios-arm64/frida-core/.frida-ninja-stamp: build/.frida-core-submodule-s fi @touch $@ build/tmp-ios-arm64e/frida-core/.frida-ninja-stamp: build/.frida-core-submodule-stamp build/frida-ios-arm64e/lib/pkgconfig/frida-gum-1.0.pc - . build/frida-meson-env-macos-$(build_arch).rc; \ + . build/frida-meson-env-ios-arm64e.rc; \ builddir=$(@D); \ if [ ! -f $$builddir/build.ninja ]; then \ mkdir -p $$builddir; \ @@ -240,7 +240,7 @@ build/tmp-ios-arm64e/frida-core/.frida-ninja-stamp: build/.frida-core-submodule- fi @touch $@ build/tmp-android-x86/frida-core/.frida-ninja-stamp: build/.frida-core-submodule-stamp build/frida-android-x86/lib/pkgconfig/frida-gum-1.0.pc - . build/frida-meson-env-macos-$(build_arch).rc; \ + . build/frida-meson-env-android-x86.rc; \ builddir=$(@D); \ if [ ! -f $$builddir/build.ninja ]; then \ mkdir -p $$builddir; \ @@ -252,7 +252,7 @@ build/tmp-android-x86/frida-core/.frida-ninja-stamp: build/.frida-core-submodule fi @touch $@ build/tmp-android-x86_64/frida-core/.frida-ninja-stamp: build/.frida-core-submodule-stamp build/frida-android-x86_64/lib/pkgconfig/frida-gum-1.0.pc - . build/frida-meson-env-macos-$(build_arch).rc; \ + . build/frida-meson-env-android-x86_64.rc; \ builddir=$(@D); \ if [ ! -f $$builddir/build.ninja ]; then \ mkdir -p $$builddir; \ @@ -268,7 +268,7 @@ build/tmp-android-x86_64/frida-core/.frida-ninja-stamp: build/.frida-core-submod fi @touch $@ build/tmp-android-arm/frida-core/.frida-ninja-stamp: build/.frida-core-submodule-stamp build/frida-android-arm/lib/pkgconfig/frida-gum-1.0.pc - . build/frida-meson-env-macos-$(build_arch).rc; \ + . build/frida-meson-env-android-arm.rc; \ builddir=$(@D); \ if [ ! -f $$builddir/build.ninja ]; then \ mkdir -p $$builddir; \ @@ -280,7 +280,7 @@ build/tmp-android-arm/frida-core/.frida-ninja-stamp: build/.frida-core-submodule fi @touch $@ build/tmp-android-arm64/frida-core/.frida-ninja-stamp: build/.frida-core-submodule-stamp build/frida-android-arm64/lib/pkgconfig/frida-gum-1.0.pc - . build/frida-meson-env-macos-$(build_arch).rc; \ + . build/frida-meson-env-android-arm64.rc; \ builddir=$(@D); \ if [ ! -f $$builddir/build.ninja ]; then \ mkdir -p $$builddir; \ @@ -296,7 +296,7 @@ build/tmp-android-arm64/frida-core/.frida-ninja-stamp: build/.frida-core-submodu fi @touch $@ build/tmp_thin-%/frida-core/.frida-ninja-stamp: build/.frida-core-submodule-stamp build/frida_thin-%/lib/pkgconfig/frida-gum-1.0.pc - . build/frida_thin-meson-env-macos-$(build_arch).rc; \ + . build/frida_thin-meson-env-$*.rc; \ builddir=$(@D); \ if [ ! -f $$builddir/build.ninja ]; then \ mkdir -p $$builddir; \ @@ -380,11 +380,11 @@ build/tmp-android-%/frida-core/.frida-helper-and-agent-stamp: build/tmp-android- @touch $@ build/.core-macos-stamp-%: build/%/lib/pkgconfig/frida-core-1.0.pc - @if [ -z "$$MAC_CERTID" ]; then echo "MAC_CERTID not set, see https://github.com/frida/frida#macos-and-ios"; exit 1; fi + @if [ -z "$$MACOS_CERTID" ]; then echo "MACOS_CERTID not set, see https://github.com/frida/frida#macos-and-ios"; exit 1; fi . build/frida-meson-env-macos-$(build_arch).rc \ - && $$CODESIGN -f -s "$$MAC_CERTID" -i "re.frida.Server" build/$*/bin/frida-server \ + && $$CODESIGN -f -s "$$MACOS_CERTID" -i "re.frida.Server" build/$*/bin/frida-server \ && $$INSTALL_NAME_TOOL -id @executable_path/../Frameworks/FridaGadget.dylib build/$*/lib/frida-gadget.dylib \ - && $$CODESIGN -f -s "$$MAC_CERTID" build/$*/lib/frida-gadget.dylib + && $$CODESIGN -f -s "$$MACOS_CERTID" build/$*/lib/frida-gadget.dylib @touch $@ build/.core-ios-stamp-%: build/%/lib/pkgconfig/frida-core-1.0.pc @if [ -z "$$IOS_CERTID" ]; then echo "IOS_CERTID not set, see https://github.com/frida/frida#macos-and-ios"; exit 1; fi @@ -400,7 +400,7 @@ build/frida-macos-universal/lib/frida-gadget.dylib: build/.core-macos-stamp-frid cp build/frida-macos-x86_64/lib/frida-gadget.dylib $(@D)/frida-gadget-x86_64.dylib . build/frida-meson-env-macos-$(build_arch).rc \ && $$LIPO $(@D)/frida-gadget-x86.dylib $(@D)/frida-gadget-x86_64.dylib -create -output $@.tmp \ - && $$CODESIGN -f -s "$$MAC_CERTID" $@.tmp + && $$CODESIGN -f -s "$$MACOS_CERTID" $@.tmp rm $(@D)/frida-gadget-*.dylib mv $@.tmp $@ build/frida-ios-universal/lib/frida-gadget.dylib: build/.core-ios-stamp-frida-ios-x86 build/.core-ios-stamp-frida-ios-x86_64 build/.core-ios-stamp-frida-ios-arm build/.core-ios-stamp-frida-ios-arm64 build/.core-ios-stamp-frida-ios-arm64e @@ -440,7 +440,7 @@ python-macos-thin: build/tmp_thin-macos-x86_64/frida-$(PYTHON_NAME)/.frida-stamp define make-python-rule build/$2-%/frida-$$(PYTHON_NAME)/.frida-stamp: build/.frida-python-submodule-stamp build/$1-%/lib/pkgconfig/frida-core-1.0.pc - . build/$1-meson-env-macos-$$(build_arch).rc; \ + . build/$1-meson-env-$$*.rc; \ builddir=$$(@D); \ if [ ! -f $$$$builddir/build.ninja ]; then \ mkdir -p $$$$builddir; \ @@ -531,7 +531,7 @@ tools-macos-thin: build/tmp_thin-macos-x86_64/frida-tools-$(PYTHON_NAME)/.frida- define make-tools-rule build/$2-%/frida-tools-$$(PYTHON_NAME)/.frida-stamp: build/.frida-tools-submodule-stamp build/$2-%/frida-$$(PYTHON_NAME)/.frida-stamp - . build/$1-meson-env-macos-$$(build_arch).rc; \ + . build/$1-meson-env-$$*.rc; \ builddir=$$(@D); \ if [ ! -f $$$$builddir/build.ninja ]; then \ mkdir -p $$$$builddir; \ diff --git a/Makefile.sdk.mk b/Makefile.sdk.mk index 1c30d6b29a..61b30999d9 100644 --- a/Makefile.sdk.mk +++ b/Makefile.sdk.mk @@ -5,11 +5,11 @@ MAKE_J ?= -j 8 repo_base_url = https://github.com/frida repo_suffix := .git -libiconv_version := 1.15 -elfutils_version := 1b1433d5670b75c4bd5c9b598e0b00fba6e82d90 -libdwarf_version := 20190110 -openssl_version := 1.1.1b -v8_api_version := 7.0 +libiconv_version := 1.16 +elfutils_version := elfutils-0.179 +libdwarf_version := 20200114 +openssl_version := 1.1.1f +v8_api_version := 8.0 gnu_mirror := saimei.ftp.acc.umu.se/mirror/gnu.org/gnu @@ -19,7 +19,7 @@ build_arch := $(shell releng/detect-arch.sh) build_platform_arch := $(build_platform)-$(build_arch) ifneq ($(shell which curl),) - download := curl -sS + download := curl -sSL else download := wget -O - -q endif @@ -65,7 +65,7 @@ ifeq ($(host_platform), qnx) dwarf := build/fs-%/lib/libdwarf.a endif ifeq ($(host_platform),$(filter $(host_platform),macos ios linux android)) - glib_tls_provider := build/fs-%/lib/pkgconfig/glib-openssl-static.pc + glib_tls_provider := build/fs-%/lib/pkgconfig/gioopenssl.pc endif ifeq ($(enable_v8), 1) v8 := build/fs-%/lib/pkgconfig/v8-$(v8_api_version).pc @@ -138,8 +138,7 @@ build/.libiconv-stamp: $(RM) -r libiconv mkdir libiconv cd libiconv \ - && $(download) https://$(gnu_mirror)/libiconv/libiconv-$(libiconv_version).tar.gz | tar -xz --strip-components 1 \ - && patch -p1 < ../releng/patches/libiconv-android.patch + && $(download) https://$(gnu_mirror)/libiconv/libiconv-$(libiconv_version).tar.gz | tar -xz --strip-components 1 @mkdir -p $(@D) @touch $@ @@ -148,11 +147,7 @@ build/fs-tmp-%/libiconv/Makefile: build/fs-env-%.rc build/.libiconv-stamp mkdir -p $(@D) . $< \ && cd $(@D) \ - && ../../../libiconv/configure \ - --enable-static \ - --disable-shared \ - --enable-relocatable \ - --disable-rpath + && ../../../libiconv/configure build/fs-%/lib/libiconv.a: build/fs-env-%.rc build/fs-tmp-%/libiconv/Makefile . $< \ @@ -167,7 +162,7 @@ build/.elfutils-stamp: build/fs-env-$(build_platform_arch).rc git clone git://sourceware.org/git/elfutils.git . $< \ && cd elfutils \ - && git checkout $(elfutils_version) \ + && git checkout -b release $(elfutils_version) \ && patch -p1 < ../releng/patches/elfutils-clang.patch \ && patch -p1 < ../releng/patches/elfutils-android.patch \ && autoreconf -ifv @@ -253,7 +248,7 @@ build/.$1-stamp: build/fs-tmp-%/$1/build.ninja: build/fs-env-$(build_platform_arch).rc build/fs-env-%.rc build/.$1-stamp $3 releng/meson/meson.py $(RM) -r $$(@D) - (. build/fs-meson-env-$(build_platform_arch).rc \ + (. build/fs-meson-env-$$*.rc \ && . build/fs-config-$$*.site \ && if [ $$* = $(build_platform_arch) ]; then \ cross_args=""; \ @@ -264,7 +259,7 @@ build/fs-tmp-%/$1/build.ninja: build/fs-env-$(build_platform_arch).rc build/fs-e --prefix $$$$frida_prefix \ --libdir $$$$frida_prefix/lib \ --default-library static \ - $$(FRIDA_SDK_FLAGS) \ + $$(FRIDA_MESONFLAGS_BOTTLE) \ $$$$cross_args \ $4 \ $$(@D) \ @@ -286,19 +281,19 @@ $(eval $(call make-git-autotools-module-rules,libunwind,build/fs-%/lib/pkgconfig $(eval $(call make-git-meson-module-rules,libffi,build/fs-%/lib/pkgconfig/libffi.pc,,)) -$(eval $(call make-git-meson-module-rules,glib,build/fs-%/lib/pkgconfig/glib-2.0.pc,$(iconv) build/fs-%/lib/pkgconfig/zlib.pc build/fs-%/lib/pkgconfig/libffi.pc,$(glib_iconv_option) -Dselinux=disabled -Dxattr=false -Dlibmount=false -Dinternal_pcre=true -Dtests=false)) +$(eval $(call make-git-meson-module-rules,glib,build/fs-%/lib/pkgconfig/glib-2.0.pc,$(iconv) build/fs-%/lib/pkgconfig/zlib.pc build/fs-%/lib/pkgconfig/libffi.pc,$(glib_iconv_option) -Dselinux=disabled -Dxattr=false -Dlibmount=disabled -Dinternal_pcre=true -Dtests=false)) -$(eval $(call make-git-meson-module-rules,glib-openssl,build/fs-%/lib/pkgconfig/glib-openssl-static.pc,build/fs-%/lib/pkgconfig/glib-2.0.pc build/fs-%/lib/pkgconfig/openssl.pc,-Dca_certificates=no)) +$(eval $(call make-git-meson-module-rules,glib-networking,build/fs-%/lib/pkgconfig/gioopenssl.pc,build/fs-%/lib/pkgconfig/glib-2.0.pc build/fs-%/lib/pkgconfig/openssl.pc,-Dgnutls=disabled -Dopenssl=enabled -Dlibproxy=disabled -Dgnome_proxy=disabled -Dstatic_modules=true)) $(eval $(call make-git-meson-module-rules,libgee,build/fs-%/lib/pkgconfig/gee-0.8.pc,build/fs-%/lib/pkgconfig/glib-2.0.pc)) -$(eval $(call make-git-meson-module-rules,json-glib,build/fs-%/lib/pkgconfig/json-glib-1.0.pc,build/fs-%/lib/pkgconfig/glib-2.0.pc,-Dintrospection=false -Dtests=false)) +$(eval $(call make-git-meson-module-rules,json-glib,build/fs-%/lib/pkgconfig/json-glib-1.0.pc,build/fs-%/lib/pkgconfig/glib-2.0.pc,-Dintrospection=disabled -Dtests=false)) -$(eval $(call make-git-meson-module-rules,libpsl,build/fs-%/lib/pkgconfig/libpsl.pc,,)) +$(eval $(call make-git-meson-module-rules,libpsl,build/fs-%/lib/pkgconfig/libpsl.pc,,-Dtests=false)) $(eval $(call make-git-meson-module-rules,libxml2,build/fs-%/lib/pkgconfig/libxml-2.0.pc,build/fs-%/lib/pkgconfig/zlib.pc build/fs-%/lib/pkgconfig/liblzma.pc,)) -$(eval $(call make-git-meson-module-rules,libsoup,build/fs-%/lib/pkgconfig/libsoup-2.4.pc,build/fs-%/lib/pkgconfig/glib-2.0.pc build/fs-%/lib/pkgconfig/sqlite3.pc build/fs-%/lib/pkgconfig/libpsl.pc build/fs-%/lib/pkgconfig/libxml-2.0.pc,-Dgssapi=false -Dtls_check=false -Dgnome=false -Dintrospection=false -Dvapi=false -Dtests=false)) +$(eval $(call make-git-meson-module-rules,libsoup,build/fs-%/lib/pkgconfig/libsoup-2.4.pc,build/fs-%/lib/pkgconfig/glib-2.0.pc build/fs-%/lib/pkgconfig/sqlite3.pc build/fs-%/lib/pkgconfig/libpsl.pc build/fs-%/lib/pkgconfig/libxml-2.0.pc,-Dgssapi=disabled -Dtls_check=false -Dgnome=false -Dintrospection=disabled -Dvapi=disabled -Dtests=false)) ifeq ($(FRIDA_ASAN), yes) @@ -393,7 +388,7 @@ ifeq ($(host_arch), x86_64) ndk_triplet := x86_64-linux-android endif ifeq ($(host_arch), arm) - openssl_arch_args := android-arm -D__ANDROID_API__=18 -D__ARM_MAX_ARCH__=7 + openssl_arch_args := android-arm -D__ANDROID_API__=18 -D__ARM_MAX_ARCH__=7 -fno-integrated-as ndk_abi := arm-linux-androideabi ndk_triplet := arm-linux-androideabi endif @@ -460,6 +455,7 @@ v8_common_args := \ v8_enable_i18n_support=false \ v8_untrusted_code_mitigations=false \ treat_warnings_as_errors=false \ + fatal_linker_warnings=false \ use_glib=false \ use_goma=false \ v8_embedder_string="-frida" \ @@ -481,13 +477,6 @@ v8_buildtype_args := \ $(NULL) endif -ifeq ($(host_platform_arch), android-x86_64) -v8_arch_args := v8_enable_embedded_builtins=false -endif -ifneq ($(host_arch), x86_64) -v8_arch_args := v8_enable_embedded_builtins=false -endif - ifeq ($(host_arch), x86) v8_cpu := x86 endif @@ -496,19 +485,19 @@ ifeq ($(host_arch), x86_64) endif ifeq ($(host_arch), arm) v8_cpu := arm - v8_cpu_args := arm_version=7 arm_fpu="vfpv3-d16" arm_float_abi="softfp" + v8_cpu_args := arm_version=7 arm_fpu="vfpv3-d16" arm_float_abi="softfp" arm_use_neon=false endif ifeq ($(host_arch), armbe8) v8_cpu := arm - v8_cpu_args := arm_version=7 arm_fpu="vfpv3-d16" arm_float_abi="softfp" + v8_cpu_args := arm_version=7 arm_fpu="vfpv3-d16" arm_float_abi="softfp" arm_use_neon=false endif ifeq ($(host_arch), armeabi) v8_cpu := arm - v8_cpu_args := arm_version=7 arm_fpu="vfpv3-d16" arm_float_abi="softfp" + v8_cpu_args := arm_version=7 arm_fpu="vfpv3-d16" arm_float_abi="softfp" arm_use_neon=false endif ifeq ($(host_arch), armhf) v8_cpu := arm - v8_cpu_args := arm_version=7 arm_fpu="vfpv3-d16" arm_float_abi="hard" + v8_cpu_args := arm_version=7 arm_fpu="vfpv3-d16" arm_float_abi="hard" arm_use_neon=false endif ifeq ($(host_arch), arm64) v8_cpu := arm64 @@ -561,14 +550,21 @@ ifeq ($(host_platform), android) use_xcode_clang=true \ use_custom_libcxx=false \ android_ndk_root="$(ANDROID_NDK_ROOT)" \ - android_ndk_version="r20" \ - android_ndk_major_version=20 \ + android_ndk_version="r21" \ + android_ndk_major_version=21 \ android32_ndk_api_level=18 \ android64_ndk_api_level=21 \ clang_base_path="$(abspath $(ANDROID_NDK_ROOT)/toolchains/llvm/prebuilt/$(ndk_build_platform_arch))" v8_libs_private := "-llog -lm" endif +ifneq ($(MACOS_SDK_ROOT),) + v8_platform_args += mac_sdk_path="$(MACOS_SDK_ROOT)" +endif +ifneq ($(IOS_SDK_ROOT),) + v8_platform_args += ios_sdk_path="$(IOS_SDK_ROOT)" +endif + gn: # Google's prebuilt GN requires a newer glibc than our Debian Squeeze buildroot has. git clone $(repo_base_url)/gn$(repo_suffix) @@ -576,7 +572,6 @@ gn: build/fs-tmp-%/gn/build.ninja: build/fs-env-%.rc gn . $< \ && CC="$$CC" CXX="$$CXX" python gn/build/gen.py \ - --no-sysroot \ --out-path $(abspath $(@D)) build/fs-tmp-%/gn/gn: build/fs-tmp-%/gn/build.ninja @@ -588,7 +583,7 @@ v8-checkout/depot_tools/gclient: git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git v8-checkout/depot_tools v8-checkout/.gclient: v8-checkout/depot_tools/gclient - cd v8-checkout && depot_tools/gclient config --spec 'solutions = [ \ + cd v8-checkout && PATH=$(abspath v8-checkout/depot_tools):$$PATH depot_tools/gclient config --spec 'solutions = [ \ { \ "url": "$(repo_base_url)/v8.git", \ "managed": False, \ @@ -596,20 +591,17 @@ v8-checkout/.gclient: v8-checkout/depot_tools/gclient "deps_file": "DEPS", \ "custom_deps": {}, \ }, \ -] \ -' +]' v8-checkout/v8: v8-checkout/.gclient - cd v8-checkout \ - && export PATH=$(abspath v8-checkout/depot_tools):$$PATH \ - && gclient sync + cd v8-checkout && PATH=$(abspath v8-checkout/depot_tools):$$PATH gclient sync @touch $@ build/fs-tmp-%/v8/build.ninja: v8-checkout/v8 build/fs-tmp-$(build_platform_arch)/gn/gn cd v8-checkout/v8 \ && ../../build/fs-tmp-$(build_platform_arch)/gn/gn \ gen $(abspath $(@D)) \ - --args='target_os="$(v8_os)" target_cpu="$(v8_cpu)" $(v8_cpu_args) $(v8_common_args) $(v8_buildtype_args) $(v8_arch_args) $(v8_platform_args)' + --args='target_os="$(v8_os)" target_cpu="$(v8_cpu)" $(v8_cpu_args) $(v8_common_args) $(v8_buildtype_args) $(v8_platform_args)' build/fs-tmp-%/v8/obj/libv8_monolith.a: build/fs-tmp-%/v8/build.ninja $(NINJA) -C build/fs-tmp-$*/v8 v8_monolith @@ -625,13 +617,18 @@ build/fs-%/lib/pkgconfig/v8-$(v8_api_version).pc: build/fs-tmp-%/v8/obj/libv8_mo install -d build/fs-$*/lib install -m 644 $< build/fs-$*/lib/libv8-$(v8_api_version).a install -d $(@D) + $(PYTHON3) releng/v8.py \ + patch build/fs-$*/include/v8-$(v8_api_version)/v8/v8config.h \ + -s v8-checkout/v8 \ + -b build/fs-tmp-$*/v8 \ + -G v8-checkout/depot_tools/gn echo "prefix=\$${frida_sdk_prefix}" > $@.tmp echo "libdir=\$${prefix}/lib" >> $@.tmp echo "includedir=\$${prefix}/include/v8-$(v8_api_version)" >> $@.tmp echo "" >> $@.tmp echo "Name: V8" >> $@.tmp echo "Description: V8 JavaScript Engine" >> $@.tmp - echo "Version: $$(python releng/v8.py v8-checkout/v8 version)" >> $@.tmp + echo "Version: $$($(PYTHON3) releng/v8.py get version -s v8-checkout/v8)" >> $@.tmp echo "Libs: -L\$${libdir} -lv8-$(v8_api_version)" >> $@.tmp ifdef v8_libs_private echo Libs.private: $(v8_libs_private) >> $@.tmp @@ -649,7 +646,6 @@ build/fs-%/lib/c++/libc++.a: build/fs-tmp-%/v8/obj/libv8_monolith.a echo "#ifndef _LIBCPP_CONFIG_SITE"; \ echo "#define _LIBCPP_CONFIG_SITE"; \ echo ""; \ - echo "#define _LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS"; \ echo "#define _LIBCPP_HAS_NO_ALIGNED_ALLOCATION"; \ echo "#define _LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS"; \ echo "#define _LIBCPP_ENABLE_NODISCARD"; \ @@ -671,8 +667,8 @@ build/fs-%/lib/c++/libc++.a: build/fs-tmp-%/v8/obj/libv8_monolith.a build/fs-env-%.rc: FRIDA_HOST=$* \ - FRIDA_OPTIMIZATION_FLAGS="$(FRIDA_SDK_OPTIMIZATION_FLAGS)" \ - FRIDA_DEBUG_FLAGS="$(FRIDA_SDK_DEBUG_FLAGS)" \ + FRIDA_ACOPTFLAGS="$(FRIDA_ACOPTFLAGS_BOTTLE)" \ + FRIDA_ACDBGFLAGS="$(FRIDA_ACDBGFLAGS_BOTTLE)" \ FRIDA_ASAN=$(FRIDA_ASAN) \ FRIDA_ENV_NAME=fs \ FRIDA_ENV_SDK=none \ diff --git a/Makefile.toolchain.mk b/Makefile.toolchain.mk index 5ebcd37c32..0557f09d3d 100644 --- a/Makefile.toolchain.mk +++ b/Makefile.toolchain.mk @@ -6,10 +6,12 @@ repo_suffix = ".git" m4_version := 1.4.18 autoconf_version := 2.69 -automake_version := 1.16.1 +automake_version := 1.16.2 automake_api_version := 1.16 libtool_version := 2.4.6 -gettext_version := 0.19.8.1 +gettext_version := 0.20.1 +flex_version := 2.6.4 +bison_version := 3.5.4 gnu_mirror := saimei.ftp.acc.umu.se/mirror/gnu.org/gnu @@ -19,7 +21,7 @@ build_arch := $(shell releng/detect-arch.sh) build_platform_arch := $(build_platform)-$(build_arch) ifneq ($(shell which curl),) - download := curl -sS + download := curl -sSL else download := wget -O - -q endif @@ -109,12 +111,16 @@ build/ft-tmp-%/.package-stamp: \ mkdir -p $(@D)/package cd build/ft-$* \ && tar -c \ + --exclude bin/bison \ + --exclude bin/flex \ + --exclude bin/flex++ \ --exclude bin/gapplication \ --exclude bin/gdbus \ --exclude bin/gio \ --exclude bin/gio-launch-desktop \ --exclude bin/gobject-query \ --exclude bin/gsettings \ + --exclude bin/yacc \ --exclude etc \ --exclude include \ --exclude lib/charset.alias \ @@ -122,7 +128,7 @@ build/ft-tmp-%/.package-stamp: \ --exclude lib/glib-2.0 \ --exclude lib/gio \ --exclude lib/pkgconfig \ - --exclude "lib/vala-0.46/*.a" \ + --exclude "lib/vala-0.50/*.a" \ --exclude share/bash-completion \ --exclude share/devhelp \ --exclude share/doc \ @@ -145,7 +151,7 @@ build/ft-tmp-%/.package-stamp: \ && for f in $(@D)/package/bin/*; do \ if [ -L $$f ]; then \ true; \ - elif file -b --mime-type $$f | egrep -q "^application"; then \ + elif file -b --mime $$f | egrep -q "executable|binary"; then \ $$STRIP $(strip_all) $$f || exit 1; \ else \ if [ $(build_platform) = macos ]; then \ @@ -154,7 +160,8 @@ build/ft-tmp-%/.package-stamp: \ sed -i"" -e "s_^#!.*python.*_#!/usr/bin/env python3_gi" $$f || exit 1; \ fi; \ fi; \ - done + done \ + && $$STRIP $(strip_all) $(@D)/package/lib/vala-*/gen-introspect-* releng/relocatify.sh $(@D)/package $(abspath build/ft-$*) $(abspath releng) @touch $@ @@ -176,7 +183,9 @@ build/.$1-stamp: build/ft-tmp-%/$1/Makefile: build/ft-env-%.rc build/.$1-stamp $4 $(RM) -r $$(@D) mkdir -p $$(@D) - . $$< && cd $$(@D) && PATH=$$(shell pwd)/build/ft-$$*/bin:$$$$PATH ../../../$1/configure + . $$< \ + && cd $$(@D) \ + && PATH=$$(shell pwd)/build/ft-$$*/bin:$$$$PATH ../../../$1/configure $3: build/ft-env-%.rc build/ft-tmp-%/$1/Makefile . $$< \ @@ -196,18 +205,18 @@ build/.$1-stamp: build/ft-tmp-%/$1/build.ninja: build/ft-env-$(build_platform_arch).rc build/ft-env-%.rc build/.$1-stamp $3 releng/meson/meson.py $(RM) -r $$(@D) - (. build/ft-meson-env-$(build_platform_arch).rc \ + (. build/ft-meson-env-$$*.rc \ && . build/ft-config-$$*.site \ && if [ $$* = $(build_platform_arch) ]; then \ cross_args=""; \ else \ cross_args="--cross-file build/ft-$$*.txt"; \ fi \ - && $(MESON) \ + && PATH=$$(shell pwd)/build/ft-$$*/bin:$$$$PATH $(MESON) \ --prefix $$$$frida_prefix \ --libdir $$$$frida_prefix/lib \ --default-library static \ - --buildtype minsize \ + $$(FRIDA_MESONFLAGS_BOTTLE) \ $$$$cross_args \ $4 \ $$(@D) \ @@ -252,17 +261,21 @@ build/ft-%/bin/libtool: build/ft-env-%.rc build/ft-tmp-%/libtool/Makefile && make $(MAKE_J) install @touch $@ -$(eval $(call make-tarball-module-rules,gettext,https://$(gnu_mirror)/gettext/gettext-$(gettext_version).tar.gz,build/ft-%/bin/autopoint,build/ft-%/bin/libtool,gettext-vasnprintf-apple-fix.patch)) +$(eval $(call make-tarball-module-rules,gettext,https://$(gnu_mirror)/gettext/gettext-$(gettext_version).tar.gz,build/ft-%/bin/autopoint,build/ft-%/bin/libtool,gettext-static-only.patch)) $(eval $(call make-git-meson-module-rules,zlib,build/ft-%/lib/pkgconfig/zlib.pc,)) $(eval $(call make-git-meson-module-rules,libffi,build/ft-%/lib/pkgconfig/libffi.pc,,)) -$(eval $(call make-git-meson-module-rules,glib,build/ft-%/bin/glib-genmarshal,build/ft-%/lib/pkgconfig/zlib.pc build/ft-%/lib/pkgconfig/libffi.pc,$(glib_iconv_option) -Dselinux=disabled -Dxattr=false -Dlibmount=false -Dinternal_pcre=true -Dtests=false)) +$(eval $(call make-git-meson-module-rules,glib,build/ft-%/bin/glib-genmarshal,build/ft-%/lib/pkgconfig/zlib.pc build/ft-%/lib/pkgconfig/libffi.pc,$(glib_iconv_option) -Dselinux=disabled -Dxattr=false -Dlibmount=disabled -Dinternal_pcre=true -Dtests=false)) $(eval $(call make-git-meson-module-rules,pkg-config,build/ft-%/bin/pkg-config,build/ft-%/bin/glib-genmarshal,)) -$(eval $(call make-git-meson-module-rules,vala,build/ft-%/bin/valac,build/ft-%/bin/glib-genmarshal,)) +$(eval $(call make-tarball-module-rules,flex,https://github.com/westes/flex/releases/download/v$(flex_version)/flex-$(flex_version).tar.gz,build/ft-%/bin/flex,)) + +$(eval $(call make-tarball-module-rules,bison,https://$(gnu_mirror)/bison/bison-$(bison_version).tar.gz,build/ft-%/bin/bison,)) + +$(eval $(call make-git-meson-module-rules,vala,build/ft-%/bin/valac,build/ft-%/bin/glib-genmarshal build/ft-%/bin/flex build/ft-%/bin/bison,)) build/ft-%/bin/dpkg-deb: @mkdir -p $(@D) @@ -274,8 +287,8 @@ build/ft-%/bin/dpkg-deb: build/ft-env-%.rc: build/ft-executable.symbols build/ft-executable.version FRIDA_HOST=$* \ - FRIDA_OPTIMIZATION_FLAGS="$(FRIDA_OPTIMIZATION_FLAGS)" \ - FRIDA_DEBUG_FLAGS="$(FRIDA_DEBUG_FLAGS)" \ + FRIDA_ACOPTFLAGS="$(FRIDA_ACOPTFLAGS_BOTTLE)" \ + FRIDA_ACDBGFLAGS="$(FRIDA_ACDBGFLAGS_BOTTLE)" \ FRIDA_EXTRA_LDFLAGS="$(export_ldflags)" \ FRIDA_ASAN=$(FRIDA_ASAN) \ FRIDA_ENV_NAME=ft \ diff --git a/README.md b/README.md index 96d6b919a4..d3e608b271 100644 --- a/README.md +++ b/README.md @@ -40,9 +40,9 @@ for code signing". You can use the name `frida-cert` instead of `gdb-cert` if you'd like. Next export the name of the created certificate to the environment variables -`MAC_CERTID` and `IOS_CERTID`, and run `make`: +`MACOS_CERTID` and `IOS_CERTID`, and run `make`: - export MAC_CERTID=frida-cert + export MACOS_CERTID=frida-cert export IOS_CERTID=frida-cert make @@ -55,7 +55,7 @@ To ensure that macOS accepts the newly created certificate, restart the frida.sln -(Requires Visual Studio 2017.) +(Requires Visual Studio 2019.) See [https://www.frida.re/docs/building/](https://www.frida.re/docs/building/) for details. diff --git a/capstone b/capstone index bf43c3761d..4ccc55cae4 160000 --- a/capstone +++ b/capstone @@ -1 +1 @@ -Subproject commit bf43c3761dca98b66c35b63dd72de82d86fde489 +Subproject commit 4ccc55cae4a532abfd3658c9cd5a7c92c59a7e83 diff --git a/config.mk b/config.mk index 4ca36c78aa..5f921386aa 100644 --- a/config.mk +++ b/config.mk @@ -6,22 +6,21 @@ FRIDA := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST)))) FRIDA_ASAN ?= no ifeq ($(FRIDA_ASAN), yes) -FRIDA_COMMON_FLAGS := --buildtype debugoptimized -Db_sanitize=address -FRIDA_SDK_FLAGS := --buildtype debugoptimized -Db_sanitize=address -FRIDA_OPTIMIZATION_FLAGS ?= -O1 -FRIDA_SDK_OPTIMIZATION_FLAGS ?= -O1 +FRIDA_MESONFLAGS_COMMON := -Doptimization=1 -Ddebug=true -Db_sanitize=address +FRIDA_MESONFLAGS_BOTTLE := -Doptimization=1 -Ddebug=true -Db_sanitize=address +FRIDA_ACOPTFLAGS_COMMON ?= -O1 +FRIDA_ACOPTFLAGS_BOTTLE ?= -O1 else -FRIDA_COMMON_FLAGS := --buildtype minsize --strip -FRIDA_SDK_FLAGS := --buildtype minsize -FRIDA_OPTIMIZATION_FLAGS ?= -Os -FRIDA_SDK_OPTIMIZATION_FLAGS ?= -Os +FRIDA_MESONFLAGS_COMMON := -Doptimization=s -Ddebug=false --strip +FRIDA_MESONFLAGS_BOTTLE := -Doptimization=s -Ddebug=false +FRIDA_ACOPTFLAGS_COMMON ?= -Os +FRIDA_ACOPTFLAGS_BOTTLE ?= -Os endif +FRIDA_ACDBGFLAGS_COMMON ?= -g3 +FRIDA_ACDBGFLAGS_BOTTLE ?= -g1 FRIDA_MAPPER_FLAGS := -Dmapper=auto -FRIDA_DEBUG_FLAGS ?= -g3 -FRIDA_SDK_DEBUG_FLAGS ?= -g1 - PYTHON ?= $(shell which python) PYTHON_VERSION := $(shell $(PYTHON) -c 'import sys; v = sys.version_info; print("{0}.{1}".format(v[0], v[1]))') PYTHON_NAME ?= python$(PYTHON_VERSION) diff --git a/frida-core b/frida-core index 3209d34ac1..0b3a3a9d87 160000 --- a/frida-core +++ b/frida-core @@ -1 +1 @@ -Subproject commit 3209d34ac1fad7e380cf3c314768678bdb005d3c +Subproject commit 0b3a3a9d879b92dc29c7edd114cc93968de3a6dc diff --git a/frida-gum b/frida-gum index c5c9822e63..84e59ad21a 160000 --- a/frida-gum +++ b/frida-gum @@ -1 +1 @@ -Subproject commit c5c9822e637ff25195afd25a93c1b496ea4a5876 +Subproject commit 84e59ad21ad0371623b44f78c3f00a29b2523100 diff --git a/frida-python b/frida-python index 0dbf400ab5..c463dd1dfe 160000 --- a/frida-python +++ b/frida-python @@ -1 +1 @@ -Subproject commit 0dbf400ab54929068c07195cc188473d6683ef45 +Subproject commit c463dd1dfe29e35c4bdfc8a891abba0bf0a4fa10 diff --git a/frida.sln b/frida.sln index a4f622c6af..709b8ac9ba 100644 --- a/frida.sln +++ b/frida.sln @@ -61,7 +61,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "frida-clr", "frida-clr\frid EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "frida-python27", "frida-python\frida-python27.vcxproj", "{7409F45B-E10E-48AA-9E68-94C113995D4A}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "frida-python37", "frida-python\frida-python37.vcxproj", "{7505F884-DD69-4F23-ADE6-1E0E049AB018}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "frida-python38", "frida-python\frida-python38.vcxproj", "{7505F884-DD69-4F23-ADE6-1E0E049AB018}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "frida-pipe-32", "frida-core\lib\pipe\frida-pipe-32.vcxproj", "{4C39C3CF-13E5-4346-B6AE-F73013105936}" EndProject diff --git a/releng/build-deps-windows.py b/releng/build-deps-windows.py index a1e8b4e5a6..50addd230d 100644 --- a/releng/build-deps-windows.py +++ b/releng/build-deps-windows.py @@ -1,6 +1,5 @@ #!/usr/bin/env python3 -import codecs import glob import os import platform @@ -22,15 +21,15 @@ COMPRESSION_LEVEL = 9 FRIDA_BASE_URL = "https://github.com/frida" -BOOTSTRAP_TOOLCHAIN_URL = "https://build.frida.re/toolchain-20190428-windows-x86.exe" -VALA_VERSION = "0.46" -VALA_TARGET_GLIB = "2.62" +BOOTSTRAP_TOOLCHAIN_URL = "https://build.frida.re/toolchain-20200407-windows-x86.exe" +VALA_VERSION = "0.50" +VALA_TARGET_GLIB = "2.66" RELENG_DIR = os.path.abspath(os.path.dirname(__file__)) ROOT_DIR = os.path.dirname(RELENG_DIR) BOOTSTRAP_TOOLCHAIN_DIR = os.path.join(ROOT_DIR, "build", "fts-toolchain-windows") -BOOTSTRAP_VALAC = "valac-0.46.exe" +BOOTSTRAP_VALAC = "valac-0.50.exe" MESON = os.path.join(RELENG_DIR, "meson", "meson.py") NINJA = os.path.join(BOOTSTRAP_TOOLCHAIN_DIR, "bin", "ninja.exe") @@ -105,12 +104,12 @@ def build_meson_modules(platform, configuration): ("libffi", "libffi.pc", []), ("sqlite", "sqlite3.pc", []), ("glib", "glib-2.0.pc", ["internal_pcre=true", "tests=false"]), - ("glib-schannel", "glib-schannel-static.pc", []), + ("glib-schannel", "gioschannel.pc", []), ("libgee", "gee-0.8.pc", []), - ("json-glib", "json-glib-1.0.pc", ["introspection=false", "tests=false"]), - ("libpsl", "libpsl.pc", []), + ("json-glib", "json-glib-1.0.pc", ["introspection=disabled", "tests=false"]), + ("libpsl", "libpsl.pc", ["tests=false"]), ("libxml2", "libxml-2.0.pc", []), - ("libsoup", "libsoup-2.4.pc", ["gssapi=false", "tls_check=false", "gnome=false", "introspection=false", "vapi=false", "tests=false"]), + ("libsoup", "libsoup-2.4.pc", ["gssapi=disabled", "tls_check=false", "gnome=false", "introspection=disabled", "vapi=disabled", "tests=false"]), ("vala", VALAC_FILENAME, []), ("pkg-config", "pkg-config.exe", []), ] @@ -122,7 +121,7 @@ def build_meson_modules(platform, configuration): artifact_subpath = os.path.join("bin", artifact_name) runtime_flavors = TOOL_TARGET_RUNTIMES else: - raise NotImplementedError("Unsupported artifact type") + raise NotImplementedError("unsupported artifact type") for runtime in runtime_flavors: artifact_path = os.path.join(get_prefix_path(platform, configuration, runtime), artifact_subpath) if not os.path.exists(artifact_path): @@ -134,8 +133,9 @@ def build_meson_module(name, platform, configuration, runtime, options): source_dir = os.path.join(ROOT_DIR, name) build_dir = os.path.join(env_dir, name) - build_type = 'minsize' if configuration == 'Release' else 'debug' prefix = get_prefix_path(platform, configuration, runtime) + optimization = 's' if configuration == 'Release' else '0' + debug = 'false' if configuration == 'Release' else 'true' option_flags = ["-D" + option for option in options] if not os.path.exists(source_dir): @@ -147,10 +147,11 @@ def build_meson_module(name, platform, configuration, runtime, options): perform( "py", "-3", MESON, build_dir, - "--buildtype", build_type, "--prefix", prefix, "--default-library", "static", "--backend", "ninja", + "-Doptimization=" + optimization, + "-Ddebug=" + debug, "-Db_vscrt=" + vscrt_from_configuration_and_runtime(configuration, runtime), *option_flags, cwd=source_dir, @@ -250,7 +251,7 @@ def generate_meson_env(platform, configuration, runtime): ]) env_path = os.path.join(env_dir, "env.bat") - with codecs.open(env_path, "w", 'utf-8') as f: + with open(env_path, "w", encoding='utf-8') as f: f.write("""@ECHO OFF set PATH={exe_path};%PATH% set INCLUDE={include_path} @@ -278,7 +279,7 @@ def generate_meson_env(platform, configuration, runtime): rc_path = os.path.join(winxp_bin_dir, "rc.exe") rc_wrapper_path = os.path.join(env_dir, "rc.bat") - with codecs.open(rc_wrapper_path, "w", 'utf-8') as f: + with open(rc_wrapper_path, "w", encoding='utf-8') as f: f.write("""@ECHO OFF SETLOCAL EnableExtensions SET _res=0 @@ -286,7 +287,7 @@ def generate_meson_env(platform, configuration, runtime): ENDLOCAL & SET _res=%_res% EXIT /B %_res%""".format(rc_path=rc_path, flags=clflags)) - with codecs.open(os.path.join(env_dir, "meson.bat"), "w", 'utf-8') as f: + with open(os.path.join(env_dir, "meson.bat"), "w", encoding='utf-8') as f: f.write("""@ECHO OFF SETLOCAL EnableExtensions SET _res=0 @@ -297,7 +298,7 @@ def generate_meson_env(platform, configuration, runtime): pkgconfig_path = os.path.join(BOOTSTRAP_TOOLCHAIN_DIR, "bin", "pkg-config.exe") pkgconfig_lib_dir = os.path.join(prefix, "lib", "pkgconfig") pkgconfig_wrapper_path = os.path.join(env_dir, "pkg-config.bat") - with codecs.open(pkgconfig_wrapper_path, "w", 'utf-8') as f: + with open(pkgconfig_wrapper_path, "w", encoding='utf-8') as f: f.write("""@ECHO OFF SETLOCAL EnableExtensions SET _res=0 @@ -308,14 +309,14 @@ def generate_meson_env(platform, configuration, runtime): flex_path = os.path.join(BOOTSTRAP_TOOLCHAIN_DIR, "bin", "flex.exe") flex_wrapper_path = os.path.join(env_dir, "flex.py") - with codecs.open(os.path.join(env_dir, "flex.bat"), "w", 'utf-8') as f: + with open(os.path.join(env_dir, "flex.bat"), "w", encoding='utf-8') as f: f.write("""@ECHO OFF SETLOCAL EnableExtensions SET _res=0 py -3 "{wrapper_path}" %* || SET _res=1 ENDLOCAL & SET _res=%_res% EXIT /B %_res%""".format(wrapper_path=flex_wrapper_path)) - with codecs.open(flex_wrapper_path, "w", 'utf-8') as f: + with open(flex_wrapper_path, "w", encoding='utf-8') as f: f.write("""import subprocess import sys @@ -325,14 +326,14 @@ def generate_meson_env(platform, configuration, runtime): bison_path = os.path.join(BOOTSTRAP_TOOLCHAIN_DIR, "bin", "bison.exe") bison_wrapper_path = os.path.join(env_dir, "bison.py") - with codecs.open(os.path.join(env_dir, "bison.bat"), "w", 'utf-8') as f: + with open(os.path.join(env_dir, "bison.bat"), "w", encoding='utf-8') as f: f.write("""@ECHO OFF SETLOCAL EnableExtensions SET _res=0 py -3 "{wrapper_path}" %* || SET _res=1 ENDLOCAL & SET _res=%_res% EXIT /B %_res%""".format(wrapper_path=bison_wrapper_path)) - with codecs.open(bison_wrapper_path, "w", 'utf-8') as f: + with open(bison_wrapper_path, "w", encoding='utf-8') as f: f.write("""\ import os import subprocess @@ -460,13 +461,15 @@ def build_v8(platform, configuration, runtime): header_files = [os.path.relpath(path, header_dir) for path in glob.glob(os.path.join(header_dir, "**", "*.h"), recursive=True)] copy_files(header_dir, header_files, include_dir) + v8.patch_config_header(os.path.join(include_dir, "v8config.h"), source_dir, build_dir, gn, env) + if not os.path.exists(pkgconfig_dir): os.makedirs(pkgconfig_dir) libv8_path = os.path.join(lib_dir, "libv8-{}.a".format(api_version)) shutil.copyfile(monolith_path, libv8_path) - with codecs.open(os.path.join(pkgconfig_dir, "v8-{}.pc".format(api_version)), "w", 'utf-8') as f: + with open(os.path.join(pkgconfig_dir, "v8-{}.pc".format(api_version)), "w", encoding='utf-8') as f: f.write("""\ prefix={prefix} libdir=${{prefix}}/lib diff --git a/releng/common.mk b/releng/common.mk index 9e3702573c..810106baa5 100644 --- a/releng/common.mk +++ b/releng/common.mk @@ -11,18 +11,18 @@ frida_core_flags := --default-library static $(FRIDA_COMMON_FLAGS) $(FRIDA_MAPPE frida_tools := frida frida-discover frida-kill frida-ls-devices frida-ps frida-trace -v8_api_version := 7.0 +v8_api_version := 8.0 build/frida-env-%.rc: releng/setup-env.sh releng/config.site.in build/frida-version.h FRIDA_HOST=$* \ - FRIDA_OPTIMIZATION_FLAGS="$(FRIDA_OPTIMIZATION_FLAGS)" \ - FRIDA_DEBUG_FLAGS="$(FRIDA_DEBUG_FLAGS)" \ + FRIDA_ACOPTFLAGS="$(FRIDA_ACOPTFLAGS_COMMON)" \ + FRIDA_ACDBGFLAGS="$(FRIDA_ACDBGFLAGS_COMMON)" \ FRIDA_ASAN=$(FRIDA_ASAN) \ ./releng/setup-env.sh build/frida_thin-env-%.rc: releng/setup-env.sh releng/config.site.in build/frida-version.h FRIDA_HOST=$* \ - FRIDA_OPTIMIZATION_FLAGS="$(FRIDA_OPTIMIZATION_FLAGS)" \ - FRIDA_DEBUG_FLAGS="$(FRIDA_DEBUG_FLAGS)" \ + FRIDA_ACOPTFLAGS="$(FRIDA_ACOPTFLAGS_COMMON)" \ + FRIDA_ACDBGFLAGS="$(FRIDA_ACDBGFLAGS_COMMON)" \ FRIDA_ASAN=$(FRIDA_ASAN) \ FRIDA_ENV_NAME=frida_thin \ ./releng/setup-env.sh diff --git a/releng/config.site.in b/releng/config.site.in index f54b209baa..1277d9c65c 100644 --- a/releng/config.site.in +++ b/releng/config.site.in @@ -11,8 +11,6 @@ test "$prefix" = NONE && prefix="$frida_prefix" enable_nls=no enable_silent_rules=yes -frida_warning_flags="-Wall" - case "$PACKAGE_TARNAME" in capstone) # Takes ages to compile with debug information @@ -124,18 +122,19 @@ if [ -x /usr/bin/install ]; then ac_cv_path_install="/usr/bin/install -p" fi +enable_shared=no +enable_static=yes + case "$PACKAGE_TARNAME" in - gettext*) - enable_shared=no - enable_static=yes - ;; - xz) - enable_shared=no - enable_static=yes + elfutils) + enable_debuginfod=no + case $frida_host_platform_arch in + android-x86|android-arm) + ac_cv_have_decl_mempcpy=no + ;; + esac ;; libunwind) - enable_shared=no - enable_static=yes enable_coredump=no enable_ptrace=no enable_setjmp=no @@ -146,21 +145,6 @@ case "$PACKAGE_TARNAME" in CFLAGS="$CFLAGS -I$frida_prefix/include" LDFLAGS="$LDFLAGS -L$frida_prefix/lib" ;; - elfutils) - case $frida_host_platform_arch in - android-x86|android-arm) - ac_cv_have_decl_mempcpy=no - ;; - esac - ;; - capstone) - enable_shared=no - enable_static=yes - frida_flags="$frida_warning_flags $frida_flags" - ;; - *) - frida_flags="$frida_warning_flags $frida_flags" - ;; esac CFLAGS="$CFLAGS $frida_flags" diff --git a/releng/devkit.py b/releng/devkit.py index 31b332c020..7ace55bfc7 100755 --- a/releng/devkit.py +++ b/releng/devkit.py @@ -192,7 +192,7 @@ def generate_library_windows(package, frida_root, host, flavor, output_dir, libr ] tls_provider = [ - sdk_lib_path(os.path.join("gio", "modules", "libgioschannel-static.a"), frida_root, host), + sdk_lib_path(os.path.join("gio", "modules", "libgioschannel.a"), frida_root, host), ] json_glib = glib + gobject + [ @@ -214,7 +214,7 @@ def generate_library_windows(package, frida_root, host, flavor, output_dir, libr ] v8 = [ - sdk_lib_path("libv8-7.0.a", frida_root, host), + sdk_lib_path("libv8-8.0.a", frida_root, host), ] capstone = [ diff --git a/releng/frida.props b/releng/frida.props index 7af9eba0e0..7e0a7fd3d1 100644 --- a/releng/frida.props +++ b/releng/frida.props @@ -4,13 +4,14 @@ <_ProjectFileVersion>10.0.30319.1 $(SolutionDir)build\frida-windows\$(PlatformName)-$(Configuration)\bin\ $(SolutionDir)build\tmp-windows\$(PlatformName)-$(Configuration)\$(ProjectName)\ - $(SolutionDir)build\toolchain-windows\bin\valac-0.46.exe - --target-glib=2.62 --vapidir="$(SolutionDir)frida-core\vapi" --vapidir="$(SolutionDir)frida-gum\vapi" --vapidir="$(SolutionDir)build\sdk-windows\$(Platform)-$(Configuration)\share\vala\vapi" + $(SolutionDir)build\toolchain-windows\bin\valac-0.50.exe + --target-glib=2.66 --vapidir="$(SolutionDir)frida-core\vapi" --vapidir="$(SolutionDir)frida-gum\vapi" --vapidir="$(SolutionDir)build\sdk-windows\$(Platform)-$(Configuration)\share\vala\vapi" + false $(SolutionDir)build\tmp-windows\frida-version.h - $(IntDir);$(SolutionDir)capstone\include\capstone;$(SolutionDir)frida-gum;$(SolutionDir)frida-gum\libs;$(SolutionDir)frida-gum\bindings;$(SolutionDir)build\sdk-windows\$(Platform)-$(Configuration)\include\v8-7.0;$(SolutionDir)build\sdk-windows\$(Platform)-$(Configuration)\include\v8-7.0\v8;$(SolutionDir)build\sdk-windows\$(Platform)-$(Configuration)\include\libsoup-2.4;$(SolutionDir)build\sdk-windows\$(Platform)-$(Configuration)\include\json-glib-1.0;$(SolutionDir)build\sdk-windows\$(Platform)-$(Configuration)\include\gee-0.8;$(SolutionDir)build\sdk-windows\$(Platform)-$(Configuration)\include\gio-win32-2.0;$(SolutionDir)build\sdk-windows\$(Platform)-$(Configuration)\lib\glib-2.0\include;$(SolutionDir)build\sdk-windows\$(Platform)-$(Configuration)\include\glib-2.0;$(SolutionDir)build\sdk-windows\$(Platform)-$(Configuration)\lib\libffi-3.1\include;$(SolutionDir)build\sdk-windows\$(Platform)-$(Configuration)\include;%(AdditionalIncludeDirectories) + $(IntDir);$(SolutionDir)capstone\include\capstone;$(SolutionDir)frida-gum;$(SolutionDir)frida-gum\libs;$(SolutionDir)frida-gum\bindings;$(SolutionDir)build\sdk-windows\$(Platform)-$(Configuration)\include\v8-8.0;$(SolutionDir)build\sdk-windows\$(Platform)-$(Configuration)\include\v8-8.0\v8;$(SolutionDir)build\sdk-windows\$(Platform)-$(Configuration)\include\libsoup-2.4;$(SolutionDir)build\sdk-windows\$(Platform)-$(Configuration)\include\json-glib-1.0;$(SolutionDir)build\sdk-windows\$(Platform)-$(Configuration)\include\gee-0.8;$(SolutionDir)build\sdk-windows\$(Platform)-$(Configuration)\include\gio-win32-2.0;$(SolutionDir)build\sdk-windows\$(Platform)-$(Configuration)\lib\glib-2.0\include;$(SolutionDir)build\sdk-windows\$(Platform)-$(Configuration)\include\glib-2.0;$(SolutionDir)build\sdk-windows\$(Platform)-$(Configuration)\lib\libffi-3.1\include;$(SolutionDir)build\sdk-windows\$(Platform)-$(Configuration)\include;%(AdditionalIncludeDirectories) Level4 4100;4127;4201;4204;4244;4302;4305;4311;4702;4715;%(DisableSpecificWarnings) PSAPI_VERSION=1;WIN32;_WINDOWS;WINVER=0x0501;_WIN32_WINNT=0x0501;GUM_STATIC;%(PreprocessorDefinitions) @@ -21,7 +22,7 @@ $(IntDir)$(ProjectName).lib $(IntDir)..\capstone-32;$(IntDir)..\capstone-64;$(IntDir)..\gum-32;$(IntDir)..\gum-64;$(IntDir)..\gumjs-32;$(IntDir)..\gumjs-64;$(SolutionDir)build\sdk-windows\$(PlatformName)-$(ConfigurationName)\lib;$(SolutionDir)build\sdk-windows\$(PlatformName)-$(ConfigurationName)\lib\gio\modules;%(AdditionalLibraryDirectories) - libffi.a;libgee-0.8.a;libgio-2.0.a;libgioschannel-static.a;libglib-2.0.a;libgmodule-2.0.a;libgobject-2.0.a;libgthread-2.0.a;libjson-glib-1.0.a;libsoup-2.4.a;libsqlite3.a;libv8-7.0.a;libz.a;crypt32.lib;dnsapi.lib;iphlpapi.lib;ole32.lib;psapi.lib;secur32.lib;shlwapi.lib;winmm.lib;ws2_32.lib;%(AdditionalDependencies) + libffi.a;libgee-0.8.a;libgio-2.0.a;libgioschannel.a;libglib-2.0.a;libgmodule-2.0.a;libgobject-2.0.a;libgthread-2.0.a;libjson-glib-1.0.a;libsoup-2.4.a;libsqlite3.a;libv8-8.0.a;libz.a;crypt32.lib;dnsapi.lib;iphlpapi.lib;ole32.lib;psapi.lib;secur32.lib;shlwapi.lib;winmm.lib;ws2_32.lib;%(AdditionalDependencies) diff --git a/releng/meson b/releng/meson index 5491b2f1e5..4d3d28c2fc 160000 --- a/releng/meson +++ b/releng/meson @@ -1 +1 @@ -Subproject commit 5491b2f1e53f5ccb2ada482da71c27775d842fae +Subproject commit 4d3d28c2fc186e3afc5ee625e58fde3ef28aa764 diff --git a/releng/ninja-linux-arm64 b/releng/ninja-linux-arm64 index 7fde08ef2b..b02d325e26 100755 Binary files a/releng/ninja-linux-arm64 and b/releng/ninja-linux-arm64 differ diff --git a/releng/ninja-linux-x86_64 b/releng/ninja-linux-x86_64 index b8dc64f123..44de20fd69 100755 Binary files a/releng/ninja-linux-x86_64 and b/releng/ninja-linux-x86_64 differ diff --git a/releng/ninja-macos-x86_64 b/releng/ninja-macos-x86_64 index 43e0d6c52d..1fff93712b 100755 Binary files a/releng/ninja-macos-x86_64 and b/releng/ninja-macos-x86_64 differ diff --git a/releng/openssl-config/20-apple-platforms.conf b/releng/openssl-config/20-apple-platforms.conf index 3ba8db361e..5c284a54c0 100644 --- a/releng/openssl-config/20-apple-platforms.conf +++ b/releng/openssl-config/20-apple-platforms.conf @@ -11,7 +11,7 @@ my %targets = ( # Add embed-bitcode option if SDK version is 9 or higher "apple-base" => { template => 1, - cflags => combine('-isysroot $(CROSS_TOP)/SDKs/$(CROSS_SDK) -fno-common', + cflags => combine('-fno-common', sub { ((!defined($ENV{'CONFIG_DISABLE_BITCODE'}) || $ENV{'CONFIG_DISABLE_BITCODE'} ne 'true') && defined($ENV{'SDKVERSION'}) && $ENV{'SDKVERSION'} =~ /^(9|[1-9][0-9]+)\./ && $disabled{shared}) ? '-fembed-bitcode' : (); }, ), @@ -21,7 +21,14 @@ my %targets = ( "ios-cross-base" => { inherit_from => [ "apple-base" ], template => 1, - cflags => add(sub { defined($ENV{'IOS_MIN_SDK_VERSION'}) ? '-mios-version-min=$(IOS_MIN_SDK_VERSION)' : '-mios-version-min=7.0'; }), + cflags => add(combine( + sub { defined($ENV{'IOS_SDK_ROOT'}) + ? '-isysroot $(IOS_SDK_ROOT)' + : '-isysroot $(CROSS_TOP)/SDKs/$(CROSS_SDK)'; }, + sub { defined($ENV{'IOS_MIN_SDK_VERSION'}) + ? '-mios-version-min=$(IOS_MIN_SDK_VERSION)' + : '-mios-version-min=7.0'; }, + )), }, ## Base settings for tvOS @@ -29,7 +36,14 @@ my %targets = ( "tvos-cross-base" => { inherit_from => [ "apple-base" ], template => 1, - cflags => add(sub { defined($ENV{'TVOS_MIN_SDK_VERSION'}) ? '-mtvos-version-min=$(TVOS_MIN_SDK_VERSION)' : '-mtvos-version-min=9.0'; }), + cflags => add(combine( + sub { defined($ENV{'TVOS_SDK_ROOT'}) + ? '-isysroot $(TVOS_SDK_ROOT)' + : '-isysroot $(CROSS_TOP)/SDKs/$(CROSS_SDK)'; }, + sub { defined($ENV{'TVOS_MIN_SDK_VERSION'}) + ? '-mtvos-version-min=$(TVOS_MIN_SDK_VERSION)' + : '-mtvos-version-min=9.0'; }, + )), defines => [ "HAVE_FORK=0" ], }, @@ -37,7 +51,14 @@ my %targets = ( "macos-base" => { inherit_from => [ "apple-base" ], template => 1, - cflags => add(sub { defined($ENV{'MACOS_MIN_SDK_VERSION'}) ? '-mmacosx-version-min=$(MACOS_MIN_SDK_VERSION)' : '-mmacosx-version-min=10.11'; }), + cflags => add(combine( + sub { defined($ENV{'MACOS_SDK_ROOT'}) + ? '-isysroot $(MACOS_SDK_ROOT)' + : '-isysroot $(CROSS_TOP)/SDKs/$(CROSS_SDK)'; }, + sub { defined($ENV{'MACOS_MIN_SDK_VERSION'}) + ? '-mmacosx-version-min=$(MACOS_MIN_SDK_VERSION)' + : '-mmacosx-version-min=10.11'; }, + )), }, ## Apple iOS simulator (x86_64) diff --git a/releng/patches/elfutils-android.patch b/releng/patches/elfutils-android.patch index 2a2efd1c41..9bc187f1a7 100644 --- a/releng/patches/elfutils-android.patch +++ b/releng/patches/elfutils-android.patch @@ -1,8 +1,8 @@ diff --git a/configure.ac b/configure.ac -index 8274ec79..f00877a3 100644 +index a2716772..1264441f 100644 --- a/configure.ac +++ b/configure.ac -@@ -485,7 +485,7 @@ if test "$libc_has_argp" = "false" ; then +@@ -529,7 +529,7 @@ if test "$libc_has_argp" = "false" ; then AC_CHECK_LIB([argp], [argp_parse], [have_argp="true"], [have_argp="false"]) if test "$have_argp" = "false"; then @@ -56,9 +56,15 @@ index b55d5c48..5f13d947 100644 /* Helper Macros to write 32 bit and 64 bit functions. */ -diff --git a/libelf/libintl.h b/libelf/libintl.h -index e69de29b..0a2b2b66 100644 ---- a/libelf/libintl.h -+++ b/libelf/libintl.h -@@ -0,0 +1 @@ -+/* Empty stub for Android. */ +diff --git a/libelf/elf_error.c b/libelf/elf_error.c +index 5364e685..e596108d 100644 +--- a/libelf/elf_error.c ++++ b/libelf/elf_error.c +@@ -32,7 +32,6 @@ + #endif + + #include +-#include + #include + #include + #include diff --git a/releng/patches/elfutils-clang.patch b/releng/patches/elfutils-clang.patch index a026c0e3d7..4902a49939 100644 --- a/releng/patches/elfutils-clang.patch +++ b/releng/patches/elfutils-clang.patch @@ -305,7 +305,7 @@ index f9114cb1..c1f87b6a 100644 case DW_TAG_base_type: case DW_TAG_enumeration_type: diff --git a/config/eu.am b/config/eu.am -index 82acda3a..6a49f183 100644 +index 6c3c444f..14efdf65 100644 --- a/config/eu.am +++ b/config/eu.am @@ -64,19 +64,18 @@ endif @@ -329,12 +329,12 @@ index 82acda3a..6a49f183 100644 - $(if $($(*F)_no_Wpacked_not_aligned),-Wno-packed-not-aligned,) \ $($(*F)_CFLAGS) - COMPILE.os = $(filter-out -fprofile-arcs -ftest-coverage, $(COMPILE)) + AM_CXXFLAGS = -std=c++11 -Wall -Wshadow \ diff --git a/configure.ac b/configure.ac -index b4e012de..8274ec79 100644 +index a39e800f..a2716772 100644 --- a/configure.ac +++ b/configure.ac -@@ -125,7 +125,7 @@ void baz (int n) +@@ -127,7 +127,7 @@ void baz (int n) ac_cv_c99=yes, ac_cv_c99=no) CFLAGS="$old_CFLAGS"]) AS_IF([test "x$ac_cv_c99" != xyes], @@ -375,18 +375,18 @@ index 7cdf484f..062834ee 100644 { .pattern = diff --git a/libcpu/i386_disasm.c b/libcpu/i386_disasm.c -index a7e03f95..96d638eb 100644 +index 4422ffa2..c50ecd66 100644 --- a/libcpu/i386_disasm.c +++ b/libcpu/i386_disasm.c -@@ -819,7 +819,7 @@ i386_disasm (Ebl *ebl __attribute__((unused)), +@@ -821,7 +821,7 @@ i386_disasm (Ebl *ebl __attribute__((unused)), ++param_start; break; } - FALLTHROUGH; + /* fall through */ default: - assert (! "INVALID not handled"); - } + str = "INVALID not handled"; + break; diff --git a/libdw/cfi.c b/libdw/cfi.c index 341e055b..a6060638 100644 --- a/libdw/cfi.c @@ -436,7 +436,7 @@ index 3fc9384a..cdaa2111 100644 default:; size_t phnum; diff --git a/libdwfl/dwfl_segment_report_module.c b/libdwfl/dwfl_segment_report_module.c -index 76ba1506..8d6058d9 100644 +index 430e13d5..a7d42492 100644 --- a/libdwfl/dwfl_segment_report_module.c +++ b/libdwfl/dwfl_segment_report_module.c @@ -199,6 +199,356 @@ handle_file_note (GElf_Addr module_start, GElf_Addr module_end, @@ -1300,7 +1300,7 @@ index 76ba1506..8d6058d9 100644 } elf = elf_memory (contents, file_trimmed_end); -@@ -974,5 +1074,5 @@ dwfl_segment_report_module (Dwfl *dwfl, int ndx, const char *name, +@@ -975,5 +1075,5 @@ dwfl_segment_report_module (Dwfl *dwfl, int ndx, const char *name, mod->main_bias = bias; } @@ -2007,10 +2007,10 @@ index 6ba6af41..60d9b406 100644 fd = open (fname, O_RDONLY); if (fd < 0) diff --git a/src/elflint.c b/src/elflint.c -index edb466dd..24f6de9e 100644 +index 480d84ba..da698bf4 100644 --- a/src/elflint.c +++ b/src/elflint.c -@@ -1763,7 +1763,7 @@ section [%2d] '%s': entry %zu: pointer does not match address of section [%2d] ' +@@ -1767,7 +1767,7 @@ section [%2d] '%s': entry %zu: pointer does not match address of section [%2d] ' if (dyn->d_tag < DT_ADDRRNGLO || dyn->d_tag > DT_ADDRRNGHI) /* Value is no pointer. */ break; @@ -2019,7 +2019,7 @@ index edb466dd..24f6de9e 100644 case DT_AUXILIARY: case DT_FILTER: -@@ -3435,10 +3435,8 @@ check_attributes (Ebl *ebl, GElf_Ehdr *ehdr, GElf_Shdr *shdr, int idx) +@@ -3439,10 +3439,8 @@ check_attributes (Ebl *ebl, GElf_Ehdr *ehdr, GElf_Shdr *shdr, int idx) return; } @@ -2032,7 +2032,7 @@ index edb466dd..24f6de9e 100644 const unsigned char *p = data->d_buf; if (*p++ != 'A') -@@ -3448,10 +3446,7 @@ check_attributes (Ebl *ebl, GElf_Ehdr *ehdr, GElf_Shdr *shdr, int idx) +@@ -3452,10 +3450,7 @@ check_attributes (Ebl *ebl, GElf_Ehdr *ehdr, GElf_Shdr *shdr, int idx) return; } @@ -2044,7 +2044,7 @@ index edb466dd..24f6de9e 100644 while (left () >= 4) { -@@ -3995,7 +3990,7 @@ section [%2zu] '%s': merge flag set but entry size is zero\n"), +@@ -3999,7 +3994,7 @@ section [%2zu] '%s': merge flag set but entry size is zero\n"), case SHT_NOBITS: if (is_debuginfo) break; @@ -2053,7 +2053,7 @@ index edb466dd..24f6de9e 100644 default: ERROR (gettext ("\ section [%2zu] '%s' has unexpected type %d for an executable section\n"), -@@ -4139,7 +4134,7 @@ section [%2zu] '%s': ELF header says this is the section header string table but +@@ -4143,7 +4138,7 @@ section [%2zu] '%s': ELF header says this is the section header string table but ERROR (gettext ("\ section [%2zu] '%s': relocatable files cannot have dynamic symbol tables\n"), cnt, section_name (ebl, cnt)); @@ -2062,7 +2062,7 @@ index edb466dd..24f6de9e 100644 case SHT_SYMTAB: check_symtab (ebl, ehdr, shdr, cnt); break; -@@ -4362,7 +4357,7 @@ section [%2d] '%s': unknown core file note type %" PRIu32 +@@ -4366,7 +4361,7 @@ section [%2d] '%s': unknown core file note type %" PRIu32 if (nhdr.n_namesz == sizeof "Linux" && !memcmp (data->d_buf + name_offset, "Linux", sizeof "Linux")) break; @@ -2072,7 +2072,7 @@ index edb466dd..24f6de9e 100644 { unknown_note: diff --git a/src/objdump.c b/src/objdump.c -index 6b365d5c..075c5f52 100644 +index a619674f..ab3ce5f7 100644 --- a/src/objdump.c +++ b/src/objdump.c @@ -222,7 +222,7 @@ parse_opt (int key, char *arg, @@ -2085,10 +2085,10 @@ index 6b365d5c..075c5f52 100644 return ARGP_ERR_UNKNOWN; } diff --git a/src/readelf.c b/src/readelf.c -index 2084fb1f..9b0af70c 100644 +index cbb519d1..918bd3fa 100644 --- a/src/readelf.c +++ b/src/readelf.c -@@ -376,17 +376,19 @@ static error_t +@@ -387,17 +387,19 @@ static error_t parse_opt (int key, char *arg, struct argp_state *state __attribute__ ((unused))) { @@ -2119,7 +2119,7 @@ index 2084fb1f..9b0af70c 100644 switch (key) { -@@ -544,7 +546,7 @@ parse_opt (int key, char *arg, +@@ -560,7 +562,7 @@ parse_opt (int key, char *arg, print_string_sections = true; break; } @@ -2128,7 +2128,7 @@ index 2084fb1f..9b0af70c 100644 case 'x': add_dump_section (arg, false); any_control_option = true; -@@ -3595,10 +3597,7 @@ print_attributes (Ebl *ebl, const GElf_Ehdr *ehdr) +@@ -3611,10 +3613,7 @@ print_attributes (Ebl *ebl, const GElf_Ehdr *ehdr) fputs_unlocked (gettext (" Owner Size\n"), stdout); @@ -2140,7 +2140,7 @@ index 2084fb1f..9b0af70c 100644 /* Loop over the sections. */ while (left () >= 4) -@@ -6163,11 +6162,12 @@ print_cfa_program (const unsigned char *readp, const unsigned char *const endp, +@@ -6179,11 +6178,12 @@ print_cfa_program (const unsigned char *readp, const unsigned char *const endp, Dwfl_Module *dwflmod, Ebl *ebl, Dwarf *dbg) { char regnamebuf[REGNAMESZ]; @@ -2158,7 +2158,7 @@ index 2084fb1f..9b0af70c 100644 puts ("\n Program:"); Dwarf_Word pc = vma_base; -@@ -7118,7 +7118,7 @@ attr_callback (Dwarf_Attribute *attrp, void *arg) +@@ -7134,7 +7134,7 @@ attr_callback (Dwarf_Attribute *attrp, void *arg) dwarf_form_name (form), (uintmax_t) num); return DWARF_CB_OK; } @@ -2167,7 +2167,7 @@ index 2084fb1f..9b0af70c 100644 /* These cases always take a loclist[ptr] and no constant. */ case DW_AT_location: -@@ -7506,7 +7506,7 @@ attr_callback (Dwarf_Attribute *attrp, void *arg) +@@ -7522,7 +7522,7 @@ attr_callback (Dwarf_Attribute *attrp, void *arg) print_block (block.length, block.data); break; } @@ -2176,7 +2176,7 @@ index 2084fb1f..9b0af70c 100644 case DW_AT_location: case DW_AT_data_location: -@@ -8679,15 +8679,16 @@ print_debug_line_section (Dwfl_Module *dwflmod, Ebl *ebl, GElf_Ehdr *ehdr, +@@ -8695,15 +8695,16 @@ print_debug_line_section (Dwfl_Module *dwflmod, Ebl *ebl, GElf_Ehdr *ehdr, or DW_LNS_advance_pc (as per DWARF4 6.2.5.1). */ unsigned int op_addr_advance; bool show_op_index; @@ -2202,7 +2202,7 @@ index 2084fb1f..9b0af70c 100644 if (max_ops_per_instr == 0) { -@@ -12002,14 +12003,16 @@ handle_core_registers (Ebl *ebl, Elf *core, const void *desc, +@@ -12018,14 +12019,16 @@ handle_core_registers (Ebl *ebl, Elf *core, const void *desc, qsort (regs, maxreg + 1, sizeof regs[0], &compare_registers); /* Collect the unique sets and sort them. */ @@ -2227,7 +2227,7 @@ index 2084fb1f..9b0af70c 100644 struct register_info *sets[maxreg + 1]; sets[0] = ®s[0]; size_t nsets = 1; -@@ -12082,7 +12085,7 @@ handle_auxv_note (Ebl *ebl, Elf *core, GElf_Word descsz, GElf_Off desc_pos) +@@ -12098,7 +12101,7 @@ handle_auxv_note (Ebl *ebl, Elf *core, GElf_Word descsz, GElf_Off desc_pos) printf (" %s\n", name); break; } @@ -2607,10 +2607,10 @@ index 48792a70..2a882eab 100644 case SHT_REL: case SHT_RELA: diff --git a/src/unstrip.c b/src/unstrip.c -index fc878325..797a7249 100644 +index 9b8c09a1..1d973582 100644 --- a/src/unstrip.c +++ b/src/unstrip.c -@@ -437,11 +437,12 @@ adjust_relocs (Elf_Scn *outscn, Elf_Scn *inscn, const GElf_Shdr *shdr, +@@ -437,15 +437,16 @@ adjust_relocs (Elf_Scn *outscn, Elf_Scn *inscn, const GElf_Shdr *shdr, { Elf_Data *data = elf_getdata (outscn, NULL); @@ -2618,17 +2618,25 @@ index fc878325..797a7249 100644 - { - size_t ndx = GELF_R_SYM (*info); - if (ndx != STN_UNDEF) -- *info = GELF_R_INFO (map[ndx - 1], GELF_R_TYPE (*info)); +- { +- if (ndx > map_size) +- error (EXIT_FAILURE, 0, "bad symbol ndx section"); +- *info = GELF_R_INFO (map[ndx - 1], GELF_R_TYPE (*info)); +- } + #define adjust_reloc(info_arg) \ + { \ + GElf_Xword *info = info_arg; \ + size_t ndx = GELF_R_SYM (*info); \ + if (ndx != STN_UNDEF) \ -+ *info = GELF_R_INFO (map[ndx - 1], GELF_R_TYPE (*info)); \ ++ { \ ++ if (ndx > map_size) \ ++ error (EXIT_FAILURE, 0, "bad symbol ndx section"); \ ++ *info = GELF_R_INFO (map[ndx - 1], GELF_R_TYPE (*info)); \ ++ } \ } switch (shdr->sh_type) -@@ -1186,14 +1187,17 @@ find_alloc_sections_prelink (Elf *debug, Elf_Data *debug_shstrtab, +@@ -1194,14 +1195,17 @@ find_alloc_sections_prelink (Elf *debug, Elf_Data *debug_shstrtab, } bool fail = false; @@ -2654,7 +2662,7 @@ index fc878325..797a7249 100644 } Elf_Scn *scn = NULL; -@@ -1422,27 +1426,31 @@ more sections in stripped file than debug file -- arguments reversed?")); +@@ -1443,27 +1447,31 @@ more sections in stripped file than debug file -- arguments reversed?")); } /* Locate a matching unallocated section in SECTIONS. */ @@ -2707,7 +2715,7 @@ index fc878325..797a7249 100644 Elf_Data *shstrtab = elf_getdata (elf_getscn (unstripped, unstripped_shstrndx), NULL); -@@ -2184,12 +2192,13 @@ handle_explicit_files (const char *output_file, bool create_dirs, bool force, +@@ -2227,12 +2235,13 @@ handle_explicit_files (const char *output_file, bool create_dirs, bool force, /* Warn, and exit if not forced to continue, if some ELF header sanity check for the stripped and unstripped files failed. */ @@ -2727,7 +2735,7 @@ index fc878325..797a7249 100644 } int stripped_fd = open_file (stripped_file, false); -@@ -2445,10 +2454,11 @@ static void +@@ -2488,10 +2497,11 @@ static void handle_implicit_modules (const struct arg_info *info) { struct match_module_info mmi = { info->args, NULL, info->match_files }; diff --git a/releng/patches/gettext-static-only.patch b/releng/patches/gettext-static-only.patch new file mode 100644 index 0000000000..557affbd7f --- /dev/null +++ b/releng/patches/gettext-static-only.patch @@ -0,0 +1,134 @@ +diff -Nur gettext-orig/gettext-runtime/intl/Makefile.am gettext/gettext-runtime/intl/Makefile.am +--- gettext-orig/gettext-runtime/intl/Makefile.am 2019-05-12 13:56:31.000000000 +0000 ++++ gettext/gettext-runtime/intl/Makefile.am 2020-04-04 23:39:08.975329221 +0000 +@@ -388,31 +388,6 @@ + endif + + +-# Installation of preloadable_libintl.so. +- +-if PRELOADABLE_LIBINTL +- +-install-exec-local: install-exec-preloadable +-install-exec-preloadable: libgnuintl.la +- $(mkdir_p) $(DESTDIR)$(libdir) +- $(LIBTOOL) --mode=install \ +- $(INSTALL_DATA) libgnuintl.la $(DESTDIR)$(libdir)/libgnuintl.la +- rm -f $(DESTDIR)$(libdir)/preloadable_libintl.so +- $(INSTALL_DATA) $(DESTDIR)$(libdir)/libgnuintl.so $(DESTDIR)$(libdir)/preloadable_libintl.so +- $(LIBTOOL) --mode=uninstall \ +- rm -f $(DESTDIR)$(libdir)/libgnuintl.la +- +-installdirs-local: installdirs-preloadable +-installdirs-preloadable: +- $(mkdir_p) $(DESTDIR)$(libdir) +- +-uninstall-local: uninstall-preloadable +-uninstall-preloadable: +- rm -f $(DESTDIR)$(libdir)/preloadable_libintl.so +- +-endif +- +- + # Installation of locale.alias. + + EXTRA_DIST += locale.alias ref-add.sin ref-del.sin +diff -Nur gettext-orig/gettext-runtime/intl/Makefile.in gettext/gettext-runtime/intl/Makefile.in +--- gettext-orig/gettext-runtime/intl/Makefile.in 2019-05-12 15:08:36.000000000 +0000 ++++ gettext/gettext-runtime/intl/Makefile.in 2020-04-04 23:41:42.398107449 +0000 +@@ -1956,25 +1956,11 @@ + @USE_INCLUDED_LIBINTL_TRUE@ $(LIBTOOL) --mode=uninstall \ + @USE_INCLUDED_LIBINTL_TRUE@ rm -f $(DESTDIR)$(libdir)/libintl.la + +-# Installation of preloadable_libintl.so. ++@PRELOADABLE_LIBINTL_TRUE@install-exec-local: + +-@PRELOADABLE_LIBINTL_TRUE@install-exec-local: install-exec-preloadable +-@PRELOADABLE_LIBINTL_TRUE@install-exec-preloadable: libgnuintl.la +-@PRELOADABLE_LIBINTL_TRUE@ $(mkdir_p) $(DESTDIR)$(libdir) +-@PRELOADABLE_LIBINTL_TRUE@ $(LIBTOOL) --mode=install \ +-@PRELOADABLE_LIBINTL_TRUE@ $(INSTALL_DATA) libgnuintl.la $(DESTDIR)$(libdir)/libgnuintl.la +-@PRELOADABLE_LIBINTL_TRUE@ rm -f $(DESTDIR)$(libdir)/preloadable_libintl.so +-@PRELOADABLE_LIBINTL_TRUE@ $(INSTALL_DATA) $(DESTDIR)$(libdir)/libgnuintl.so $(DESTDIR)$(libdir)/preloadable_libintl.so +-@PRELOADABLE_LIBINTL_TRUE@ $(LIBTOOL) --mode=uninstall \ +-@PRELOADABLE_LIBINTL_TRUE@ rm -f $(DESTDIR)$(libdir)/libgnuintl.la ++@PRELOADABLE_LIBINTL_TRUE@installdirs-local: + +-@PRELOADABLE_LIBINTL_TRUE@installdirs-local: installdirs-preloadable +-@PRELOADABLE_LIBINTL_TRUE@installdirs-preloadable: +-@PRELOADABLE_LIBINTL_TRUE@ $(mkdir_p) $(DESTDIR)$(libdir) +- +-@PRELOADABLE_LIBINTL_TRUE@uninstall-local: uninstall-preloadable +-@PRELOADABLE_LIBINTL_TRUE@uninstall-preloadable: +-@PRELOADABLE_LIBINTL_TRUE@ rm -f $(DESTDIR)$(libdir)/preloadable_libintl.so ++@PRELOADABLE_LIBINTL_TRUE@uninstall-local: + + @USE_INCLUDED_LIBINTL_TRUE@all-local: ref-add.sed ref-del.sed + +diff -Nur gettext-orig/gettext-tools/intl/Makefile.am gettext/gettext-tools/intl/Makefile.am +--- gettext-orig/gettext-tools/intl/Makefile.am 2019-05-12 13:56:31.000000000 +0000 ++++ gettext/gettext-tools/intl/Makefile.am 2020-04-04 23:41:08.194380740 +0000 +@@ -388,31 +388,6 @@ + endif + + +-# Installation of preloadable_libintl.so. +- +-if PRELOADABLE_LIBINTL +- +-install-exec-local: install-exec-preloadable +-install-exec-preloadable: libgnuintl.la +- $(mkdir_p) $(DESTDIR)$(libdir) +- $(LIBTOOL) --mode=install \ +- $(INSTALL_DATA) libgnuintl.la $(DESTDIR)$(libdir)/libgnuintl.la +- rm -f $(DESTDIR)$(libdir)/preloadable_libintl.so +- $(INSTALL_DATA) $(DESTDIR)$(libdir)/libgnuintl.so $(DESTDIR)$(libdir)/preloadable_libintl.so +- $(LIBTOOL) --mode=uninstall \ +- rm -f $(DESTDIR)$(libdir)/libgnuintl.la +- +-installdirs-local: installdirs-preloadable +-installdirs-preloadable: +- $(mkdir_p) $(DESTDIR)$(libdir) +- +-uninstall-local: uninstall-preloadable +-uninstall-preloadable: +- rm -f $(DESTDIR)$(libdir)/preloadable_libintl.so +- +-endif +- +- + # Installation of locale.alias. + + EXTRA_DIST += locale.alias ref-add.sin ref-del.sin +diff -Nur gettext-orig/gettext-tools/intl/Makefile.in gettext/gettext-tools/intl/Makefile.in +--- gettext-orig/gettext-tools/intl/Makefile.in 2019-05-12 15:09:16.000000000 +0000 ++++ gettext/gettext-tools/intl/Makefile.in 2020-04-04 23:41:32.314188071 +0000 +@@ -2660,25 +2660,11 @@ + @USE_INCLUDED_LIBINTL_TRUE@ $(LIBTOOL) --mode=uninstall \ + @USE_INCLUDED_LIBINTL_TRUE@ rm -f $(DESTDIR)$(libdir)/libintl.la + +-# Installation of preloadable_libintl.so. ++@PRELOADABLE_LIBINTL_TRUE@install-exec-local: + +-@PRELOADABLE_LIBINTL_TRUE@install-exec-local: install-exec-preloadable +-@PRELOADABLE_LIBINTL_TRUE@install-exec-preloadable: libgnuintl.la +-@PRELOADABLE_LIBINTL_TRUE@ $(mkdir_p) $(DESTDIR)$(libdir) +-@PRELOADABLE_LIBINTL_TRUE@ $(LIBTOOL) --mode=install \ +-@PRELOADABLE_LIBINTL_TRUE@ $(INSTALL_DATA) libgnuintl.la $(DESTDIR)$(libdir)/libgnuintl.la +-@PRELOADABLE_LIBINTL_TRUE@ rm -f $(DESTDIR)$(libdir)/preloadable_libintl.so +-@PRELOADABLE_LIBINTL_TRUE@ $(INSTALL_DATA) $(DESTDIR)$(libdir)/libgnuintl.so $(DESTDIR)$(libdir)/preloadable_libintl.so +-@PRELOADABLE_LIBINTL_TRUE@ $(LIBTOOL) --mode=uninstall \ +-@PRELOADABLE_LIBINTL_TRUE@ rm -f $(DESTDIR)$(libdir)/libgnuintl.la ++@PRELOADABLE_LIBINTL_TRUE@installdirs-local: + +-@PRELOADABLE_LIBINTL_TRUE@installdirs-local: installdirs-preloadable +-@PRELOADABLE_LIBINTL_TRUE@installdirs-preloadable: +-@PRELOADABLE_LIBINTL_TRUE@ $(mkdir_p) $(DESTDIR)$(libdir) +- +-@PRELOADABLE_LIBINTL_TRUE@uninstall-local: uninstall-preloadable +-@PRELOADABLE_LIBINTL_TRUE@uninstall-preloadable: +-@PRELOADABLE_LIBINTL_TRUE@ rm -f $(DESTDIR)$(libdir)/preloadable_libintl.so ++@PRELOADABLE_LIBINTL_TRUE@uninstall-local: + + @USE_INCLUDED_LIBINTL_TRUE@all-local: ref-add.sed ref-del.sed + diff --git a/releng/patches/gettext-vasnprintf-apple-fix.patch b/releng/patches/gettext-vasnprintf-apple-fix.patch deleted file mode 100644 index 5230d04936..0000000000 --- a/releng/patches/gettext-vasnprintf-apple-fix.patch +++ /dev/null @@ -1,24 +0,0 @@ -diff -Nur gettext-0.19.8.1-orig/gettext-tools/gnulib-lib/vasnprintf.c gettext-0.19.8.1/gettext-tools/gnulib-lib/vasnprintf.c ---- gettext-0.19.8.1-orig/gettext-tools/gnulib-lib/vasnprintf.c 2016-06-11 13:00:02.000000000 +0000 -+++ gettext-0.19.8.1/gettext-tools/gnulib-lib/vasnprintf.c 2017-09-24 17:17:10.515030778 +0000 -@@ -4858,7 +4858,7 @@ - #endif - *fbp = dp->conversion; - #if USE_SNPRINTF --# if !(((__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3)) && !defined __UCLIBC__) || ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)) -+# if !(((__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3)) && !defined __UCLIBC__) || ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__) || defined __APPLE__) - fbp[1] = '%'; - fbp[2] = 'n'; - fbp[3] = '\0'; -diff -Nur gettext-0.19.8.1-orig/gettext-tools/libgettextpo/vasnprintf.c gettext-0.19.8.1/gettext-tools/libgettextpo/vasnprintf.c ---- gettext-0.19.8.1-orig/gettext-tools/libgettextpo/vasnprintf.c 2016-06-11 13:00:34.000000000 +0000 -+++ gettext-0.19.8.1/gettext-tools/libgettextpo/vasnprintf.c 2017-09-24 17:17:39.266743237 +0000 -@@ -4858,7 +4858,7 @@ - #endif - *fbp = dp->conversion; - #if USE_SNPRINTF --# if !(((__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3)) && !defined __UCLIBC__) || ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)) -+# if !(((__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3)) && !defined __UCLIBC__) || ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__) || defined __APPLE__) - fbp[1] = '%'; - fbp[2] = 'n'; - fbp[3] = '\0'; diff --git a/releng/patches/libiconv-android.patch b/releng/patches/libiconv-android.patch deleted file mode 100644 index cd97656a54..0000000000 --- a/releng/patches/libiconv-android.patch +++ /dev/null @@ -1,66 +0,0 @@ -diff --git a/Makefile.in b/Makefile.in -index 6d5ed03..bd40626 100644 ---- a/Makefile.in -+++ b/Makefile.in -@@ -32,11 +32,6 @@ SHELL = /bin/sh - all : lib/localcharset.h force - cd lib && $(MAKE) all - cd preload && $(MAKE) all -- cd srclib && $(MAKE) all -- cd src && $(MAKE) all -- cd po && $(MAKE) all -- cd man && $(MAKE) all -- if test -d tests; then cd tests && $(MAKE) all; fi - - lib/localcharset.h : - builddir="`pwd`"; cd libcharset && $(MAKE) all && $(MAKE) install-lib libdir="$$builddir/lib" includedir="$$builddir/lib" -@@ -52,23 +47,16 @@ install : lib/localcharset.h force - cd libcharset && $(MAKE) install prefix='$(prefix)' exec_prefix='$(exec_prefix)' libdir='$(libdir)' - cd lib && $(MAKE) install prefix='$(prefix)' exec_prefix='$(exec_prefix)' libdir='$(libdir)' - cd preload && $(MAKE) install prefix='$(prefix)' exec_prefix='$(exec_prefix)' libdir='$(libdir)' -- cd srclib && $(MAKE) install prefix='$(prefix)' exec_prefix='$(exec_prefix)' libdir='$(libdir)' -- cd src && $(MAKE) install prefix='$(prefix)' exec_prefix='$(exec_prefix)' libdir='$(libdir)' - if [ ! -d $(DESTDIR)$(includedir) ] ; then $(mkinstalldirs) $(DESTDIR)$(includedir) ; fi - $(INSTALL_DATA) include/iconv.h.inst $(DESTDIR)$(includedir)/iconv.h -- cd po && $(MAKE) install prefix='$(prefix)' exec_prefix='$(exec_prefix)' datarootdir='$(datarootdir)' datadir='$(datadir)' -- cd man && $(MAKE) install prefix='$(prefix)' exec_prefix='$(exec_prefix)' datarootdir='$(datarootdir)' datadir='$(datadir)' mandir='$(mandir)' - - install-strip : lib/localcharset.h force - cd libcharset && $(MAKE) install-strip prefix='$(prefix)' exec_prefix='$(exec_prefix)' libdir='$(libdir)' - cd lib && $(MAKE) install-strip prefix='$(prefix)' exec_prefix='$(exec_prefix)' libdir='$(libdir)' - cd preload && $(MAKE) install-strip prefix='$(prefix)' exec_prefix='$(exec_prefix)' libdir='$(libdir)' - cd srclib && $(MAKE) install-strip prefix='$(prefix)' exec_prefix='$(exec_prefix)' libdir='$(libdir)' -- cd src && $(MAKE) install-strip prefix='$(prefix)' exec_prefix='$(exec_prefix)' libdir='$(libdir)' - if [ ! -d $(DESTDIR)$(includedir) ] ; then $(mkinstalldirs) $(DESTDIR)$(includedir) ; fi - $(INSTALL_DATA) include/iconv.h.inst $(DESTDIR)$(includedir)/iconv.h -- cd po && $(MAKE) install-strip prefix='$(prefix)' exec_prefix='$(exec_prefix)' datarootdir='$(datarootdir)' datadir='$(datadir)' -- cd man && $(MAKE) install-strip prefix='$(prefix)' exec_prefix='$(exec_prefix)' datarootdir='$(datarootdir)' datadir='$(datadir)' mandir='$(mandir)' - - installdirs : force - cd libcharset && $(MAKE) installdirs prefix='$(prefix)' exec_prefix='$(exec_prefix)' libdir='$(libdir)' -diff --git a/build-aux/ltmain.sh b/build-aux/ltmain.sh -index 0f0a2da..53d28b3 100644 ---- a/build-aux/ltmain.sh -+++ b/build-aux/ltmain.sh -@@ -7275,7 +7275,7 @@ func_mode_link () - # -stdlib=* select c++ std lib with clang - -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ - -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \ -- -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*) -+ -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*|-fuse-ld=*) - func_quote_for_eval "$arg" - arg=$func_quote_for_eval_result - func_append compile_command " $arg" -diff --git a/libcharset/build-aux/ltmain.sh b/libcharset/build-aux/ltmain.sh -index 0f0a2da..53d28b3 100644 ---- a/libcharset/build-aux/ltmain.sh -+++ b/libcharset/build-aux/ltmain.sh -@@ -7275,7 +7275,7 @@ func_mode_link () - # -stdlib=* select c++ std lib with clang - -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ - -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \ -- -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*) -+ -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*|-fuse-ld=*) - func_quote_for_eval "$arg" - arg=$func_quote_for_eval_result - func_append compile_command " $arg" diff --git a/releng/setup-env.sh b/releng/setup-env.sh index f7a6c4b66f..b5ebfa9738 100755 --- a/releng/setup-env.sh +++ b/releng/setup-env.sh @@ -112,19 +112,19 @@ if [ -z "$FRIDA_HOST" ]; then fi if [ $host_platform = android ]; then - ndk_required_name="r20" + ndk_required=21 if [ -n "$ANDROID_NDK_ROOT" ]; then if [ -f "$ANDROID_NDK_ROOT/source.properties" ]; then ndk_installed_version=$(grep Pkg.Revision "$ANDROID_NDK_ROOT/source.properties" | awk '{ split($NF, v, "."); print v[1]; }') else ndk_installed_version=$(cut -f1 -d" " "$ANDROID_NDK_ROOT/RELEASE.TXT") fi - if [ $ndk_installed_version -ne 20 ]; then + if [ $ndk_installed_version -ne $ndk_required ]; then ( echo "" - echo "Unsupported NDK version $ndk_installed_version. Please install NDK $ndk_required_name." + echo "Unsupported NDK version $ndk_installed_version. Please install NDK r$ndk_required." echo "" - echo "Frida's SDK - the prebuilt dependencies snapshot - was compiled against $ndk_required_name," + echo "Frida's SDK - the prebuilt dependencies snapshot - was compiled against r$ndk_required," echo "and as we have observed the NDK ABI breaking over time, we ask that you install" echo "the exact same version." echo "" @@ -154,8 +154,8 @@ fi prompt_color=33 -toolchain_version=20190428 -sdk_version=20200312 +toolchain_version=20200407 +sdk_version=20200407 if [ $enable_asan = yes ]; then sdk_version="$sdk_version-asan" fi @@ -175,8 +175,6 @@ FRIDA_PREFIX_LIB="$FRIDA_PREFIX/lib" FRIDA_TOOLROOT="$FRIDA_BUILD/${frida_env_name_prefix}toolchain-${build_platform_arch}" FRIDA_SDKROOT="$FRIDA_BUILD/${frida_env_name_prefix}sdk-${host_platform_arch}" -OBJCOPY="" -OBJDUMP="" LIBTOOL="" STRIP_FLAGS="" @@ -191,6 +189,7 @@ meson_root="" meson_objc="" meson_objcpp="" +meson_linker_flavor="" meson_platform_properties=() @@ -261,42 +260,73 @@ case $host_platform in meson_host_cpu="mips64r2" ;; esac - CPP="${host_toolprefix}cpp" - CC="${host_toolprefix}gcc -static-libgcc" - CXX="${host_toolprefix}g++ -static-libgcc -static-libstdc++" - LD="${host_toolprefix}ld" - - AR="${host_toolprefix}ar" - NM="${host_toolprefix}nm" - RANLIB="${host_toolprefix}ranlib" - STRIP="${host_toolprefix}strip" - STRIP_FLAGS="--strip-all" - OBJCOPY="${host_toolprefix}objcopy" - OBJDUMP="${host_toolprefix}objdump" - CFLAGS="$host_arch_flags -ffunction-sections -fdata-sections" - LDFLAGS="$host_arch_flags -Wl,--gc-sections -Wl,-z,noexecstack" + CPP="${CPP:-${host_toolprefix}cpp}" - arch_args=$(flags_to_args "$host_arch_flags") + glibc_compat_flag="-fgnu89-inline" + libgcc_flags="-static-libgcc" + libstdcxx_flags="-static-libstdc++" + base_compiler_flags="-ffunction-sections -fdata-sections" + base_linker_flags="-Wl,--gc-sections -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now $libgcc_flags" - base_toolchain_args="$arch_args, '-static-libgcc'" - base_compiler_args="$base_toolchain_args, '-ffunction-sections', '-fdata-sections'" - base_linker_args="$base_toolchain_args, '-Wl,--gc-sections', '-Wl,-z,noexecstack'" + cc_config_flags="$libgcc_flags $glibc_compat_flag" + cxx_config_flags="$libgcc_flags $libstdcxx_flags" - meson_c="${host_toolprefix}gcc" - meson_cpp="${host_toolprefix}g++" + LD="${LD:-${host_toolprefix}ld}" + if "$LD" --version | grep -q "GNU gold"; then + cc_config_flags="$cc_config_flags -fuse-ld=gold" + cxx_config_flags="$cxx_config_flags -fuse-ld=gold" + meson_linker_flavor=gold + base_linker_flags="-Wl,--icf=all $base_linker_flags" + fi - meson_c_args="$base_compiler_args" - meson_cpp_args="$base_compiler_args, '-static-libstdc++'" + if [ -n "$CC" ]; then + eval cc=($CC) + CC="${cc[0]} $cc_config_flags" + meson_c="${cc[0]}" + else + CC="${host_toolprefix}gcc $cc_config_flags" + meson_c="${host_toolprefix}gcc" + fi + if [ -n "$CXX" ]; then + eval cxx=($CXX) + CXX="${cxx[0]} $cxx_config_flags" + meson_cpp="${cxx[0]}" + else + CXX="${host_toolprefix}g++ $cxx_config_flags" + meson_cpp="${host_toolprefix}g++" + fi + + AR="${AR:-${host_toolprefix}ar}" + NM="${NM:-${host_toolprefix}nm}" + RANLIB="${RANLIB:-${host_toolprefix}ranlib}" + STRIP="${STRIP:-${host_toolprefix}strip}" + STRIP_FLAGS="--strip-all" + OBJCOPY="${OBJCOPY:-${host_toolprefix}objcopy}" + OBJDUMP="${OBJDUMP:-${host_toolprefix}objdump}" + + CFLAGS="$host_arch_flags $base_compiler_flags" + LDFLAGS="$host_arch_flags $base_linker_flags" + + base_toolchain_args="$(flags_to_args "$host_arch_flags")" + base_compiler_args="$base_toolchain_args, $(flags_to_args "$base_compiler_flags")" + base_linker_args="$base_toolchain_args, $(flags_to_args "$base_linker_flags")" + + meson_c_args="$base_compiler_args, '$glibc_compat_flag'" + meson_cpp_args="$base_compiler_args" meson_c_link_args="$base_linker_args" - meson_cpp_link_args="$base_linker_args, '-static-libstdc++'" + meson_cpp_link_args="$base_linker_args, $(flags_to_args "$libstdcxx_flags")" ;; macos) macos_minver="10.9" macos_sdk="macosx" - macos_sdk_path="$(xcrun --sdk $macos_sdk --show-sdk-path)" + if [ -z "$MACOS_SDK_ROOT" ]; then + macos_sdk_path="$(xcrun --sdk $macos_sdk --show-sdk-path)" + else + macos_sdk_path="$MACOS_SDK_ROOT" + fi clang_cc="$(xcrun --sdk $macos_sdk -f clang)" clang_cxx="$(xcrun --sdk $macos_sdk -f clang++)" @@ -388,7 +418,11 @@ case $host_platform in ios_sdk="iphoneos" ;; esac - ios_sdk_path="$(xcrun --sdk $ios_sdk --show-sdk-path)" + if [ -z "$IOS_SDK_ROOT" ]; then + ios_sdk_path="$(xcrun --sdk $ios_sdk --show-sdk-path)" + else + ios_sdk_path="$IOS_SDK_ROOT" + fi clang_cc="$(xcrun --sdk $ios_sdk -f clang)" clang_cxx="$(xcrun --sdk $ios_sdk -f clang++)" @@ -536,6 +570,7 @@ case $host_platform in CFLAGS="$host_arch_flags -DANDROID -ffunction-sections -fdata-sections" LDFLAGS="$host_arch_flags $host_ldflags -Wl,--gc-sections -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now" + meson_linker_flavor=gold elf_cleaner=${FRIDA_ROOT}/releng/frida-elf-cleaner-${build_platform_arch} @@ -558,7 +593,11 @@ case $host_platform in base_toolchain_args="$base_toolchain_args, " fi base_compiler_args="$base_toolchain_args'-DANDROID', '-fPIC', '-ffunction-sections', '-fdata-sections'" - base_linker_args="$base_toolchain_args$(flags_to_args "$host_ldflags"), '-Wl,--gc-sections', '-Wl,-z,noexecstack', '-Wl,-z,relro', '-Wl,-z,now'" + base_linker_args="$base_toolchain_args" + if [ -n "$host_ldflags" ]; then + base_linker_args="$base_linker_args$(flags_to_args "$host_ldflags"), " + fi + base_linker_args="$base_linker_args'-Wl,--gc-sections', '-Wl,-z,noexecstack', '-Wl,-z,relro', '-Wl,-z,now'" meson_c="$meson_cc_wrapper" meson_cpp="$meson_cpp_wrapper" @@ -693,7 +732,7 @@ if [ $enable_asan = yes ]; then fi CFLAGS="-fPIC $CFLAGS" -CXXFLAGS="$CFLAGS $CXXFLAGS" +CXXFLAGS="$CFLAGS${CXXFLAGS:+ $CXXFLAGS}" if [ "$FRIDA_ENV_SDK" != 'none' ]; then version_include="-include $FRIDA_BUILD/frida-version.h" @@ -713,7 +752,7 @@ ACLOCAL="aclocal $ACLOCAL_FLAGS" CONFIG_SITE="$FRIDA_BUILD/${frida_env_name_prefix}config-${host_platform_arch}.site" VALAC="$FRIDA_BUILD/${FRIDA_ENV_NAME:-frida}-${host_platform_arch}-valac" -vala_impl="$FRIDA_TOOLROOT/bin/valac-0.46" +vala_impl="$FRIDA_TOOLROOT/bin/valac-0.50" vala_flags="--vapidir=\"$FRIDA_PREFIX/share/vala/vapi\"" if [ "$FRIDA_ENV_SDK" != 'none' ]; then vala_flags="$vala_flags --vapidir=\"$FRIDA_SDKROOT/share/vala/vapi\"" @@ -749,12 +788,12 @@ if ! grep -Eq "^$toolchain_version\$" "$FRIDA_TOOLROOT/.version" 2>/dev/null; th "$template" > "$target" done - vala_wrapper=$FRIDA_TOOLROOT/bin/valac-0.46 - vala_impl=$FRIDA_TOOLROOT/bin/valac-0.46-impl + vala_wrapper=$FRIDA_TOOLROOT/bin/valac-0.50 + vala_impl=$FRIDA_TOOLROOT/bin/valac-0.50-impl mv "$vala_wrapper" "$vala_impl" ( echo "#!/bin/sh" - echo "exec \"$vala_impl\" --target-glib=2.62 \"\$@\" --vapidir=\"$FRIDA_TOOLROOT/share/vala-0.46/vapi\"" + echo "exec \"$vala_impl\" --target-glib=2.66 \"\$@\" --vapidir=\"$FRIDA_TOOLROOT/share/vala-0.50/vapi\"" ) > "$vala_wrapper" chmod 755 "$vala_wrapper" @@ -892,14 +931,37 @@ case $host_platform in esac egrep -v "^export LD=" "$env_rc" > "$meson_env_rc" +if [ -n "$meson_linker_flavor" ]; then + ( + echo "export CC_LD=$meson_linker_flavor" + echo "export CXX_LD=$meson_linker_flavor" + ) >> $meson_env_rc + case $host_platform in + macos|ios) + ( + echo "export OBJC_LD=$meson_linker_flavor" + echo "export OBJCXX_LD=$meson_linker_flavor" + ) >> $meson_env_rc + ;; + esac +fi +if [ "$host_platform" != "$build_platform" ]; then + build_env_rc=build/${FRIDA_ENV_NAME:-frida}-meson-env-${build_platform_arch}.rc + if [ ! -f $build_env_rc ]; then + FRIDA_HOST=${build_platform_arch} releng/setup-env.sh + fi + egrep "^export (PKG_CONFIG_PATH|CC|CXX|OBJC|OBJCXX|CPPFLAGS|CFLAGS|CXXFLAGS|CC_LD|CXX_LD|OBJC_LD|OBJCXX_LD|LDFLAGS|AR)=" $build_env_rc \ + | sed -e "s,=,_FOR_BUILD=," \ + >> $meson_env_rc +fi sed \ -e "s,@frida_host_platform@,$host_platform,g" \ -e "s,@frida_host_arch@,$host_arch,g" \ -e "s,@frida_host_platform_arch@,$host_platform_arch,g" \ -e "s,@frida_prefix@,$FRIDA_PREFIX,g" \ - -e "s,@frida_optimization_flags@,$FRIDA_OPTIMIZATION_FLAGS,g" \ - -e "s,@frida_debug_flags@,$FRIDA_DEBUG_FLAGS,g" \ + -e "s,@frida_optimization_flags@,$FRIDA_ACOPTFLAGS,g" \ + -e "s,@frida_debug_flags@,$FRIDA_ACDBGFLAGS,g" \ -e "s,@frida_libc@,$libc,g" \ $releng_path/config.site.in > "$CONFIG_SITE" diff --git a/releng/v8.py b/releng/v8.py old mode 100644 new mode 100755 index 356ea6650e..9bbf0b7814 --- a/releng/v8.py +++ b/releng/v8.py @@ -1,35 +1,100 @@ -import argparse -import codecs -import os -import sys - - -def detect_version(source_dir): - with codecs.open(os.path.join(source_dir, "include", "v8-version.h"), "r", 'utf-8') as f: - lines = f.read().split("\n") - - major = extract_version("V8_MAJOR_VERSION", lines) - minor = extract_version("V8_MINOR_VERSION", lines) - build = extract_version("V8_BUILD_NUMBER", lines) - - version = "{}.{}.{}".format(major, minor, build) - api_version = "{}.0".format(major) - - return (version, api_version) - -def extract_version(define_name, lines): - return [int(line.split(" ")[-1]) for line in lines if define_name in line][0] - - -if __name__ == '__main__': - parser = argparse.ArgumentParser(description="Detect V8 version.") - parser.add_argument("source_dir", metavar="path-to-source-dir") - parser.add_argument("property_name", metavar="property", choices=["version", "api-version"]) - args = parser.parse_args() - - (version, api_version) = detect_version(args.source_dir) - - if args.property_name == "version": - sys.stdout.write(version) - else: - sys.stdout.write(api_version) +#!/usr/bin/env python3 + +import argparse +import os +import shutil +import subprocess +import sys + + +def detect_version(source_dir): + with open(os.path.join(source_dir, "include", "v8-version.h"), "r", encoding='utf-8') as f: + lines = f.read().split("\n") + + major = extract_version("V8_MAJOR_VERSION", lines) + minor = extract_version("V8_MINOR_VERSION", lines) + build = extract_version("V8_BUILD_NUMBER", lines) + + version = "{}.{}.{}".format(major, minor, build) + api_version = "{}.0".format(major) + + return (version, api_version) + +def extract_version(define_name, lines): + return [int(line.split(" ")[-1]) for line in lines if define_name in line][0] + +def patch_config_header(header_path, source_dir, build_dir, gn=None, env=None): + if gn is None: + gn = shutil.which("gn") + if gn is None: + raise ValueError("unable to find “gn”; is it on your PATH?") + + gn = os.path.abspath(gn) + + config_defines = subprocess.check_output([gn, "desc", os.path.relpath(build_dir, start=source_dir), ":v8_header_features", "defines"], + cwd=source_dir, env=env).decode('utf-8').rstrip().split("\n") + + with open(header_path, "rb") as f: + code = f.read().decode('utf-8') + + newline = "\r\n" if "\r" in code else "\n" + section_delimiter = 3 * newline + section_heading = "// Build configuration." + + top, bottom = code.split(section_delimiter, maxsplit=1) + + if bottom.startswith(section_heading): + bottom = bottom.split(section_delimiter, maxsplit=1)[1] + + lines = [section_heading] + lines += ["#define {} 1".format(d) for d in config_defines] + middle = newline.join(lines) + + code = section_delimiter.join([top, middle, bottom]) + + with open(header_path, "wb") as f: + f.write(code.encode('utf-8')) + + +if __name__ == '__main__': + parser = argparse.ArgumentParser(description="Introspect and manipulate V8 build artifacts.") + + def on_get(args): + try: + (version, api_version) = detect_version(args.source_dir) + except Exception as e: + parser.exit(1, str(e) + "\n") + + if args.property_name == "version": + sys.stdout.write(version) + else: + sys.stdout.write(api_version) + + def on_patch(args): + try: + patch_config_header(args.header_path, args.source_dir, args.build_dir, args.gn) + except Exception as e: + parser.exit(1, str(e) + "\n") + + def on_missing_command(args): + parser.print_help(file=sys.stderr) + parser.exit(2) + + parser.set_defaults(func=on_missing_command) + + subparsers = parser.add_subparsers(help="sub-command help") + + get_command = subparsers.add_parser("get", help="get a property") + get_command.add_argument("property_name", metavar="property", choices=["version", "api-version"]) + get_command.add_argument("-s", "--source-dir", type=str, metavar="path-to-source-dir", required=True) + get_command.set_defaults(func=on_get) + + patch_command = subparsers.add_parser("patch", help="patch v8config.h to add build configuration defines") + patch_command.add_argument("header_path", metavar="path-to-v8config-header") + patch_command.add_argument("-s", "--source-dir", metavar="path-to-source-dir", required=True) + patch_command.add_argument("-b", "--build-dir", metavar="path-to-build-dir", required=True) + patch_command.add_argument("-G", "--gn", metavar="path-to-gn", default=None) + patch_command.set_defaults(func=on_patch) + + args = parser.parse_args() + args.func(args) diff --git a/releng/windows-sdk.txt b/releng/windows-sdk.txt index 88df354f67..21f7784da8 100644 --- a/releng/windows-sdk.txt +++ b/releng/windows-sdk.txt @@ -1 +1 @@ -https://build.frida.re/sdk-20200312-windows-any.exe +https://build.frida.re/sdk-20200407-windows-any.exe diff --git a/releng/windows-toolchain.txt b/releng/windows-toolchain.txt index dc7bc05d52..9226dceb3d 100644 --- a/releng/windows-toolchain.txt +++ b/releng/windows-toolchain.txt @@ -1 +1 @@ -https://build.frida.re/toolchain-20190428-windows-x86.exe +https://build.frida.re/toolchain-20200407-windows-x86.exe diff --git a/releng/winenv.py b/releng/winenv.py index ca4ad3c47c..c7f56c41af 100644 --- a/releng/winenv.py +++ b/releng/winenv.py @@ -1,76 +1,76 @@ -import glob -import json -import os -import subprocess -import winreg - - -RELENG_DIR = os.path.abspath(os.path.dirname(__file__)) -ROOT_DIR = os.path.dirname(RELENG_DIR) -DEFAULT_TOOLCHAIN_DIR = os.path.join(ROOT_DIR, "build", "toolchain-windows") -BOOTSTRAP_TOOLCHAIN_DIR = os.path.join(ROOT_DIR, "build", "fts-toolchain-windows") - -cached_msvs_dir = None -cached_msvc_dir = None -cached_winxpsdk = None -cached_win10sdk = None - - -def get_msvs_installation_dir(): - global cached_msvs_dir - if cached_msvs_dir is None: - if os.path.exists(DEFAULT_TOOLCHAIN_DIR): - toolchain_dir = DEFAULT_TOOLCHAIN_DIR - else: - toolchain_dir = BOOTSTRAP_TOOLCHAIN_DIR - installations = json.loads(subprocess.check_output([ - os.path.join(toolchain_dir, "bin", "vswhere.exe"), - "-version", "15.0", - "-format", "json", - "-property", "installationPath" - ])) - if len(installations) == 0: - raise MissingDependencyError("Visual Studio 2017 is not installed") - cached_msvs_dir = installations[0]['installationPath'].rstrip("\\") - return cached_msvs_dir - -def get_msvs_version(): - return "2017" - -def get_msvc_tool_dir(): - global cached_msvc_dir - if cached_msvc_dir is None: - msvs_dir = get_msvs_installation_dir() - version = sorted(glob.glob(os.path.join(msvs_dir, "VC", "Tools", "MSVC", "*.*.*")))[-1] - cached_msvc_dir = os.path.join(msvs_dir, "VC", "Tools", "MSVC", version) - return cached_msvc_dir - -def get_winxp_sdk(): - global cached_winxpsdk - if cached_winxpsdk is None: - try: - key = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, r"SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.1A") - try: - (install_dir, _) = winreg.QueryValueEx(key, "InstallationFolder") - (version, _) = winreg.QueryValueEx(key, "ProductVersion") - cached_winxpsdk = (install_dir.rstrip("\\"), version) - finally: - winreg.CloseKey(key) - except Exception as e: - raise MissingDependencyError("Windows XP SDK is not installed") - return cached_winxpsdk - -def get_win10_sdk(): - global cached_win10sdk - if cached_win10sdk is None: - try: - key = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, r"SOFTWARE\Microsoft\Windows Kits\Installed Roots") - try: - (install_dir, _) = winreg.QueryValueEx(key, "KitsRoot10") - version = os.path.basename(sorted(glob.glob(os.path.join(install_dir, "Include", "*.*.*")))[-1]) - cached_win10sdk = (install_dir.rstrip("\\"), version) - finally: - winreg.CloseKey(key) - except Exception as e: - raise MissingDependencyError("Windows 10 SDK is not installed") - return cached_win10sdk +import glob +import json +import os +import subprocess +import winreg + + +RELENG_DIR = os.path.abspath(os.path.dirname(__file__)) +ROOT_DIR = os.path.dirname(RELENG_DIR) +DEFAULT_TOOLCHAIN_DIR = os.path.join(ROOT_DIR, "build", "toolchain-windows") +BOOTSTRAP_TOOLCHAIN_DIR = os.path.join(ROOT_DIR, "build", "fts-toolchain-windows") + +cached_msvs_dir = None +cached_msvc_dir = None +cached_winxpsdk = None +cached_win10sdk = None + + +def get_msvs_installation_dir(): + global cached_msvs_dir + if cached_msvs_dir is None: + if os.path.exists(DEFAULT_TOOLCHAIN_DIR): + toolchain_dir = DEFAULT_TOOLCHAIN_DIR + else: + toolchain_dir = BOOTSTRAP_TOOLCHAIN_DIR + installations = json.loads(subprocess.check_output([ + os.path.join(toolchain_dir, "bin", "vswhere.exe"), + "-version", "16.0", + "-format", "json", + "-property", "installationPath" + ])) + if len(installations) == 0: + raise MissingDependencyError("Visual Studio 2019 is not installed") + cached_msvs_dir = installations[0]['installationPath'].rstrip("\\") + return cached_msvs_dir + +def get_msvs_version(): + return "2019" + +def get_msvc_tool_dir(): + global cached_msvc_dir + if cached_msvc_dir is None: + msvs_dir = get_msvs_installation_dir() + version = sorted(glob.glob(os.path.join(msvs_dir, "VC", "Tools", "MSVC", "*.*.*")))[-1] + cached_msvc_dir = os.path.join(msvs_dir, "VC", "Tools", "MSVC", version) + return cached_msvc_dir + +def get_winxp_sdk(): + global cached_winxpsdk + if cached_winxpsdk is None: + try: + key = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, r"SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.1A") + try: + (install_dir, _) = winreg.QueryValueEx(key, "InstallationFolder") + (version, _) = winreg.QueryValueEx(key, "ProductVersion") + cached_winxpsdk = (install_dir.rstrip("\\"), version) + finally: + winreg.CloseKey(key) + except Exception as e: + raise MissingDependencyError("Windows XP SDK is not installed") + return cached_winxpsdk + +def get_win10_sdk(): + global cached_win10sdk + if cached_win10sdk is None: + try: + key = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, r"SOFTWARE\Microsoft\Windows Kits\Installed Roots") + try: + (install_dir, _) = winreg.QueryValueEx(key, "KitsRoot10") + version = os.path.basename(sorted(glob.glob(os.path.join(install_dir, "Include", "*.*.*")))[-1]) + cached_win10sdk = (install_dir.rstrip("\\"), version) + finally: + winreg.CloseKey(key) + except Exception as e: + raise MissingDependencyError("Windows 10 SDK is not installed") + return cached_win10sdk