Add GN target to build Debian package from regular output.
Bug: https://github.com/dart-lang/sdk/issues/26953 Cq-Include-Trybots: luci.dart.try:dart-sdk-linux-arm64-try,dart-sdk-linux-riscv64-try,dart-sdk-linux-try Change-Id: I38dfcadee836733c2e8824c2da21b9619dd2fc77 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/281307 Reviewed-by: Alexander Thomas <athom@google.com> Commit-Queue: Ryan Macnak <rmacnak@google.com>
This commit is contained in:
committed by
Commit Queue
parent
0f15e32ad3
commit
efda4aff7c
@@ -119,6 +119,9 @@ group("runtime_precompiled") {
|
||||
|
||||
group("create_sdk") {
|
||||
public_deps = [ "sdk:create_sdk" ]
|
||||
if (is_linux) {
|
||||
public_deps += [ "tools/debian_package" ]
|
||||
}
|
||||
}
|
||||
|
||||
group("create_platform_sdk") {
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
# Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file
|
||||
# for details. All rights reserved. Use of this source code is governed by a
|
||||
# BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
if (is_linux) {
|
||||
action("debian_package") {
|
||||
version = exec_script("get_version.py", [], "trim string")
|
||||
if (target_cpu == "x86" || target_cpu == "ia32") {
|
||||
debian_arch = "i386"
|
||||
lib_dir = "//buildtools/sysroot/linux/lib/i386-linux-gnu"
|
||||
} else if (target_cpu == "x64") {
|
||||
debian_arch = "amd64"
|
||||
lib_dir = "//buildtools/sysroot/linux/lib/x86_64-linux-gnu"
|
||||
} else if (target_cpu == "arm") {
|
||||
debian_arch = "armhf"
|
||||
lib_dir = "//buildtools/sysroot/linux/lib/arm-linux-gnueabihf"
|
||||
} else if (target_cpu == "arm64") {
|
||||
debian_arch = "arm64"
|
||||
lib_dir = "//buildtools/sysroot/linux/lib/aarch64-linux-gnu"
|
||||
} else if (target_cpu == "riscv64") {
|
||||
debian_arch = "riscv64"
|
||||
lib_dir = "//buildtools/sysroot/focal/lib/riscv64-linux-gnu/"
|
||||
} else {
|
||||
assert(false, "Don't know Debian name for $target_cpu")
|
||||
}
|
||||
|
||||
deps = [ "../../sdk:create_sdk" ]
|
||||
inputs = [
|
||||
"create_debian_package.py",
|
||||
"debian/compat",
|
||||
"debian/control",
|
||||
"debian/dart.install",
|
||||
"debian/dart.links",
|
||||
"debian/rules",
|
||||
"debian/source/format",
|
||||
]
|
||||
outputs = [ "$root_out_dir/dart_${version}-1_${debian_arch}.deb" ]
|
||||
script = "../../build/gn_run_binary.py"
|
||||
args = [
|
||||
"compiled_action",
|
||||
rebase_path("create_debian_package.py"),
|
||||
"--version=$version",
|
||||
"--arch=$debian_arch",
|
||||
"--lib_dir=" + rebase_path(lib_dir),
|
||||
]
|
||||
}
|
||||
}
|
||||
+69
@@ -0,0 +1,69 @@
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file
|
||||
# for details. All rights reserved. Use of this source code is governed by a
|
||||
# BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
import optparse
|
||||
import os
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
from os.path import join, split, abspath, dirname
|
||||
|
||||
sys.path.append(join(dirname(__file__), '..'))
|
||||
import utils
|
||||
|
||||
DART_DIR = abspath(join(dirname(__file__), '..', '..'))
|
||||
|
||||
|
||||
def BuildOptions():
|
||||
result = optparse.OptionParser()
|
||||
result.add_option("--version", default=None)
|
||||
result.add_option("--arch", default=None)
|
||||
result.add_option("--lib_dir", default=None)
|
||||
return result
|
||||
|
||||
|
||||
def GenerateCopyright(filename):
|
||||
with open(join(DART_DIR, 'LICENSE')) as lf:
|
||||
license_lines = lf.readlines()
|
||||
|
||||
with open(filename, 'w') as f:
|
||||
f.write('Name: dart\n')
|
||||
f.write('Maintainer: Dart Team <misc@dartlang.org>\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.
|
||||
|
||||
|
||||
def GenerateChangeLog(filename, version):
|
||||
with open(filename, 'w') as f:
|
||||
f.write('dart (%s-1) UNRELEASED; urgency=low\n' % version)
|
||||
f.write('\n')
|
||||
f.write(' * Generated file.\n')
|
||||
f.write('\n')
|
||||
f.write(' -- Dart Team <misc@dartlang.org>\n')
|
||||
|
||||
|
||||
def Main():
|
||||
parser = BuildOptions()
|
||||
(options, args) = parser.parse_args()
|
||||
|
||||
version = options.version
|
||||
versiondir = 'dart-%s' % version
|
||||
shutil.copytree(join(DART_DIR, 'tools', 'debian_package', 'debian'),
|
||||
join(versiondir, 'debian'),
|
||||
dirs_exist_ok=True)
|
||||
GenerateCopyright(join(versiondir, 'debian', 'copyright'))
|
||||
GenerateChangeLog(join(versiondir, 'debian', 'changelog'), version)
|
||||
|
||||
cmd = ['dpkg-buildpackage', '-B', '-a', options.arch, '-us', '-uc']
|
||||
env = os.environ.copy()
|
||||
env["LIB_DIR"] = options.lib_dir
|
||||
process = subprocess.check_call(cmd, cwd=versiondir, env=env)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(Main())
|
||||
@@ -0,0 +1 @@
|
||||
10
|
||||
@@ -0,0 +1,11 @@
|
||||
Source: dart
|
||||
Maintainer: Dart Team <misc@dartlang.org>
|
||||
Section: misc
|
||||
Priority: optional
|
||||
Standards-Version: 3.9.2
|
||||
Build-Depends: python3:native
|
||||
|
||||
Package: dart
|
||||
Architecture: any
|
||||
Depends: ${shlibs:Depends}, ${misc:Depends}
|
||||
Description: Dart SDK
|
||||
@@ -0,0 +1,2 @@
|
||||
debian/tmp/out/dart usr/lib
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
usr/lib/dart/bin/dart usr/bin/dart
|
||||
|
||||
Executable
+35
@@ -0,0 +1,35 @@
|
||||
#!/usr/bin/make -f
|
||||
export DH_VERBOSE = 1
|
||||
|
||||
%:
|
||||
dh $@
|
||||
|
||||
# Nop
|
||||
override_dh_auto_clean:
|
||||
|
||||
# Nop
|
||||
override_dh_auto_configure:
|
||||
|
||||
# Nop
|
||||
override_dh_auto_build:
|
||||
|
||||
# Nop
|
||||
override_dh_auto_test:
|
||||
|
||||
# Nop
|
||||
override_dh_strip:
|
||||
|
||||
# Nop
|
||||
override_dh_strip_nondeterminism:
|
||||
|
||||
# This override allows us to ignore spurious missing library errors when
|
||||
# cross-compiling.
|
||||
override_dh_shlibdeps:
|
||||
dh_shlibdeps --dpkg-shlibdeps-params=--ignore-missing-info -l "${LIB_DIR}"
|
||||
|
||||
override_dh_auto_install:
|
||||
mkdir -p debian/tmp/out
|
||||
cp -R ../dart-sdk debian/tmp/out
|
||||
mv debian/tmp/out/dart-sdk debian/tmp/out/dart
|
||||
dh_install
|
||||
dh_link
|
||||
@@ -0,0 +1 @@
|
||||
3.0 (quilt)
|
||||
Executable
+20
@@ -0,0 +1,20 @@
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file
|
||||
# for details. All rights reserved. Use of this source code is governed by a
|
||||
# BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
import sys
|
||||
from os import listdir
|
||||
from os.path import join, split, abspath, dirname
|
||||
|
||||
sys.path.append(join(dirname(__file__), '..'))
|
||||
import utils
|
||||
|
||||
|
||||
def Main():
|
||||
print(utils.GetVersion())
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(Main())
|
||||
Reference in New Issue
Block a user