Fix building Debian packages for not-x64.
TEST=ci Bug: https://github.com/dart-lang/sdk/issues/26953 Bug: https://github.com/dart-lang/sdk/issues/39280 Change-Id: I74f018928b05699335bc19318df2b70eb0ce3282 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280880 Reviewed-by: Jonas Termansen <sortie@google.com> Commit-Queue: Ryan Macnak <rmacnak@google.com> Reviewed-by: William Hesse <whesse@google.com>
This commit is contained in:
committed by
Commit Queue
parent
4947481ff6
commit
c6181a003d
@@ -23,6 +23,14 @@ HOST_OS = utils.GuessOS()
|
||||
HOST_CPUS = utils.GuessCpus()
|
||||
DART_DIR = abspath(join(dirname(__file__), '..', '..'))
|
||||
|
||||
GN_ARCH_TO_DEBIAN_ARCH = {
|
||||
"ia32": "i386",
|
||||
"x64": "amd64",
|
||||
"arm": "armhf",
|
||||
"arm64": "arm64",
|
||||
"riscv64": "riscv64",
|
||||
}
|
||||
|
||||
|
||||
def BuildOptions():
|
||||
result = optparse.OptionParser()
|
||||
@@ -35,7 +43,7 @@ def BuildOptions():
|
||||
result.add_option("-a",
|
||||
"--arch",
|
||||
help='Target architectures (comma-separated).',
|
||||
metavar='[all,ia32,x64,armhf]',
|
||||
metavar='[all,ia32,x64,arm,arm64,riscv64]',
|
||||
default='x64')
|
||||
result.add_option("-t",
|
||||
"--toolchain",
|
||||
@@ -54,7 +62,7 @@ def RunBuildPackage(opt, cwd, toolchain=None):
|
||||
process = subprocess.check_call(cmd, cwd=cwd, env=env)
|
||||
|
||||
|
||||
def BuildDebianPackage(tarball, out_dir, arch, toolchain):
|
||||
def BuildDebianPackage(tarball, out_dir, arches, toolchain):
|
||||
version = utils.GetVersion()
|
||||
tarroot = 'dart-%s' % version
|
||||
origtarname = 'dart_%s.orig.tar.gz' % version
|
||||
@@ -74,23 +82,12 @@ def BuildDebianPackage(tarball, out_dir, arch, toolchain):
|
||||
print("Building source package")
|
||||
RunBuildPackage(['-S', '-us', '-uc'], join(temp_dir, tarroot))
|
||||
|
||||
# Build 32-bit binary package.
|
||||
if 'ia32' in arch:
|
||||
print("Building i386 package")
|
||||
RunBuildPackage(['-B', '-ai386', '-us', '-uc'],
|
||||
join(temp_dir, tarroot))
|
||||
|
||||
# Build 64-bit binary package.
|
||||
if 'x64' in arch:
|
||||
print("Building amd64 package")
|
||||
RunBuildPackage(['-B', '-aamd64', '-us', '-uc'],
|
||||
join(temp_dir, tarroot))
|
||||
|
||||
# Build armhf binary package.
|
||||
if 'armhf' in arch:
|
||||
print("Building armhf package")
|
||||
RunBuildPackage(['-B', '-aarmhf', '-us', '-uc'],
|
||||
join(temp_dir, tarroot), toolchain)
|
||||
# Build binary package(s).
|
||||
for arch in arches:
|
||||
print("Building %s package" % arch)
|
||||
RunBuildPackage(
|
||||
['-B', '-a', GN_ARCH_TO_DEBIAN_ARCH[arch], '-us', '-uc'],
|
||||
join(temp_dir, tarroot))
|
||||
|
||||
# Copy the Debian package files to the build directory.
|
||||
debbase = 'dart_%s' % version
|
||||
@@ -99,21 +96,11 @@ def BuildDebianPackage(tarball, out_dir, arch, toolchain):
|
||||
'%s.orig.tar.gz' % debbase,
|
||||
'%s-1.debian.tar.xz' % debbase
|
||||
]
|
||||
i386_package = ['%s-1_i386.deb' % debbase]
|
||||
amd64_package = ['%s-1_amd64.deb' % debbase]
|
||||
armhf_package = ['%s-1_armhf.deb' % debbase]
|
||||
|
||||
for name in source_package:
|
||||
copyfile(join(temp_dir, name), join(out_dir, name))
|
||||
if 'ia32' in arch:
|
||||
for name in i386_package:
|
||||
copyfile(join(temp_dir, name), join(out_dir, name))
|
||||
if 'x64' in arch:
|
||||
for name in amd64_package:
|
||||
copyfile(join(temp_dir, name), join(out_dir, name))
|
||||
if ('armhf' in arch):
|
||||
for name in armhf_package:
|
||||
copyfile(join(temp_dir, name), join(out_dir, name))
|
||||
for arch in arches:
|
||||
name = '%s-1_%s.deb' % (debbase, GN_ARCH_TO_DEBIAN_ARCH[arch])
|
||||
copyfile(join(temp_dir, name), join(out_dir, name))
|
||||
|
||||
|
||||
def Main():
|
||||
@@ -125,7 +112,7 @@ def Main():
|
||||
out_dir = options.out_dir
|
||||
tar_filename = options.tar_filename
|
||||
if options.arch == 'all':
|
||||
options.arch = 'ia32,x64,armhf'
|
||||
options.arch = 'ia32,x64,arm,arm64,riscv64'
|
||||
arch = options.arch.split(',')
|
||||
|
||||
if not options.out_dir:
|
||||
|
||||
@@ -108,7 +108,7 @@ def GenerateCopyright(filename):
|
||||
with open(filename, 'w') as f:
|
||||
f.write('Name: dart\n')
|
||||
f.write('Maintainer: Dart Team <misc@dartlang.org>\n')
|
||||
f.write('Source: https://code.google.com/p/dart/\n')
|
||||
f.write('Source: https://dart.googlesource.com/sdk\n')
|
||||
f.write('License:\n')
|
||||
for line in license_lines:
|
||||
f.write(' %s' % line) # Line already contains trailing \n.
|
||||
|
||||
@@ -1 +1 @@
|
||||
7
|
||||
10
|
||||
|
||||
@@ -3,10 +3,9 @@ Maintainer: William Hesse <whesse@google.com>
|
||||
Section: misc
|
||||
Priority: optional
|
||||
Standards-Version: 3.9.2
|
||||
Build-Depends: debhelper (>= 9),
|
||||
python3,
|
||||
Build-Depends: debhelper (>= 10), python3:native
|
||||
|
||||
Package: dart
|
||||
Architecture: amd64
|
||||
Architecture: any
|
||||
Depends: ${shlibs:Depends}, ${misc:Depends}
|
||||
Description: Dart SDK
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
#!/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) | \
|
||||
@@ -13,32 +11,51 @@ endif
|
||||
|
||||
ifeq (amd64,$(DEB_HOST_ARCH_CPU))
|
||||
BUILD_TYPE += ReleaseX64
|
||||
BUILD_TYPE_PRODUCT += ProductX64
|
||||
ARCH += x64
|
||||
BUILD_FLAGS += --arch=x64
|
||||
LIBS_DIR := $(CURDIR)/dart/build/linux/debian_stretch_amd64-sysroot/lib/x86_64-linux-gnu
|
||||
else
|
||||
ifeq (i386,$(DEB_HOST_ARCH_CPU))
|
||||
BUILD_TYPE += ReleaseIA32
|
||||
BUILD_TYPE_PRODUCT += ProductIA32
|
||||
ARCH += ia32
|
||||
BUILD_FLAGS += --arch=ia32
|
||||
LIBS_DIR := $(CURDIR)/dart/build/linux/debian_stretch_i386-sysroot/lib/i386-linux-gnu
|
||||
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
|
||||
BUILD_FLAGS += --arch=arm
|
||||
LIBS_DIR := $(CURDIR)/dart/build/linux/debian_stretch_arm-sysroot/lib/arm-linux-gnueabihf
|
||||
else
|
||||
ifeq (arm64,$(DEB_HOST_ARCH_CPU))
|
||||
ifeq ($(DEB_BUILD_ARCH_CPU),$(DEB_HOST_ARCH_CPU))
|
||||
BUILD_TYPE += ReleaseARM64
|
||||
else
|
||||
BUILD_TYPE += ReleaseXARM64
|
||||
endif
|
||||
BUILD_FLAGS += --arch=arm64
|
||||
LIBS_DIR := $(CURDIR)/dart/build/linux/debian_stretch_arm64-sysroot/lib/aarch64-linux-gnu
|
||||
else
|
||||
ifeq (riscv64,$(DEB_HOST_ARCH_CPU))
|
||||
ifeq ($(DEB_BUILD_ARCH_CPU),$(DEB_HOST_ARCH_CPU))
|
||||
BUILD_TYPE += ReleaseRISCV64
|
||||
else
|
||||
BUILD_TYPE += ReleaseXRISCV64
|
||||
endif
|
||||
BUILD_FLAGS += --arch=riscv64 --no-clang --use-mallinfo2
|
||||
LIBS_DIR := /usr/riscv64-linux-gnu/lib
|
||||
else
|
||||
$(error unsupported target arch '$(DEB_HOST_ARCH_CPU)')
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
# Verbose?
|
||||
ifeq (1,$(DH_VERBOSE))
|
||||
BUILD_ARGS += V=1
|
||||
BUILD_FLAGS += --verbose
|
||||
endif
|
||||
|
||||
%:
|
||||
@@ -58,7 +75,7 @@ override_dh_auto_configure:
|
||||
override_dh_auto_build:
|
||||
cd dart; \
|
||||
python3 tools/build.py --no-goma --mode release \
|
||||
--arch $(ARCH) $(TOOLCHAIN) create_sdk; \
|
||||
$(BUILD_FLAGS) $(TOOLCHAIN) create_sdk; \
|
||||
cd ..
|
||||
|
||||
# Building the Dart SDK will already strip all binaries.
|
||||
@@ -67,7 +84,7 @@ 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
|
||||
dh_shlibdeps --dpkg-shlibdeps-params=--ignore-missing-info -l $(LIBS_DIR)
|
||||
|
||||
override_dh_auto_install:
|
||||
mkdir -p debian/tmp/out
|
||||
|
||||
Reference in New Issue
Block a user