dart-sdk/tools/linux_dist_support/debian/rules
Martin Kustermann 168539d61d Reland "[vm] Build dart2native dependencies with the normal "create_sdk" target"
The flutter engine DEPS got new icu/boringssl so this CL can safely
land and roll into engine. A small change is made in Patchset 1..3.

This removes special logic for creating the `dart-sdk` we distribute
which used to build release and product mode and copied some binaries
from the latter into the former, before the SDK was actuallly ready to
test and distribute.

This changes the GN build rules to build the necessary
gen_snapshot/dart_precompiled_runtime product binaries during the normal
release build.

Normally during --mode=product builds the global build config in
//build/config/BUILDCONFIG.gn will set `-fvisibility=false`.

=> Doing so results in much smaller binaries - because only explicitly
   exported symbols are visible, the rest can be tree shaken by the linker.

Since we are building --mode=release, the `-fvisibility=false` will not
be set. In order to set the flag for the 2 special product-mode binaries
we need to add -fvisibility=hidden manually, in:

  * dart_product_config: Which is used for compiling VM sources.
  * 3rd party double-conversion library
  * 3rd party boringssl library
  * 3rd party icu library

The upstream CLs are:

  * BoringSSL: https://dart-review.googlesource.com/c/boringssl_gen/+/150482
  * ICU: https://chromium-review.googlesource.com/c/chromium/deps/icu/+/2236407

Issue https://github.com/dart-lang/sdk/issues/42230

Change-Id: I8d9b37acbb5eb94e44d97652f838948a946fd372
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151505
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2020-06-17 16:12:26 +00:00

77 lines
1.7 KiB
Makefile
Executable file

#!/usr/bin/make -f
export DH_VERBOSE = 1
AOT_SUPPORTED_ARCHS := amd64 arm
# Use DEB_BUILD_OPTIONS's parallel=n option (see Policy 4.9.1)
ifneq (,$(findstring parallel,$(DEB_BUILD_OPTIONS)))
PARALLEL_JOBS := $(shell echo $(DEB_BUILD_OPTIONS) | \
sed -e 's/.*parallel=\([0-9]\+\).*/\1/')
else
PARALLEL_JOBS := 1
endif
ifeq (amd64,$(DEB_HOST_ARCH_CPU))
BUILD_TYPE += ReleaseX64
BUILD_TYPE_PRODUCT += ProductX64
ARCH += x64
else
ifeq (i386,$(DEB_HOST_ARCH_CPU))
BUILD_TYPE += ReleaseIA32
BUILD_TYPE_PRODUCT += ProductIA32
ARCH += ia32
else
ifeq (arm,$(DEB_HOST_ARCH_CPU))
ifeq ($(DEB_BUILD_ARCH_CPU),$(DEB_HOST_ARCH_CPU))
BUILD_TYPE += ReleaseARM
BUILD_TYPE_PRODUCT += ProductARM
else
BUILD_TYPE += ReleaseXARM
BUILD_TYPE_PRODUCT += ProductXARM
endif
ARCH += arm
else
$(error unsupported target arch '$(DEB_HOST_ARCH_CPU)')
endif
endif
endif
# Verbose?
ifeq (1,$(DH_VERBOSE))
BUILD_ARGS += V=1
endif
%:
dh $@
override_dh_auto_clean:
echo $(DEB_BUILD_OPTIONS)
rm -fr dart/out dart/Makefile
find . -name *.tmp -execdir rm -f {} \;
find . -name *.pyc -execdir rm -f {} \;
find . -name *.mk -execdir rm -f {} \;
find . -name *.Makefile -execdir rm -f {} \;
override_dh_auto_configure:
python dart/tools/generate_buildfiles.py
override_dh_auto_build:
cd dart; \
python tools/build.py -v -m release -a $(ARCH) $(TOOLCHAIN) create_sdk; \
cd ..
# Building the Dart SDK will already strip all binaries.
override_dh_strip:
# This override allows us to ignore spurious missing library errors when
# cross-compiling.
override_dh_shlibdeps:
dh_shlibdeps --dpkg-shlibdeps-params=--ignore-missing-info
override_dh_auto_install:
mkdir -p debian/tmp/out
cp -R dart/out/$(BUILD_TYPE)/dart-sdk debian/tmp/out
mv debian/tmp/out/dart-sdk debian/tmp/out/dart
dh_install
dh_link