diff --git a/.github/workflows/build-ubuntu-debs.yaml b/.github/workflows/build-ubuntu-debs.yaml new file mode 100644 index 00000000..d056abf6 --- /dev/null +++ b/.github/workflows/build-ubuntu-debs.yaml @@ -0,0 +1,50 @@ +name: Build signed src package for Launchpad binary build & PPA distrib +on: + push: + tags: + - 'v[0-9]+.[0-9]+.[0-9]+' + +jobs: + build-ubuntu-packages: + strategy: + matrix: + os: [{version: ubuntu-20.04, codename: focal}, {version: ubuntu-22.04, codename: jammy}] + runs-on: ${{ matrix.os.version }} + environment: swiftlang-ppa + steps: + - name: Import GPG Key + uses: crazy-max/ghaction-import-gpg@v5 + with: + gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} + + - name: Checkout + uses: actions/checkout@v3 + + - name: Install build dependencies + run: | + sudo apt install -y --no-install-recommends devscripts dpkg-dev dput equivs rsync + + - name: Build source package + working-directory: platforms/Linux/DEB/Ubuntu/${{ matrix.os.codename }} + run: | + sudo mkdir -p /output + sudo chown $USER /output + bash ./build_deb.sh -s + + - name: Sign source package + working-directory: /output + run: | + debsign -k $DEBSIGN_KEYID swiftlang_*_source.changes + env: + DEBEMAIL: ${{ secrets.DEBEMAIL }} + DEBFULLNAME: ${{ secrets.DEBFULLNAME }} + DEBSIGN_KEYID: ${{secrets.DEBSIGN_KEYID }} + + - name: Copy dput configuration in place + working-directory: platforms/Linux/DEB/Ubuntu + run: cp .dput.cf ~/.dput.cf + + - name: Upload to Launchpad for binary build + working-directory: /output + run: dput ppa:swiftlang/swiftlang swiftlang_*_source.changes + diff --git a/platforms/Linux/DEB/Shared/build_deb.sh b/platforms/Linux/DEB/Shared/build_deb.sh index da865eed..a4a13585 100755 --- a/platforms/Linux/DEB/Shared/build_deb.sh +++ b/platforms/Linux/DEB/Shared/build_deb.sh @@ -10,37 +10,66 @@ set -eux +source_only_pkg=FALSE # build binary deb by default +while getopts ":s" option; do + case $option in + s) + source_only_pkg=TRUE + ;; + esac +done + here="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" # load version definitions . ${here}/versions.sh -# working in /tmp since docker file sharing makes this very slow to do dirctly on the share +# working in /tmp since docker file sharing makes this very slow to do directly on the share staging_dir=/tmp/swift-deb-builder package_dir=${staging_dir}/swiftlang-${debversion} # clean rm -rf ${package_dir} && mkdir -p ${package_dir} -# copy control files to pakcage build directory -cp -r ${here}/debian ${package_dir}/ -cp -r ${package_dir}/debian/control.in ${package_dir}/debian/control +# use rsync to copy control, rules, patches files to package build directory, +# including relative symlink targets +rsync --archive --copy-links ${here}/debian ${package_dir}/ +cp ${package_dir}/debian/control.in ${package_dir}/debian/control # build the source package ${here}/build_source_package.sh ${staging_dir} # install the build dependencies cd ${staging_dir} -mk-build-deps --install ${package_dir}/debian/control.in --tool 'apt-get -y -o Debug::pkgProblemResolver=yes --no-install-recommends' + +if [ -f /.dockerenv ]; then + root_cmd="" # no --root-cmd assumed needed when executing in container +else + root_cmd="--root-cmd=sudo" +fi + +mk-build-deps --install ${package_dir}/debian/control ${root_cmd} --remove --tool 'apt-get -y -o Debug::pkgProblemResolver=yes --no-install-recommends' + # build the installable package # TODO: add signing key information cd ${package_dir} -DEB_BUILD_OPTIONS=parallel=64 debuild + +if [ "$source_only_pkg" == "TRUE" ]; then + DEB_BUILD_OPTIONS=parallel=64 debuild -uc -us -sa -S +else + DEB_BUILD_OPTIONS=parallel=64 debuild +fi # copy the final packages to /output cd ${staging_dir} -cp *.deb /output/ -cp *.ddeb /output/ + +if [ "$source_only_pkg" == "FALSE" ]; then + cp *.deb /output/ + cp *.ddeb /output/ +fi + cp *.dsc /output/ cp *.tar.* /output/ +cp *.changes /output/ +cp *.buildinfo /output/ diff --git a/platforms/Linux/DEB/Shared/versions.sh b/platforms/Linux/DEB/Shared/versions.sh index 89ea0aab..d7ebdf13 100644 --- a/platforms/Linux/DEB/Shared/versions.sh +++ b/platforms/Linux/DEB/Shared/versions.sh @@ -1,10 +1,10 @@ #!/bin/sh -debversion=5.7.1 +debversion=5.7.2 -swift_version=5.7.1-RELEASE +swift_version=5.7.2-RELEASE icu_version=65-1 -yams_version=4.0.2 +yams_version=5.0.1 swift_argument_parser_version=1.0.3 swift_crypto_version=1.1.5 ninja_version=1.10.2 diff --git a/platforms/Linux/DEB/Ubuntu/.dput.cf b/platforms/Linux/DEB/Ubuntu/.dput.cf new file mode 100644 index 00000000..85a09591 --- /dev/null +++ b/platforms/Linux/DEB/Ubuntu/.dput.cf @@ -0,0 +1,7 @@ +[swiftlang] +fqdn = ppa.launchpad.net +method = sftp +incoming = ~swiftlang/ubuntu/swiftlang/ +login = swiftlang-uploader +allow_unsigned_uploads = 0 + diff --git a/platforms/Linux/DEB/Ubuntu/bionic/README.md b/platforms/Linux/DEB/Ubuntu/bionic/README.md deleted file mode 100644 index 5da2f6c8..00000000 --- a/platforms/Linux/DEB/Ubuntu/bionic/README.md +++ /dev/null @@ -1 +0,0 @@ -## bionic diff --git a/platforms/Linux/DEB/Ubuntu/focal/debian/changelog b/platforms/Linux/DEB/Ubuntu/focal/debian/changelog index 8d5d499c..69aa8af1 100644 --- a/platforms/Linux/DEB/Ubuntu/focal/debian/changelog +++ b/platforms/Linux/DEB/Ubuntu/focal/debian/changelog @@ -1,3 +1,9 @@ +swiftlang (5.7.2-0~focal5) focal; urgency=medium + + * Replaces `swiftlang` + `swiftlang-X.Y.Z` packages with `libswiftlang-X.Y.Z`, `libswiftlang-X.Y.Z-dev`, `swiftlang-X.Y.Z-bin` and meta-package `swiftlang`. + + -- Matias Piipari Tue, 6 Dec 2022 15:53:00 +0200 + swiftlang (5.6.0-1) focal; urgency=medium * Debian packaging introduction for Swift 5.6. diff --git a/platforms/Linux/DEB/Ubuntu/focal/debian/control.in b/platforms/Linux/DEB/Ubuntu/focal/debian/control.in index b791951f..be108765 100644 --- a/platforms/Linux/DEB/Ubuntu/focal/debian/control.in +++ b/platforms/Linux/DEB/Ubuntu/focal/debian/control.in @@ -3,45 +3,46 @@ Section: devel Priority: optional Maintainer: Swift Maintainers Build-Depends: debhelper-compat (= 12), devscripts, - clang, cmake, git, icu-devtools, ninja-build, pkg-config, - libcurl4-openssl-dev, libedit-dev, libicu-dev, libncurses5-dev, - libpython3-dev, libsqlite3-dev, libxml2-dev, - python, python-six, python2-dev, python3-six, python3-distutils, python3-psutil, - rsync, swig, systemtap-sdt-dev, tzdata, unzip, uuid-dev -Standards-Version: 4.4.1 + clang, cmake, git, icu-devtools, ninja-build, pkg-config, + libcurl4-openssl-dev, libedit-dev, libicu-dev, libncurses5-dev, + libpython3-dev, libsqlite3-dev, libxml2-dev, + python, python-six, python2-dev, python3-six, python3-distutils, python3-psutil, + rsync, swig, systemtap-sdt-dev, tzdata, unzip, uuid-dev +Standards-Version: 4.6.1 Homepage: https://www.swift.org -Package: swiftlang -Architecture: all -Depends: swiftlang-x.y.z, ${misc:Depends} -Description: Swift programming language - Swift is a general-purpose programming language built using - a modern approach to safety, performance, and software design - patterns. - . - The goal of the Swift project is to create the best available - language for uses ranging from systems programming, to mobile - and desktop apps, scaling up to cloud services. Most - importantly, Swift is designed to make writing and maintaining - correct programs easier for the developer. - . - This package contains the convenience symlinks for the latest - version of Swift. +Package: libswiftlang-x.y.z +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: Runtime libraries for the Swift programming language + +Package: libswiftlang-x.y.z-dev +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends}, + libc6-dev, libcurl4-openssl-dev, libgcc-9-dev, libstdc++-9-dev, libxml2-dev, + libz3-dev, uuid-dev, zlib1g-dev +Description: Headers, static libraries for the Swift programming language -Package: swiftlang-x.y.z -Architecture: amd64 arm64 +Package: swiftlang-x.y.z-bin +Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends}, - libc6-dev, libcurl4-openssl-dev, libgcc-9-dev, libstdc++-9-dev, libxml2-dev, - libz3-dev, uuid-dev, zlib1g-dev, - binutils, git, pkg-config, tzdata, unzip - python3 -Description: Swift programming language, release x.y.z - Swift is a general-purpose programming language built using - a modern approach to safety, performance, and software design - patterns. - . - The goal of the Swift project is to create the best available - language for uses ranging from systems programming, to mobile - and desktop apps, scaling up to cloud services. Most - importantly, Swift is designed to make writing and maintaining - correct programs easier for the developer. + libswiftlang-x.y.z, libswiftlang-x.y.z-dev, + binutils, git, pkg-config, tzdata, unzip, + python3 +Description: Swift programming language + Swift is a general-purpose programming language built using + a modern approach to safety, performance, and software design + patterns. + The goal of the Swift project is to create the best available + language for uses ranging from systems programming, to mobile + and desktop apps, scaling up to cloud services. Most + importantly, Swift is designed to make writing and maintaining + correct programs easier for the developer. + This package contains the convenience symlinks for the latest + version of Swift. + +Package: swiftlang +Architecture: any +Depends: + libswiftlang-x.y.z, libswiftlang-x.y.z-dev, swiftlang-x.y.z-bin +Description: Virtual package that provides the most recent version of the Swift programming language \ No newline at end of file diff --git a/platforms/Linux/DEB/Ubuntu/focal/debian/libswiftlang-dev.install.in b/platforms/Linux/DEB/Ubuntu/focal/debian/libswiftlang-dev.install.in new file mode 120000 index 00000000..9ec6117d --- /dev/null +++ b/platforms/Linux/DEB/Ubuntu/focal/debian/libswiftlang-dev.install.in @@ -0,0 +1 @@ +../../shared/debian/libswiftlang-dev.install.in \ No newline at end of file diff --git a/platforms/Linux/DEB/Ubuntu/focal/debian/libswiftlang.install.in b/platforms/Linux/DEB/Ubuntu/focal/debian/libswiftlang.install.in new file mode 120000 index 00000000..c2076ad2 --- /dev/null +++ b/platforms/Linux/DEB/Ubuntu/focal/debian/libswiftlang.install.in @@ -0,0 +1 @@ +../../shared/debian/libswiftlang.install.in \ No newline at end of file diff --git a/platforms/Linux/DEB/Ubuntu/focal/debian/patches/build-preset-install-dir b/platforms/Linux/DEB/Ubuntu/focal/debian/patches/build-preset-install-dir deleted file mode 100644 index a262cc95..00000000 --- a/platforms/Linux/DEB/Ubuntu/focal/debian/patches/build-preset-install-dir +++ /dev/null @@ -1,18 +0,0 @@ -Description: Make target installation directory a command line option - Use a variable for the install prefix, so we can specify it at build - time on the command line. -Author: Julien Blache - -Index: swiftlang-5.6.3/swift/utils/build-presets.ini -=================================================================== ---- swiftlang-5.6.3.orig/swift/utils/build-presets.ini -+++ swiftlang-5.6.3/swift/utils/build-presets.ini -@@ -831,7 +831,7 @@ install-swiftpm - install-swift-driver - install-xctest - install-libicu --install-prefix=/usr -+install-prefix=%(install_prefix)s - install-libcxx - install-sourcekit-lsp - install-swiftdocc diff --git a/platforms/Linux/DEB/Ubuntu/focal/debian/patches/build-preset-install-dir b/platforms/Linux/DEB/Ubuntu/focal/debian/patches/build-preset-install-dir new file mode 120000 index 00000000..386f0a36 --- /dev/null +++ b/platforms/Linux/DEB/Ubuntu/focal/debian/patches/build-preset-install-dir @@ -0,0 +1 @@ +../../../shared/debian/patches/build-preset-install-dir \ No newline at end of file diff --git a/platforms/Linux/DEB/Ubuntu/focal/debian/patches/cmake_parallel_bootstrap b/platforms/Linux/DEB/Ubuntu/focal/debian/patches/cmake_parallel_bootstrap deleted file mode 100644 index 99a4c097..00000000 --- a/platforms/Linux/DEB/Ubuntu/focal/debian/patches/cmake_parallel_bootstrap +++ /dev/null @@ -1,21 +0,0 @@ -Description: Enable parallel boostrap for CMake - CMake's bootstrap can be parallelized, but wasn't. -Author: Julien Blache - -Index: swiftlang-5.6.3/swift/utils/swift_build_support/swift_build_support/cmake.py -=================================================================== ---- swiftlang-5.6.3.orig/swift/utils/swift_build_support/swift_build_support/cmake.py -+++ swiftlang-5.6.3/swift/utils/swift_build_support/swift_build_support/cmake.py -@@ -267,8 +267,10 @@ class CMake(object): - - cwd = os.getcwd() - os.chdir(cmake_build_dir) -- shell.call_without_sleeping([cmake_bootstrap, '--no-qt-gui', '--', -- '-DCMAKE_USE_OPENSSL=OFF'], echo=True) -+ shell.call_without_sleeping([cmake_bootstrap, '--no-qt-gui', -+ '--parallel=%s' % self.args.build_jobs, -+ '--', '-DCMAKE_USE_OPENSSL=OFF'], -+ echo=True) - shell.call_without_sleeping(['make', '-j%s' % self.args.build_jobs], - echo=True) - os.chdir(cwd) diff --git a/platforms/Linux/DEB/Ubuntu/focal/debian/patches/cmake_parallel_bootstrap b/platforms/Linux/DEB/Ubuntu/focal/debian/patches/cmake_parallel_bootstrap new file mode 120000 index 00000000..535af1dc --- /dev/null +++ b/platforms/Linux/DEB/Ubuntu/focal/debian/patches/cmake_parallel_bootstrap @@ -0,0 +1 @@ +../../../shared/debian/patches/cmake_parallel_bootstrap \ No newline at end of file diff --git a/platforms/Linux/DEB/Ubuntu/focal/debian/patches/fix-integration-tests-package-path b/platforms/Linux/DEB/Ubuntu/focal/debian/patches/fix-integration-tests-package-path deleted file mode 100644 index 254fbf1d..00000000 --- a/platforms/Linux/DEB/Ubuntu/focal/debian/patches/fix-integration-tests-package-path +++ /dev/null @@ -1,110 +0,0 @@ -Description: Fix integration tests to use correct package path - Remove hardcoded usr paths and pass the correct package path to - the tests. -Author: Julien Blache - -Index: swiftlang-5.6.3/swift-integration-tests/lit.cfg -=================================================================== ---- swiftlang-5.6.3.orig/swift-integration-tests/lit.cfg -+++ swiftlang-5.6.3/swift-integration-tests/lit.cfg -@@ -175,31 +175,31 @@ else: - - swift_path = lit_config.params.get( - "swift", -- os.path.join(package_path, "usr", "bin", "swift")) -+ os.path.join(package_path, "bin", "swift")) - lit_config.note("testing using 'swift': %r" % (swift_path,)) - - swiftc_path = lit_config.params.get( - "swiftc", -- os.path.join(package_path, "usr", "bin", "swiftc")) -+ os.path.join(package_path, "bin", "swiftc")) - lit_config.note("testing using 'swiftc': %r" % (swiftc_path,)) - - lldb_path = lit_config.params.get( - "lldb", -- os.path.join(package_path, "usr", "bin", "lldb")) -+ os.path.join(package_path, "bin", "lldb")) - lit_config.note("testing using 'lldb': {}".format(lldb_path)) - - repl_swift_dummy_path = lit_config.params.get( - "repl_swift", -- os.path.join(package_path, "usr", "bin", "repl_swift")) -+ os.path.join(package_path, "bin", "repl_swift")) - lit_config.note("testing using 'repl_swift': {}".format(repl_swift_dummy_path)) - - sourcekit_lsp_path = lit_config.params.get( - "sourcekit-lsp", -- os.path.join(package_path, "usr", "bin", "sourcekit-lsp")) -+ os.path.join(package_path, "bin", "sourcekit-lsp")) - - docc_path = lit_config.params.get( - "docc", -- os.path.join(package_path, "usr", "bin", "docc")) -+ os.path.join(package_path, "bin", "docc")) - lit_config.note("testing using 'docc': {}".format(docc_path)) - - # Verify they exist. -Index: swiftlang-5.6.3/swift-integration-tests/test-snapshot-binaries/test-rpath-linux.py -=================================================================== ---- swiftlang-5.6.3.orig/swift-integration-tests/test-snapshot-binaries/test-rpath-linux.py -+++ swiftlang-5.6.3/swift-integration-tests/test-snapshot-binaries/test-rpath-linux.py -@@ -4,26 +4,26 @@ - # CHECK: {{.*}} {{\(RPATH\)|\(RUNPATH\)}} {{.*}}$ORIGIN/../lib/swift/linux - # - # Tests that DT_RUNPATH is correct for the Swift stdlib and other libraries on Linux. --# RUN: %{readelf} -d %{package_path}/usr/lib/swift/linux/libswiftCore.so | %{FileCheck} --check-prefix CHECK-CORE %s -+# RUN: %{readelf} -d %{package_path}/lib/swift/linux/libswiftCore.so | %{FileCheck} --check-prefix CHECK-CORE %s - # CHECK-CORE-NOT: {{.*}} {{\(RPATH\)|\(RUNPATH\)}} {{.*}}:/usr/lib/swift/linux - # --# RUN: %{readelf} -d %{package_path}/usr/lib/libsourcekitdInProc.so | %{FileCheck} --check-prefix CHECK-SK %s -+# RUN: %{readelf} -d %{package_path}/lib/libsourcekitdInProc.so | %{FileCheck} --check-prefix CHECK-SK %s - # CHECK-SK-NOT: {{.*}} {{\(RPATH\)|\(RUNPATH\)}} {{.*}}:/usr/lib/swift/linux - # --# RUN: %{readelf} -d %{package_path}/usr/lib/swift/linux/libswiftRemoteMirror.so | %{FileCheck} --check-prefix CHECK-RM %s -+# RUN: %{readelf} -d %{package_path}/lib/swift/linux/libswiftRemoteMirror.so | %{FileCheck} --check-prefix CHECK-RM %s - # CHECK-RM-NOT: {{.*}} {{\(RPATH\)|\(RUNPATH\)}} {{.*}}:/usr/lib/swift/linux - # --# RUN: %{readelf} -d %{package_path}/usr/lib/swift/linux/libswift_Differentiation.so | %{FileCheck} --check-prefix CHECK-SD %s -+# RUN: %{readelf} -d %{package_path}/lib/swift/linux/libswift_Differentiation.so | %{FileCheck} --check-prefix CHECK-SD %s - # CHECK-SD-NOT: {{.*}} {{\(RPATH\)|\(RUNPATH\)}} {{.*}}:/usr/lib/swift/linux - # --# RUN: %{readelf} -d %{package_path}/usr/lib/swift/linux/lib_InternalSwiftSyntaxParser.so | %{FileCheck} --check-prefix CHECK-SP %s -+# RUN: %{readelf} -d %{package_path}/lib/swift/linux/lib_InternalSwiftSyntaxParser.so | %{FileCheck} --check-prefix CHECK-SP %s - # CHECK-SP-NOT: {{.*}} {{\(RPATH\)|\(RUNPATH\)}} {{.*}}:/usr/lib/swift/linux - # --# RUN: %{readelf} -d %{package_path}/usr/lib/swift/linux/libswiftGlibc.so | %{FileCheck} --check-prefix CHECK-SG %s -+# RUN: %{readelf} -d %{package_path}/lib/swift/linux/libswiftGlibc.so | %{FileCheck} --check-prefix CHECK-SG %s - # CHECK-SG-NOT: {{.*}} {{\(RPATH\)|\(RUNPATH\)}} {{.*}}:/usr/lib/swift/linux - # --# RUN: %{readelf} -d %{package_path}/usr/lib/swift/linux/libswiftSwiftOnoneSupport.so | %{FileCheck} --check-prefix CHECK-SON %s -+# RUN: %{readelf} -d %{package_path}/lib/swift/linux/libswiftSwiftOnoneSupport.so | %{FileCheck} --check-prefix CHECK-SON %s - # CHECK-SON-NOT: {{.*}} {{\(RPATH\)|\(RUNPATH\)}} {{.*}}:/usr/lib/swift/linux - # --# RUN: %{readelf} -d %{package_path}/usr/lib/libswiftDemangle.so | %{FileCheck} --check-prefix CHECK-SDE %s -+# RUN: %{readelf} -d %{package_path}/lib/libswiftDemangle.so | %{FileCheck} --check-prefix CHECK-SDE %s - # CHECK-SDE-NOT: {{.*}} {{\(RPATH\)|\(RUNPATH\)}} {{.*}}:/usr/lib/swift/linux -Index: swiftlang-5.6.3/swift/utils/build-script-impl -=================================================================== ---- swiftlang-5.6.3.orig/swift/utils/build-script-impl -+++ swiftlang-5.6.3/swift/utils/build-script-impl -@@ -3463,8 +3463,10 @@ function build_and_test_installable_pack - - if [[ "${host}" == "macosx-"* ]] || [[ "${host}" == "merged-hosts" ]]; then - PKG_TESTS_SANDBOX="${PKG_TESTS_SANDBOX_PARENT}"/"${TOOLCHAIN_PREFIX}" -+ PKG_TESTS_PKG_DIR="${PKG_TESTS_SANDBOX}" - else # Linux - PKG_TESTS_SANDBOX="${PKG_TESTS_SANDBOX_PARENT}" -+ PKG_TESTS_PKG_DIR="${PKG_TESTS_SANDBOX}/${host_install_prefix}" - fi - - LIT_EXECUTABLE_PATH="${LLVM_SOURCE_DIR}/utils/lit/lit.py" -@@ -3479,7 +3481,7 @@ function build_and_test_installable_pack - TIMEOUT_ARGS=--timeout=1200 # 20 minutes - fi - with_pushd "${PKG_TESTS_SOURCE_DIR}" \ -- call python3 "${LIT_EXECUTABLE_PATH}" . -sv --param package-path="${PKG_TESTS_SANDBOX}" --param test-exec-root="${PKG_TESTS_TEMPS}" --param llvm-bin-dir="${LLVM_BIN_DIR}" ${TIMEOUT_ARGS} -+ call python3 "${LIT_EXECUTABLE_PATH}" . -sv --param package-path="${PKG_TESTS_PKG_DIR}" --param test-exec-root="${PKG_TESTS_TEMPS}" --param llvm-bin-dir="${LLVM_BIN_DIR}" ${TIMEOUT_ARGS} - fi - fi - } diff --git a/platforms/Linux/DEB/Ubuntu/focal/debian/patches/fix-integration-tests-package-path b/platforms/Linux/DEB/Ubuntu/focal/debian/patches/fix-integration-tests-package-path new file mode 120000 index 00000000..5d29cd33 --- /dev/null +++ b/platforms/Linux/DEB/Ubuntu/focal/debian/patches/fix-integration-tests-package-path @@ -0,0 +1 @@ +../../../shared/debian/patches/fix-integration-tests-package-path \ No newline at end of file diff --git a/platforms/Linux/DEB/Ubuntu/focal/debian/patches/fix-toolchain-path b/platforms/Linux/DEB/Ubuntu/focal/debian/patches/fix-toolchain-path deleted file mode 100644 index 82a49415..00000000 --- a/platforms/Linux/DEB/Ubuntu/focal/debian/patches/fix-toolchain-path +++ /dev/null @@ -1,44 +0,0 @@ -Description: Fix toolchain path for build-script-helper.py - Make sure the correct path is passed to the script, and remove - assumption that /usr is used. -Author: Julien Blache - -Index: swiftlang-5.6.3/swift/benchmark/scripts/build_script_helper.py -=================================================================== ---- swiftlang-5.6.3.orig/swift/benchmark/scripts/build_script_helper.py -+++ swiftlang-5.6.3/swift/benchmark/scripts/build_script_helper.py -@@ -53,7 +53,7 @@ def main(): - if not os.path.isdir(bin_dir): - os.makedirs(bin_dir) - -- swiftbuild_path = os.path.join(args.toolchain, "usr", "bin", "swift-build") -+ swiftbuild_path = os.path.join(args.toolchain, "bin", "swift-build") - perform_build(args, swiftbuild_path, "debug", "Benchmark_Onone", "-Onone") - perform_build(args, swiftbuild_path, "release", "Benchmark_Osize", "-Osize") - perform_build(args, swiftbuild_path, "release", "Benchmark_O", "-O") -Index: swiftlang-5.6.3/swift/utils/swift_build_support/swift_build_support/products/benchmarks.py -=================================================================== ---- swiftlang-5.6.3.orig/swift/utils/swift_build_support/swift_build_support/products/benchmarks.py -+++ swiftlang-5.6.3/swift/utils/swift_build_support/swift_build_support/products/benchmarks.py -@@ -100,13 +100,17 @@ class Benchmarks(product.Product): - - - def _get_toolchain_path(host_target, product, args): -- # TODO check if we should prefer using product.install_toolchain_path - # this logic initially was inside run_build_script_helper - # and was factored out so it can be used in testing as well - -- toolchain_path = swiftpm.SwiftPM.get_install_destdir(args, -- host_target, -- product.build_dir) -+ install_destdir = args.install_destdir -+ if swiftpm.SwiftPM.has_cross_compile_hosts(args): -+ install_destdir = swiftpm.SwiftPM.get_install_destdir(args, -+ host_target, -+ product.build_dir) -+ toolchain_path = targets.toolchain_path(install_destdir, -+ args.install_prefix) -+ - if platform.system() == 'Darwin': - # The prefix is an absolute path, so concatenate without os.path. - toolchain_path += \ diff --git a/platforms/Linux/DEB/Ubuntu/focal/debian/patches/fix-toolchain-path b/platforms/Linux/DEB/Ubuntu/focal/debian/patches/fix-toolchain-path new file mode 120000 index 00000000..596321a9 --- /dev/null +++ b/platforms/Linux/DEB/Ubuntu/focal/debian/patches/fix-toolchain-path @@ -0,0 +1 @@ +../../../shared/debian/patches/fix-toolchain-path \ No newline at end of file diff --git a/platforms/Linux/DEB/Ubuntu/focal/debian/patches/python3_hwasan_symbolize b/platforms/Linux/DEB/Ubuntu/focal/debian/patches/python3_hwasan_symbolize deleted file mode 100644 index e9b44283..00000000 --- a/platforms/Linux/DEB/Ubuntu/focal/debian/patches/python3_hwasan_symbolize +++ /dev/null @@ -1,14 +0,0 @@ -Description: Fix hwasan_symbolize to call python3 - On Ubuntu, /usr/bin/python is still python 2.x. -Author: Julien Blache - -Index: swiftlang-5.6.3/llvm-project/compiler-rt/lib/hwasan/scripts/hwasan_symbolize -=================================================================== ---- swiftlang-5.6.3.orig/llvm-project/compiler-rt/lib/hwasan/scripts/hwasan_symbolize -+++ swiftlang-5.6.3/llvm-project/compiler-rt/lib/hwasan/scripts/hwasan_symbolize -@@ -1,4 +1,4 @@ --#!/usr/bin/env python -+#!/usr/bin/env python3 - #===- lib/hwasan/scripts/hwasan_symbolize ----------------------------------===# - # - # Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. diff --git a/platforms/Linux/DEB/Ubuntu/focal/debian/patches/python3_hwasan_symbolize b/platforms/Linux/DEB/Ubuntu/focal/debian/patches/python3_hwasan_symbolize new file mode 120000 index 00000000..5736d8f4 --- /dev/null +++ b/platforms/Linux/DEB/Ubuntu/focal/debian/patches/python3_hwasan_symbolize @@ -0,0 +1 @@ +../../../shared/debian/patches/python3_hwasan_symbolize \ No newline at end of file diff --git a/platforms/Linux/DEB/Ubuntu/focal/debian/patches/series b/platforms/Linux/DEB/Ubuntu/focal/debian/patches/series deleted file mode 100644 index 33cab02d..00000000 --- a/platforms/Linux/DEB/Ubuntu/focal/debian/patches/series +++ /dev/null @@ -1,5 +0,0 @@ -python3_hwasan_symbolize -cmake_parallel_bootstrap -build-preset-install-dir -fix-toolchain-path -fix-integration-tests-package-path diff --git a/platforms/Linux/DEB/Ubuntu/focal/debian/patches/series b/platforms/Linux/DEB/Ubuntu/focal/debian/patches/series new file mode 120000 index 00000000..9cbc1df3 --- /dev/null +++ b/platforms/Linux/DEB/Ubuntu/focal/debian/patches/series @@ -0,0 +1 @@ +../../../shared/debian/patches/series \ No newline at end of file diff --git a/platforms/Linux/DEB/Ubuntu/focal/debian/rules b/platforms/Linux/DEB/Ubuntu/focal/debian/rules deleted file mode 100755 index f30714ec..00000000 --- a/platforms/Linux/DEB/Ubuntu/focal/debian/rules +++ /dev/null @@ -1,85 +0,0 @@ -#!/usr/bin/make -f -# See debhelper(7) (uncomment to enable) -# output every command that modifies files on the build system. -#export DH_VERBOSE = 1 - -BUILD_SCRIPT_ARGS = -ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS))) - NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS))) - BUILD_SCRIPT_ARGS += -j $(NUMJOBS) -endif - -# Verbose Swift build -export VERBOSE=1 - -SWIFTLANG_PKG_VER=$(shell dpkg-parsechangelog -S Version | sed -e 's/-[^-]*$$//') -SWIFT_BUILDDIR=$(CURDIR)/build - -%: - dh $@ - -clean:: - dh_testdir - - # Generate debian/control and others - sed -e 's/x.y.z/$(SWIFTLANG_PKG_VER)/g' < debian/control.in > debian/control - - rm -f debian/swiftlang-*.install debian/swiftlang.links - sed -e 's/X.Y.Z/$(SWIFTLANG_PKG_VER)/g' < debian/swiftlang-X.Y.Z.install.in > debian/swiftlang-$(SWIFTLANG_PKG_VER).install - sed -e 's/X.Y.Z/$(SWIFTLANG_PKG_VER)/g' < debian/swiftlang.links.in > debian/swiftlang.links - - rm -rf $(SWIFT_BUILDDIR) - - # Modified during the build - rm -f swift-corelibs-libdispatch/dispatch/module.modulemap - rm -f swift-corelibs-libdispatch/private/module.modulemap - - # Python byte-compiled files - find swift/utils -name '*.pyc' -delete - find llvm-project -name '*.pyc' -delete - find cmark/test -name '*.pyc' -delete - find swiftpm -name '*.pyc' -delete - - dh_clean - -override_dh_auto_clean: - # Disabled; we have a non-standard build system that the tool - # doesn't support, so be on the safe side and avoid any potential - # false-triggering. - -override_dh_update_autotools_config: - # Don't go and update config.guess/config.sub, it causes LLVM to - # pick up the x86_64-pc-linux-gnu triplet instead of the expected - # x86_64-unknown-linux-gnu. This causes Swift modules to break. - -override_dh_autoreconf: - # We'd rather not do that either, see above. - -override_dh_makeshlibs: - # Do not provide shlibs for the all-in-one package; shlibs will be - # provided where pertinent as we move toward the end state of the - # packaging, or a different dependency mechanism will be instituted. - -override_dh_shlibdeps: - dh_shlibdeps -l/opt/swift/$(SWIFTLANG_PKG_VER)/lib/swift/linux/ - -override_dh_dwz: - # Disable DWARF debug info compression; it is failing, so we'll - # need to investigate whether or not it is suitable for us. - -override_dh_auto_build: - swift/utils/build-script $(BUILD_SCRIPT_ARGS) --preset=buildbot_linux,no_assertions,no_test \ - install_prefix=/opt/swift/$(SWIFTLANG_PKG_VER) \ - install_destdir=$(SWIFT_BUILDDIR)/discard \ - installable_package=$(SWIFT_BUILDDIR)/swiftdeb-$(SWIFTLANG_PKG_VER).tar.gz - -override_dh_auto_install: - # The build script preset used above will build, install, package, - # and test the resulting tarball. We could split all this into 2 - # or more presets and run them in sequence as expected here, but - # for now we'll just unpack the (tested) tarball and go from there. - mkdir -p $(CURDIR)/debian/tmp - tar -C $(CURDIR)/debian/tmp -xzf $(SWIFT_BUILDDIR)/swiftdeb-$(SWIFTLANG_PKG_VER).tar.gz - - # Manually compress manpages, since they are in a non-standard location - find $(CURDIR)/debian/tmp/opt/swift/$(SWIFTLANG_PKG_VER)/share/man -type f -exec gzip \{\} \; diff --git a/platforms/Linux/DEB/Ubuntu/focal/debian/rules b/platforms/Linux/DEB/Ubuntu/focal/debian/rules new file mode 120000 index 00000000..5f635612 --- /dev/null +++ b/platforms/Linux/DEB/Ubuntu/focal/debian/rules @@ -0,0 +1 @@ +../../shared/debian/rules \ No newline at end of file diff --git a/platforms/Linux/DEB/Ubuntu/focal/debian/swiftlang-X.Y.Z.install.in b/platforms/Linux/DEB/Ubuntu/focal/debian/swiftlang-X.Y.Z.install.in deleted file mode 100644 index 3c0f5a32..00000000 --- a/platforms/Linux/DEB/Ubuntu/focal/debian/swiftlang-X.Y.Z.install.in +++ /dev/null @@ -1 +0,0 @@ -opt/swift/X.Y.Z/* diff --git a/platforms/Linux/DEB/Ubuntu/focal/debian/swiftlang.install.in b/platforms/Linux/DEB/Ubuntu/focal/debian/swiftlang.install.in new file mode 120000 index 00000000..d6d1248d --- /dev/null +++ b/platforms/Linux/DEB/Ubuntu/focal/debian/swiftlang.install.in @@ -0,0 +1 @@ +../../shared/debian/swiftlang.install.in \ No newline at end of file diff --git a/platforms/Linux/DEB/Ubuntu/focal/debian/swiftlang.links.in b/platforms/Linux/DEB/Ubuntu/focal/debian/swiftlang.links.in deleted file mode 100644 index cb2a6c4a..00000000 --- a/platforms/Linux/DEB/Ubuntu/focal/debian/swiftlang.links.in +++ /dev/null @@ -1,4 +0,0 @@ -opt/swift/X.Y.Z/bin/swift usr/bin/swift -opt/swift/X.Y.Z/bin/swiftc usr/bin/swiftc -opt/swift/X.Y.Z/bin/sourcekit-lsp usr/bin/sourcekit-lsp -opt/swift/X.Y.Z/share/man/man1/swift.1.gz usr/share/man/man1/swift.1.gz diff --git a/platforms/Linux/DEB/Ubuntu/focal/debian/swiftlang.postinst.in b/platforms/Linux/DEB/Ubuntu/focal/debian/swiftlang.postinst.in new file mode 120000 index 00000000..2555961a --- /dev/null +++ b/platforms/Linux/DEB/Ubuntu/focal/debian/swiftlang.postinst.in @@ -0,0 +1 @@ +../../shared/debian/swiftlang.postinst.in \ No newline at end of file diff --git a/platforms/Linux/DEB/Ubuntu/focal/debian/swiftlang.prerm.in b/platforms/Linux/DEB/Ubuntu/focal/debian/swiftlang.prerm.in new file mode 120000 index 00000000..d7b66f22 --- /dev/null +++ b/platforms/Linux/DEB/Ubuntu/focal/debian/swiftlang.prerm.in @@ -0,0 +1 @@ +../../shared/debian/swiftlang.prerm.in \ No newline at end of file diff --git a/platforms/Linux/DEB/Ubuntu/focal/docker-compose.yaml b/platforms/Linux/DEB/Ubuntu/focal/docker-compose.yaml index 05eff3c8..c796d5d7 100644 --- a/platforms/Linux/DEB/Ubuntu/focal/docker-compose.yaml +++ b/platforms/Linux/DEB/Ubuntu/focal/docker-compose.yaml @@ -30,7 +30,7 @@ services: image: ubuntu-focal-deb-builder depends_on: [docker-setup] volumes: - - ../../Ubuntu/focal:/code/Ubuntu/focal:z + - ../../Ubuntu:/code/Ubuntu:z - ../../Shared:/code/Shared:z - ./.output:/output:z working_dir: /code/Ubuntu/focal diff --git a/platforms/Linux/DEB/Ubuntu/hirsute/README.md b/platforms/Linux/DEB/Ubuntu/hirsute/README.md deleted file mode 100644 index a1b0350d..00000000 --- a/platforms/Linux/DEB/Ubuntu/hirsute/README.md +++ /dev/null @@ -1 +0,0 @@ -## hirsute diff --git a/platforms/Linux/DEB/Ubuntu/jammy/.dockerignore b/platforms/Linux/DEB/Ubuntu/jammy/.dockerignore new file mode 100644 index 00000000..16ff3c79 --- /dev/null +++ b/platforms/Linux/DEB/Ubuntu/jammy/.dockerignore @@ -0,0 +1 @@ +.output diff --git a/platforms/Linux/DEB/Ubuntu/jammy/Dockerfile b/platforms/Linux/DEB/Ubuntu/jammy/Dockerfile new file mode 100644 index 00000000..631c861b --- /dev/null +++ b/platforms/Linux/DEB/Ubuntu/jammy/Dockerfile @@ -0,0 +1,21 @@ +# This source file is part of the Swift.org open source project +# +# Copyright (c) 2022 Apple Inc. and the Swift project authors +# Licensed under Apache License v2.0 with Runtime Library Exception +# +# See http://swift.org/LICENSE.txt for license information +# See http://swift.org/CONTRIBUTORS.txt for Swift project authors + +FROM ubuntu:jammy +LABEL PURPOSE="This image is configured to build Swift for the version of Ubuntu listed above" + +ARG DEBIAN_FRONTEND=noninteractive + +RUN apt-get update + +# Required deb packaging tools +RUN apt-get install -y curl devscripts equivs quilt tar + +# Optimization: Install Swift build requirements listed in the control file +ADD debian/control.in /tmp/control.in +RUN mk-build-deps --install /tmp/control.in --tool 'apt-get -y -o Debug::pkgProblemResolver=yes --no-install-recommends' diff --git a/platforms/Linux/DEB/Ubuntu/jammy/build_deb.sh b/platforms/Linux/DEB/Ubuntu/jammy/build_deb.sh new file mode 120000 index 00000000..376962a2 --- /dev/null +++ b/platforms/Linux/DEB/Ubuntu/jammy/build_deb.sh @@ -0,0 +1 @@ +../../Shared/build_deb.sh \ No newline at end of file diff --git a/platforms/Linux/DEB/Ubuntu/jammy/build_source_package.sh b/platforms/Linux/DEB/Ubuntu/jammy/build_source_package.sh new file mode 120000 index 00000000..2c947fb1 --- /dev/null +++ b/platforms/Linux/DEB/Ubuntu/jammy/build_source_package.sh @@ -0,0 +1 @@ +../../Shared/build_source_package.sh \ No newline at end of file diff --git a/platforms/Linux/DEB/Ubuntu/jammy/debian/README.source b/platforms/Linux/DEB/Ubuntu/jammy/debian/README.source new file mode 100644 index 00000000..284273c9 --- /dev/null +++ b/platforms/Linux/DEB/Ubuntu/jammy/debian/README.source @@ -0,0 +1,16 @@ +swift for Debian +--------------- + +The source package for Swift is composed of several different source components +from different projects. + +The shell fragment debian/source-versions.sh contains the version information +for all source components, and the Debian package upstream version (debversion). + +Fill in debian/source-versions.sh with the correct versions for all components, +then run debian/getsource.sh to fetch the archives to the current directory. +Source archives will be downloaded, renamed, and repacked if needed using +mk-origtargz from devscripts, and any Debian patches will be refreshed; ensure +devscripts and quilt are installed beforehand. + + -- Swift Maintainers Tue, 01 Mar 2022 15:04:23 -0800 diff --git a/platforms/Linux/DEB/Ubuntu/jammy/debian/changelog b/platforms/Linux/DEB/Ubuntu/jammy/debian/changelog new file mode 100644 index 00000000..e5c2f5f9 --- /dev/null +++ b/platforms/Linux/DEB/Ubuntu/jammy/debian/changelog @@ -0,0 +1,6 @@ +swiftlang (5.7.2-0~jammy5) jammy; urgency=medium + + * Replaces `swiftlang` + `swiftlang-X.Y.Z` packages with `libswiftlang-X.Y.Z`, `libswiftlang-X.Y.Z-dev`, `swiftlang-X.Y.Z-bin` and meta-package `swiftlang`. + + -- Matias Piipari Tue, 6 Dec 2022 15:53:00 +0200 + diff --git a/platforms/Linux/DEB/Ubuntu/jammy/debian/control.in b/platforms/Linux/DEB/Ubuntu/jammy/debian/control.in new file mode 100644 index 00000000..1843e445 --- /dev/null +++ b/platforms/Linux/DEB/Ubuntu/jammy/debian/control.in @@ -0,0 +1,51 @@ +Source: swiftlang +Section: devel +Priority: optional +Maintainer: Swift Maintainers +Homepage: https://www.swift.org +Build-Depends: debhelper-compat (= 12), devscripts, + build-essential, clang, cmake, git, icu-devtools, libcurl4-openssl-dev, + libedit-dev, libicu-dev, libncurses5-dev, libpython3-dev, libsqlite3-dev, libxml2-dev, + ninja-build, pkg-config, + python2, python-six, python2-dev, + python3-six, python3-distutils, + rsync, swig, systemtap-sdt-dev, tzdata, + unzip, uuid-dev +Standards-Version: 4.6.1 + +Package: libswiftlang-x.y.z +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: Runtime libraries for the Swift programming language + +Package: libswiftlang-x.y.z-dev +Architecture: any +Depends: + libc6-dev, libcurl4-openssl-dev, libgcc-9-dev, libstdc++-9-dev, libxml2-dev, + libz3-dev, uuid-dev, zlib1g-dev, ${shlibs:Depends}, ${misc:Depends} +Description: Headers, static libraries for the Swift programming language + +Package: swiftlang-x.y.z-bin +Architecture: any +Depends: + libswiftlang-x.y.z, libswiftlang-x.y.z-dev, + binutils, git, pkg-config, tzdata, unzip, + python3, ${shlibs:Depends}, ${misc:Depends} +Recommends: python3-lldb-13 +Description: Compiler toolchain for the Swift programming language + Swift is a general-purpose programming language built using + a modern approach to safety, performance, and software design + patterns. + The goal of the Swift project is to create the best available + language for uses ranging from systems programming, to mobile + and desktop apps, scaling up to cloud services. Most + importantly, Swift is designed to make writing and maintaining + correct programs easier for the developer. + This package contains the convenience symlinks for the latest + version of Swift. + +Package: swiftlang +Architecture: any +Depends: + libswiftlang-x.y.z, libswiftlang-x.y.z-dev, swiftlang-x.y.z-bin +Description: Meta-package that provides the most recent version of the Swift programming language diff --git a/platforms/Linux/DEB/Ubuntu/jammy/debian/copyright b/platforms/Linux/DEB/Ubuntu/jammy/debian/copyright new file mode 120000 index 00000000..c5d4e92d --- /dev/null +++ b/platforms/Linux/DEB/Ubuntu/jammy/debian/copyright @@ -0,0 +1 @@ +../../../Shared/copyright \ No newline at end of file diff --git a/platforms/Linux/DEB/Ubuntu/jammy/debian/libswiftlang-dev.install.in b/platforms/Linux/DEB/Ubuntu/jammy/debian/libswiftlang-dev.install.in new file mode 120000 index 00000000..9ec6117d --- /dev/null +++ b/platforms/Linux/DEB/Ubuntu/jammy/debian/libswiftlang-dev.install.in @@ -0,0 +1 @@ +../../shared/debian/libswiftlang-dev.install.in \ No newline at end of file diff --git a/platforms/Linux/DEB/Ubuntu/jammy/debian/libswiftlang.install.in b/platforms/Linux/DEB/Ubuntu/jammy/debian/libswiftlang.install.in new file mode 120000 index 00000000..c2076ad2 --- /dev/null +++ b/platforms/Linux/DEB/Ubuntu/jammy/debian/libswiftlang.install.in @@ -0,0 +1 @@ +../../shared/debian/libswiftlang.install.in \ No newline at end of file diff --git a/platforms/Linux/DEB/Ubuntu/jammy/debian/patches/build-preset-install-dir b/platforms/Linux/DEB/Ubuntu/jammy/debian/patches/build-preset-install-dir new file mode 120000 index 00000000..386f0a36 --- /dev/null +++ b/platforms/Linux/DEB/Ubuntu/jammy/debian/patches/build-preset-install-dir @@ -0,0 +1 @@ +../../../shared/debian/patches/build-preset-install-dir \ No newline at end of file diff --git a/platforms/Linux/DEB/Ubuntu/jammy/debian/patches/cmake_parallel_bootstrap b/platforms/Linux/DEB/Ubuntu/jammy/debian/patches/cmake_parallel_bootstrap new file mode 120000 index 00000000..535af1dc --- /dev/null +++ b/platforms/Linux/DEB/Ubuntu/jammy/debian/patches/cmake_parallel_bootstrap @@ -0,0 +1 @@ +../../../shared/debian/patches/cmake_parallel_bootstrap \ No newline at end of file diff --git a/platforms/Linux/DEB/Ubuntu/jammy/debian/patches/fix-integration-tests-package-path b/platforms/Linux/DEB/Ubuntu/jammy/debian/patches/fix-integration-tests-package-path new file mode 120000 index 00000000..5d29cd33 --- /dev/null +++ b/platforms/Linux/DEB/Ubuntu/jammy/debian/patches/fix-integration-tests-package-path @@ -0,0 +1 @@ +../../../shared/debian/patches/fix-integration-tests-package-path \ No newline at end of file diff --git a/platforms/Linux/DEB/Ubuntu/jammy/debian/patches/fix-toolchain-path b/platforms/Linux/DEB/Ubuntu/jammy/debian/patches/fix-toolchain-path new file mode 120000 index 00000000..596321a9 --- /dev/null +++ b/platforms/Linux/DEB/Ubuntu/jammy/debian/patches/fix-toolchain-path @@ -0,0 +1 @@ +../../../shared/debian/patches/fix-toolchain-path \ No newline at end of file diff --git a/platforms/Linux/DEB/Ubuntu/jammy/debian/patches/python3_hwasan_symbolize b/platforms/Linux/DEB/Ubuntu/jammy/debian/patches/python3_hwasan_symbolize new file mode 120000 index 00000000..5736d8f4 --- /dev/null +++ b/platforms/Linux/DEB/Ubuntu/jammy/debian/patches/python3_hwasan_symbolize @@ -0,0 +1 @@ +../../../shared/debian/patches/python3_hwasan_symbolize \ No newline at end of file diff --git a/platforms/Linux/DEB/Ubuntu/jammy/debian/patches/series b/platforms/Linux/DEB/Ubuntu/jammy/debian/patches/series new file mode 120000 index 00000000..9cbc1df3 --- /dev/null +++ b/platforms/Linux/DEB/Ubuntu/jammy/debian/patches/series @@ -0,0 +1 @@ +../../../shared/debian/patches/series \ No newline at end of file diff --git a/platforms/Linux/DEB/Ubuntu/jammy/debian/rules b/platforms/Linux/DEB/Ubuntu/jammy/debian/rules new file mode 120000 index 00000000..5f635612 --- /dev/null +++ b/platforms/Linux/DEB/Ubuntu/jammy/debian/rules @@ -0,0 +1 @@ +../../shared/debian/rules \ No newline at end of file diff --git a/platforms/Linux/DEB/Ubuntu/jammy/debian/source/format b/platforms/Linux/DEB/Ubuntu/jammy/debian/source/format new file mode 100644 index 00000000..163aaf8d --- /dev/null +++ b/platforms/Linux/DEB/Ubuntu/jammy/debian/source/format @@ -0,0 +1 @@ +3.0 (quilt) diff --git a/platforms/Linux/DEB/Ubuntu/jammy/debian/swiftlang.install.in b/platforms/Linux/DEB/Ubuntu/jammy/debian/swiftlang.install.in new file mode 120000 index 00000000..d6d1248d --- /dev/null +++ b/platforms/Linux/DEB/Ubuntu/jammy/debian/swiftlang.install.in @@ -0,0 +1 @@ +../../shared/debian/swiftlang.install.in \ No newline at end of file diff --git a/platforms/Linux/DEB/Ubuntu/jammy/debian/swiftlang.postinst.in b/platforms/Linux/DEB/Ubuntu/jammy/debian/swiftlang.postinst.in new file mode 120000 index 00000000..2555961a --- /dev/null +++ b/platforms/Linux/DEB/Ubuntu/jammy/debian/swiftlang.postinst.in @@ -0,0 +1 @@ +../../shared/debian/swiftlang.postinst.in \ No newline at end of file diff --git a/platforms/Linux/DEB/Ubuntu/jammy/debian/swiftlang.prerm.in b/platforms/Linux/DEB/Ubuntu/jammy/debian/swiftlang.prerm.in new file mode 120000 index 00000000..d7b66f22 --- /dev/null +++ b/platforms/Linux/DEB/Ubuntu/jammy/debian/swiftlang.prerm.in @@ -0,0 +1 @@ +../../shared/debian/swiftlang.prerm.in \ No newline at end of file diff --git a/platforms/Linux/DEB/Ubuntu/jammy/docker-compose.yaml b/platforms/Linux/DEB/Ubuntu/jammy/docker-compose.yaml new file mode 100644 index 00000000..e476758c --- /dev/null +++ b/platforms/Linux/DEB/Ubuntu/jammy/docker-compose.yaml @@ -0,0 +1,47 @@ +# This source file is part of the Swift.org open source project +# +# Copyright (c) 2022 Apple Inc. and the Swift project authors +# Licensed under Apache License v2.0 with Runtime Library Exception +# +# See http://swift.org/LICENSE.txt for license information +# See http://swift.org/CONTRIBUTORS.txt for Swift project authors + +# this setup is designed to build the Deb with docker +# usage: +# docker-compose -f platforms/Linux/DEB/ubuntu/jammy/docker-compose.yaml run build + +# to rebuild the base image +# docker-compose -f platforms/Linux/DEB/ubuntu/jammy/docker-compose.yaml build + +# to shell into the container for debugging purposes: +# docker-compose -f platforms/Linux/DEB/ubuntu/jammy/docker-compose.yaml run shell + +version: "2" + +services: + + docker-setup: + image: ubuntu-jammy-deb-builder + build: + context: . + dockerfile: Dockerfile + + common: &common + image: ubuntu-jammy-deb-builder + depends_on: [docker-setup] + volumes: + - ../../Ubuntu:/code/Ubuntu:z + - ../../Shared:/code/Shared:z + - ./.output:/output:z + working_dir: /code/Ubuntu/jammy + cap_drop: + - CAP_NET_RAW + - CAP_NET_BIND_SERVICE + + build: + <<: *common + command: /bin/bash -cl "./build_deb.sh" + + shell: + <<: *common + entrypoint: /bin/bash -l diff --git a/platforms/Linux/DEB/Ubuntu/jammy/versions.sh b/platforms/Linux/DEB/Ubuntu/jammy/versions.sh new file mode 120000 index 00000000..1edc8848 --- /dev/null +++ b/platforms/Linux/DEB/Ubuntu/jammy/versions.sh @@ -0,0 +1 @@ +../../Shared/versions.sh \ No newline at end of file diff --git a/platforms/Linux/DEB/Ubuntu/shared/debian/libswiftlang-dev.install.in b/platforms/Linux/DEB/Ubuntu/shared/debian/libswiftlang-dev.install.in new file mode 100644 index 00000000..99c93e9a --- /dev/null +++ b/platforms/Linux/DEB/Ubuntu/shared/debian/libswiftlang-dev.install.in @@ -0,0 +1,29 @@ +usr/lib/swiftlang/X.Y.Z/include/* +usr/lib/swiftlang/X.Y.Z/lib/clang/*/include/* +usr/lib/swiftlang/X.Y.Z/lib/clang/*/lib/linux/*.o +usr/lib/swiftlang/X.Y.Z/lib/clang/*/lib/linux/*.a +usr/lib/swiftlang/X.Y.Z/lib/clang/*/lib/linux/*.a.syms +usr/lib/swiftlang/X.Y.Z/lib/swift/*/*.h +usr/lib/swiftlang/X.Y.Z/lib/swift/*/module.map +usr/lib/swiftlang/X.Y.Z/lib/swift/*/module.modulemap +usr/lib/swiftlang/X.Y.Z/lib/swift/pm/*/*.swiftdoc +usr/lib/swiftlang/X.Y.Z/lib/swift/pm/*/*.swiftmodule +usr/lib/swiftlang/X.Y.Z/lib/swift/FrameworkABIBaseline/* +usr/lib/swiftlang/X.Y.Z/lib/swift/linux/*/*.h +usr/lib/swiftlang/X.Y.Z/lib/swift/linux/*/*.o +usr/lib/swiftlang/X.Y.Z/lib/swift/linux/*.swiftmodule +usr/lib/swiftlang/X.Y.Z/lib/swift/linux/*/*.swiftmodule +usr/lib/swiftlang/X.Y.Z/lib/swift/linux/*/*.swiftdoc +usr/lib/swiftlang/X.Y.Z/lib/swift_static/*/*.h +usr/lib/swiftlang/X.Y.Z/lib/swift_static/linux/*/*.h +usr/lib/swiftlang/X.Y.Z/lib/swift_static/linux/*/*.o +usr/lib/swiftlang/X.Y.Z/lib/swift_static/linux/*.a +usr/lib/swiftlang/X.Y.Z/lib/swift_static/linux/*.swiftmodule +usr/lib/swiftlang/X.Y.Z/lib/swift_static/linux/*/*.swiftdoc +usr/lib/swiftlang/X.Y.Z/lib/swift_static/linux/*/*.swiftmodule +usr/lib/swiftlang/X.Y.Z/lib/swift_static/*/module.map +usr/lib/swiftlang/X.Y.Z/lib/swift_static/*/module.modulemap +usr/lib/swiftlang/X.Y.Z/lib/swift_static/linux/*/*.modulemap +usr/lib/swiftlang/X.Y.Z/lib/swift_static/linux/*.lnk +usr/lib/swiftlang/X.Y.Z/local/include/indexstore/*.h +usr/lib/swiftlang/X.Y.Z/lib/swift/migrator/*.json \ No newline at end of file diff --git a/platforms/Linux/DEB/Ubuntu/shared/debian/libswiftlang.install.in b/platforms/Linux/DEB/Ubuntu/shared/debian/libswiftlang.install.in new file mode 100644 index 00000000..193d920c --- /dev/null +++ b/platforms/Linux/DEB/Ubuntu/shared/debian/libswiftlang.install.in @@ -0,0 +1 @@ +usr/lib/swiftlang/X.Y.Z/lib/swift/linux/*.so* diff --git a/platforms/Linux/DEB/Ubuntu/shared/debian/patches/build-preset-install-dir b/platforms/Linux/DEB/Ubuntu/shared/debian/patches/build-preset-install-dir new file mode 100644 index 00000000..ea6ffe52 --- /dev/null +++ b/platforms/Linux/DEB/Ubuntu/shared/debian/patches/build-preset-install-dir @@ -0,0 +1,18 @@ +Description: Make target installation directory a command line option +Use a variable for the install prefix, so we can specify it at build +time on the command line. +Author: Julien Blache + +# Index: swiftlang-5.7.2/swift/utils/build-presets.ini + +--- swiftlang-5.7.2.orig/swift/utils/build-presets.ini ++++ swiftlang-5.7.2/swift/utils/build-presets.ini +@@ -827 +827,5 @@ install-libicu +-install-prefix=/usr ++install-prefix=%(install_prefix)s ++skip-early-swift-driver ++skip-build-benchmarks ++skip-test-toolchain-benchmarks ++skip-test-cmark +@@ -840 +842,0 @@ test-installable-package +-toolchain-benchmarks diff --git a/platforms/Linux/DEB/Ubuntu/shared/debian/patches/cmake_parallel_bootstrap b/platforms/Linux/DEB/Ubuntu/shared/debian/patches/cmake_parallel_bootstrap new file mode 100644 index 00000000..e1848460 --- /dev/null +++ b/platforms/Linux/DEB/Ubuntu/shared/debian/patches/cmake_parallel_bootstrap @@ -0,0 +1,21 @@ +Description: Enable parallel boostrap for CMake + CMake's bootstrap can be parallelized, but wasn't. +Author: Julien Blache + +Index: swiftlang-5.7.2/swift/utils/swift_build_support/swift_build_support/cmake.py +=================================================================== +--- swiftlang-5.7.2.orig/swift/utils/swift_build_support/swift_build_support/cmake.py ++++ swiftlang-5.7.2/swift/utils/swift_build_support/swift_build_support/cmake.py +@@ -263,8 +263,10 @@ class CMake(object): + + cwd = os.getcwd() + os.chdir(cmake_build_dir) +- shell.call_without_sleeping([cmake_bootstrap, '--no-qt-gui', '--', +- '-DCMAKE_USE_OPENSSL=OFF'], echo=True) ++ shell.call_without_sleeping([cmake_bootstrap, '--no-qt-gui', ++ '--parallel=%s' % self.args.build_jobs, ++ '--', '-DCMAKE_USE_OPENSSL=OFF'], ++ echo=True) + shell.call_without_sleeping(['make', '-j%s' % self.args.build_jobs], + echo=True) + os.chdir(cwd) diff --git a/platforms/Linux/DEB/Ubuntu/shared/debian/patches/fix-integration-tests-package-path b/platforms/Linux/DEB/Ubuntu/shared/debian/patches/fix-integration-tests-package-path new file mode 100644 index 00000000..03118126 --- /dev/null +++ b/platforms/Linux/DEB/Ubuntu/shared/debian/patches/fix-integration-tests-package-path @@ -0,0 +1,110 @@ +Description: Fix integration tests to use correct package path + Remove hardcoded usr paths and pass the correct package path to + the tests. +Author: Julien Blache + +Index: swiftlang-5.7.2/swift-integration-tests/lit.cfg +=================================================================== +--- swiftlang-5.7.2.orig/swift-integration-tests/lit.cfg ++++ swiftlang-5.7.2/swift-integration-tests/lit.cfg +@@ -175,31 +175,31 @@ else: + + swift_path = lit_config.params.get( + "swift", +- os.path.join(package_path, "usr", "bin", "swift")) ++ os.path.join(package_path, "bin", "swift")) + lit_config.note("testing using 'swift': %r" % (swift_path,)) + + swiftc_path = lit_config.params.get( + "swiftc", +- os.path.join(package_path, "usr", "bin", "swiftc")) ++ os.path.join(package_path, "bin", "swiftc")) + lit_config.note("testing using 'swiftc': %r" % (swiftc_path,)) + + lldb_path = lit_config.params.get( + "lldb", +- os.path.join(package_path, "usr", "bin", "lldb")) ++ os.path.join(package_path, "bin", "lldb")) + lit_config.note("testing using 'lldb': {}".format(lldb_path)) + + repl_swift_dummy_path = lit_config.params.get( + "repl_swift", +- os.path.join(package_path, "usr", "bin", "repl_swift")) ++ os.path.join(package_path, "bin", "repl_swift")) + lit_config.note("testing using 'repl_swift': {}".format(repl_swift_dummy_path)) + + sourcekit_lsp_path = lit_config.params.get( + "sourcekit-lsp", +- os.path.join(package_path, "usr", "bin", "sourcekit-lsp")) ++ os.path.join(package_path, "bin", "sourcekit-lsp")) + + docc_path = lit_config.params.get( + "docc", +- os.path.join(package_path, "usr", "bin", "docc")) ++ os.path.join(package_path, "bin", "docc")) + lit_config.note("testing using 'docc': {}".format(docc_path)) + + # Verify they exist. +Index: swiftlang-5.7.2/swift-integration-tests/test-snapshot-binaries/test-rpath-linux.py +=================================================================== +--- swiftlang-5.7.2.orig/swift-integration-tests/test-snapshot-binaries/test-rpath-linux.py ++++ swiftlang-5.7.2/swift-integration-tests/test-snapshot-binaries/test-rpath-linux.py +@@ -4,26 +4,26 @@ + # CHECK: {{.*}} {{\(RPATH\)|\(RUNPATH\)}} {{.*}}$ORIGIN/../lib/swift/linux + # + # Tests that DT_RUNPATH is correct for the Swift stdlib and other libraries on Linux. +-# RUN: %{readelf} -d %{package_path}/usr/lib/swift/linux/libswiftCore.so | %{FileCheck} --check-prefix CHECK-CORE %s ++# RUN: %{readelf} -d %{package_path}/lib/swift/linux/libswiftCore.so | %{FileCheck} --check-prefix CHECK-CORE %s + # CHECK-CORE-NOT: {{.*}} {{\(RPATH\)|\(RUNPATH\)}} {{.*}}:/usr/lib/swift/linux + # +-# RUN: %{readelf} -d %{package_path}/usr/lib/libsourcekitdInProc.so | %{FileCheck} --check-prefix CHECK-SK %s ++# RUN: %{readelf} -d %{package_path}/lib/libsourcekitdInProc.so | %{FileCheck} --check-prefix CHECK-SK %s + # CHECK-SK-NOT: {{.*}} {{\(RPATH\)|\(RUNPATH\)}} {{.*}}:/usr/lib/swift/linux + # +-# RUN: %{readelf} -d %{package_path}/usr/lib/swift/linux/libswiftRemoteMirror.so | %{FileCheck} --check-prefix CHECK-RM %s ++# RUN: %{readelf} -d %{package_path}/lib/swift/linux/libswiftRemoteMirror.so | %{FileCheck} --check-prefix CHECK-RM %s + # CHECK-RM-NOT: {{.*}} {{\(RPATH\)|\(RUNPATH\)}} {{.*}}:/usr/lib/swift/linux + # +-# RUN: %{readelf} -d %{package_path}/usr/lib/swift/linux/libswift_Differentiation.so | %{FileCheck} --check-prefix CHECK-SD %s ++# RUN: %{readelf} -d %{package_path}/lib/swift/linux/libswift_Differentiation.so | %{FileCheck} --check-prefix CHECK-SD %s + # CHECK-SD-NOT: {{.*}} {{\(RPATH\)|\(RUNPATH\)}} {{.*}}:/usr/lib/swift/linux + # +-# RUN: %{readelf} -d %{package_path}/usr/lib/swift/linux/lib_InternalSwiftSyntaxParser.so | %{FileCheck} --check-prefix CHECK-SP %s ++# RUN: %{readelf} -d %{package_path}/lib/swift/linux/lib_InternalSwiftSyntaxParser.so | %{FileCheck} --check-prefix CHECK-SP %s + # CHECK-SP-NOT: {{.*}} {{\(RPATH\)|\(RUNPATH\)}} {{.*}}:/usr/lib/swift/linux + # +-# RUN: %{readelf} -d %{package_path}/usr/lib/swift/linux/libswiftGlibc.so | %{FileCheck} --check-prefix CHECK-SG %s ++# RUN: %{readelf} -d %{package_path}/lib/swift/linux/libswiftGlibc.so | %{FileCheck} --check-prefix CHECK-SG %s + # CHECK-SG-NOT: {{.*}} {{\(RPATH\)|\(RUNPATH\)}} {{.*}}:/usr/lib/swift/linux + # +-# RUN: %{readelf} -d %{package_path}/usr/lib/swift/linux/libswiftSwiftOnoneSupport.so | %{FileCheck} --check-prefix CHECK-SON %s ++# RUN: %{readelf} -d %{package_path}/lib/swift/linux/libswiftSwiftOnoneSupport.so | %{FileCheck} --check-prefix CHECK-SON %s + # CHECK-SON-NOT: {{.*}} {{\(RPATH\)|\(RUNPATH\)}} {{.*}}:/usr/lib/swift/linux + # +-# RUN: %{readelf} -d %{package_path}/usr/lib/libswiftDemangle.so | %{FileCheck} --check-prefix CHECK-SDE %s ++# RUN: %{readelf} -d %{package_path}/lib/libswiftDemangle.so | %{FileCheck} --check-prefix CHECK-SDE %s + # CHECK-SDE-NOT: {{.*}} {{\(RPATH\)|\(RUNPATH\)}} {{.*}}:/usr/lib/swift/linux +Index: swiftlang-5.7.2/swift/utils/build-script-impl +=================================================================== +--- swiftlang-5.7.2.orig/swift/utils/build-script-impl ++++ swiftlang-5.7.2/swift/utils/build-script-impl +@@ -3463,8 +3463,10 @@ function build_and_test_installable_pack + + if [[ "${host}" == "macosx-"* ]] || [[ "${host}" == "merged-hosts" ]]; then + PKG_TESTS_SANDBOX="${PKG_TESTS_SANDBOX_PARENT}"/"${TOOLCHAIN_PREFIX}" ++ PKG_TESTS_PKG_DIR="${PKG_TESTS_SANDBOX}" + else # Linux + PKG_TESTS_SANDBOX="${PKG_TESTS_SANDBOX_PARENT}" ++ PKG_TESTS_PKG_DIR="${PKG_TESTS_SANDBOX}/${host_install_prefix}" + fi + + LIT_EXECUTABLE_PATH="${LLVM_SOURCE_DIR}/utils/lit/lit.py" +@@ -3479,7 +3481,7 @@ function build_and_test_installable_pack + TIMEOUT_ARGS=--timeout=1200 # 20 minutes + fi + with_pushd "${PKG_TESTS_SOURCE_DIR}" \ +- call python3 "${LIT_EXECUTABLE_PATH}" . -sv --param package-path="${PKG_TESTS_SANDBOX}" --param test-exec-root="${PKG_TESTS_TEMPS}" --param llvm-bin-dir="${LLVM_BIN_DIR}" ${TIMEOUT_ARGS} ++ call python3 "${LIT_EXECUTABLE_PATH}" . -sv --param package-path="${PKG_TESTS_PKG_DIR}" --param test-exec-root="${PKG_TESTS_TEMPS}" --param llvm-bin-dir="${LLVM_BIN_DIR}" ${TIMEOUT_ARGS} + fi + fi + } diff --git a/platforms/Linux/DEB/Ubuntu/shared/debian/patches/fix-toolchain-path b/platforms/Linux/DEB/Ubuntu/shared/debian/patches/fix-toolchain-path new file mode 100644 index 00000000..b66289ea --- /dev/null +++ b/platforms/Linux/DEB/Ubuntu/shared/debian/patches/fix-toolchain-path @@ -0,0 +1,42 @@ +Description: Fix toolchain path for build-script-helper.py + Make sure the correct path is passed to the script, and remove + assumption that /usr is used. +Author: Julien Blache + +Index: swiftlang-5.7.2/swift/benchmark/scripts/build_script_helper.py +=================================================================== +--- swiftlang-5.7.2.orig/swift/benchmark/scripts/build_script_helper.py ++++ swiftlang-5.7.2/swift/benchmark/scripts/build_script_helper.py +@@ -51,7 +51,7 @@ def main(): + if not os.path.isdir(bin_dir): + os.makedirs(bin_dir) + +- swiftbuild_path = os.path.join(args.toolchain, "usr", "bin", "swift-build") ++ swiftbuild_path = os.path.join(args.toolchain, "bin", "swift-build") + perform_build(args, swiftbuild_path, "debug", "Benchmark_Onone", "-Onone") + perform_build(args, swiftbuild_path, "release", "Benchmark_Osize", "-Osize") + perform_build(args, swiftbuild_path, "release", "Benchmark_O", "-O") +Index: swiftlang-5.7.2/swift/utils/swift_build_support/swift_build_support/products/benchmarks.py +=================================================================== +--- swiftlang-5.7.2.orig/swift/utils/swift_build_support/swift_build_support/products/benchmarks.py ++++ swiftlang-5.7.2/swift/utils/swift_build_support/swift_build_support/products/benchmarks.py +@@ -100,11 +100,17 @@ class Benchmarks(product.Product): + + + def _get_toolchain_path(host_target, product, args): +- # TODO check if we should prefer using product.install_toolchain_path + # this logic initially was inside run_build_script_helper + # and was factored out so it can be used in testing as well + +- toolchain_path = product.host_install_destdir(host_target) ++ install_destdir = args.install_destdir ++ if swiftpm.SwiftPM.has_cross_compile_hosts(args): ++ install_destdir = swiftpm.SwiftPM.get_install_destdir(args, ++ host_target, ++ product.build_dir) ++ toolchain_path = targets.toolchain_path(install_destdir, ++ args.install_prefix) ++ + if platform.system() == 'Darwin': + # The prefix is an absolute path, so concatenate without os.path. + toolchain_path += \ diff --git a/platforms/Linux/DEB/Ubuntu/shared/debian/patches/python3_hwasan_symbolize b/platforms/Linux/DEB/Ubuntu/shared/debian/patches/python3_hwasan_symbolize new file mode 100644 index 00000000..04c59eef --- /dev/null +++ b/platforms/Linux/DEB/Ubuntu/shared/debian/patches/python3_hwasan_symbolize @@ -0,0 +1,14 @@ +Description: Fix hwasan_symbolize to call python3 + On Ubuntu, /usr/bin/python is still python 2.x. +Author: Julien Blache + +Index: swiftlang-5.7.2/llvm-project/compiler-rt/lib/hwasan/scripts/hwasan_symbolize +=================================================================== +--- swiftlang-5.7.2.orig/llvm-project/compiler-rt/lib/hwasan/scripts/hwasan_symbolize ++++ swiftlang-5.7.2/llvm-project/compiler-rt/lib/hwasan/scripts/hwasan_symbolize +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/env python3 + #===- lib/hwasan/scripts/hwasan_symbolize ----------------------------------===# + # + # Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. diff --git a/platforms/Linux/DEB/Ubuntu/shared/debian/patches/series b/platforms/Linux/DEB/Ubuntu/shared/debian/patches/series new file mode 100644 index 00000000..33cab02d --- /dev/null +++ b/platforms/Linux/DEB/Ubuntu/shared/debian/patches/series @@ -0,0 +1,5 @@ +python3_hwasan_symbolize +cmake_parallel_bootstrap +build-preset-install-dir +fix-toolchain-path +fix-integration-tests-package-path diff --git a/platforms/Linux/DEB/Ubuntu/shared/debian/rules b/platforms/Linux/DEB/Ubuntu/shared/debian/rules new file mode 100755 index 00000000..e8ced2e6 --- /dev/null +++ b/platforms/Linux/DEB/Ubuntu/shared/debian/rules @@ -0,0 +1,101 @@ +#!/usr/bin/make -f +# See debhelper(7) (uncomment to enable) +# output every command that modifies files on the build system. +#export DH_VERBOSE = 1 + +BUILD_SCRIPT_ARGS = +ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS))) + NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS))) + BUILD_SCRIPT_ARGS += -j $(NUMJOBS) +endif + +# Verbose Swift build +export VERBOSE=1 + +SWIFTLANG_PKG_VER=$(shell dpkg-parsechangelog -S Version | sed -e 's/-[^-]*$$//') +SWIFT_BUILDDIR=$(CURDIR)/build + + +export DEB_BUILD_MAINT_OPTIONS=hardening=+format,+fortify,+stackprotectorstrong,+relro +export MOD_CXXFLAGS=$(DEB_CXXFLAGS_STRIP="-ffat-lto-objects -flto=auto -flto=auto" dpkg-buildflags --get CXXFLAGS) +export MOD_CFLAGS=$(DEB_CFLAGS_STRIP="-ffat-lto-objects -flto=auto -flto=auto" dpkg-buildflags --get CFLAGS) +export MOD_LDFLAGS=$(DEB_LDFLAGS_STRIP="-ffat-lto-objects -flto=auto -flto=auto" dpkg-buildflags --get LDFLAGS) + +%: + dh $@ + +clean:: + dh_testdir + + # Generate debian/control and others + sed -e 's/x.y.z/$(SWIFTLANG_PKG_VER)/g' < debian/control.in > debian/control + sed -e 's/X.Y.Z/$(SWIFTLANG_PKG_VER)/g' < debian/swiftlang.install.in > debian/swiftlang-$(SWIFTLANG_PKG_VER)-bin.install + sed -e 's/X.Y.Z/$(SWIFTLANG_PKG_VER)/g' < debian/libswiftlang.install.in > debian/libswiftlang-$(SWIFTLANG_PKG_VER).install + sed -e 's/X.Y.Z/$(SWIFTLANG_PKG_VER)/g' < debian/libswiftlang-dev.install.in > debian/libswiftlang-$(SWIFTLANG_PKG_VER)-dev.install + sed -e 's/X.Y.Z/$(SWIFTLANG_PKG_VER)/g' < debian/swiftlang.postinst.in > debian/swiftlang-$(SWIFTLANG_PKG_VER)-bin.postinst + sed -e 's/X.Y.Z/$(SWIFTLANG_PKG_VER)/g' < debian/swiftlang.prerm.in > debian/swiftlang-$(SWIFTLANG_PKG_VER)-bin.prerm + + chmod ugo+x debian/swiftlang-$(SWIFTLANG_PKG_VER)-bin.postinst + chmod ugo+x debian/swiftlang-$(SWIFTLANG_PKG_VER)-bin.prerm + + rm -rf $(SWIFT_BUILDDIR) + + # Modified during the build + rm -f swift-corelibs-libdispatch/dispatch/module.modulemap + rm -f swift-corelibs-libdispatch/private/module.modulemap + + # Python byte-compiled files + find swift/utils -name '*.pyc' -delete + find llvm-project -name '*.pyc' -delete + find cmark/test -name '*.pyc' -delete + find swiftpm -name '*.pyc' -delete + + dh_clean + +override_dh_auto_clean: + # Disabled; we have a non-standard build system that the tool + # doesn't support, so be on the safe side and avoid any potential + # false-triggering. + +override_dh_update_autotools_config: + # Don't go and update config.guess/config.sub, it causes LLVM to + # pick up the x86_64-pc-linux-gnu triplet instead of the expected + # x86_64-unknown-linux-gnu. This causes Swift modules to break. + +override_dh_autoreconf: + # We'd rather not do that either, see above. + +override_dh_shlibdeps: + dh_shlibdeps -- -xlibswiftlang-$(SWIFTLANG_PKG_VER) -xswiftlang-$(SWIFTLANG_PKG_VER)-bin + +override_dh_dwz: + # Disable DWARF debug info compression; it is failing, so we'll + # need to investigate whether or not it is suitable for us. + +override_dh_auto_build: + echo "Build flags:" + echo "MOD_CXXFLAGS: ${MOD_CXXFLAGS}" + echo "MOD_CFLAGS: ${MOD_CFLAGS}" + echo "MOD_LDFLAGS: ${MOD_LDFLAGS}" + # on Jammy, default compiler & linker flags include -ffat-lto-objects and -flto=auto, which clang 13 does not appreciate. + # TODO: Replace the below fixed flags with ${MOD_CXXFLAGS}, ${MOD_CFLAGS}, ${MOD_LDFLAGS} ... above + # (the fixed flags are used because dpkg-buildflags mysteriously outputs empty strings specifically when called from debuild) + CFLAGS="-g -O2 -fstack-protector-strong -Wformat -Werror=format-security" \ + CXXFLAGS="-g -O2 -fstack-protector-strong -Wformat -Werror=format-security" \ + LDFLAGS="-Wl,-Bsymbolic-functions -Wl,-z,relro" \ + swift/utils/build-script $(BUILD_SCRIPT_ARGS) --preset=buildbot_linux,no_assertions,no_test \ + install_prefix=/usr/lib/swiftlang/$(SWIFTLANG_PKG_VER) \ + install_destdir=$(SWIFT_BUILDDIR)/discard \ + installable_package=$(SWIFT_BUILDDIR)/swiftdeb-$(SWIFTLANG_PKG_VER).tar.gz + +override_dh_auto_install: + # The build script preset used above will build, install, package, + # and test the resulting tarball. We could split all this into 2 + # or more presets and run them in sequence as expected here, but + # for now we'll just unpack the (tested) tarball and go from there. + + mkdir -p $(CURDIR)/debian/tmp + tar -C $(CURDIR)/debian/tmp -xzf $(SWIFT_BUILDDIR)/swiftdeb-$(SWIFTLANG_PKG_VER).tar.gz + + # Manually compress manpages, since they are in a non-standard location + find $(CURDIR)/debian/tmp/usr/lib/swiftlang/$(SWIFTLANG_PKG_VER)/share/man -type f -exec gzip \{\} \; diff --git a/platforms/Linux/DEB/Ubuntu/shared/debian/swiftlang.install.in b/platforms/Linux/DEB/Ubuntu/shared/debian/swiftlang.install.in new file mode 100644 index 00000000..268f09a2 --- /dev/null +++ b/platforms/Linux/DEB/Ubuntu/shared/debian/swiftlang.install.in @@ -0,0 +1,9 @@ +usr/lib/swiftlang/X.Y.Z/bin/* +usr/lib/swiftlang/X.Y.Z/lib/*.so* +usr/lib/swiftlang/X.Y.Z/lib/swift/pm/ManifestAPI/*.so* +usr/lib/swiftlang/X.Y.Z/lib/swift/pm/PluginAPI/*.so* +usr/lib/swiftlang/X.Y.Z/lib/swift/pm/llbuild/*.so* +usr/lib/swiftlang/X.Y.Z/lib/clang/*/bin/* +usr/lib/swiftlang/X.Y.Z/lib/clang/*/share/* +usr/lib/swiftlang/X.Y.Z/lib/clang/*/lib/linux/*.so* +usr/lib/swiftlang/X.Y.Z/share/* diff --git a/platforms/Linux/DEB/Ubuntu/shared/debian/swiftlang.postinst.in b/platforms/Linux/DEB/Ubuntu/shared/debian/swiftlang.postinst.in new file mode 100644 index 00000000..64dfd819 --- /dev/null +++ b/platforms/Linux/DEB/Ubuntu/shared/debian/swiftlang.postinst.in @@ -0,0 +1,7 @@ +#!/bin/sh -e + +update-alternatives --install /usr/bin/swift swiftlang /usr/lib/swiftlang/X.Y.Z/bin/swift-frontend 50 \ + --slave /usr/bin/swiftc swiftc /usr/lib/swiftlang/X.Y.Z/bin/swift-frontend \ + --slave /usr/bin/swift-lldb swift-lldb /usr/lib/swiftlang/X.Y.Z/bin/lldb \ + --slave /usr/bin/sourcekit-lsp swift-sourcekit-lsp /usr/lib/swiftlang/X.Y.Z/bin/sourcekit-lsp \ + --slave /usr/share/man/man1/swift.1.gz swift-man.1.gz /usr/lib/swiftlang/X.Y.Z/share/man/man1/swift.1.gz diff --git a/platforms/Linux/DEB/Ubuntu/shared/debian/swiftlang.prerm.in b/platforms/Linux/DEB/Ubuntu/shared/debian/swiftlang.prerm.in new file mode 100644 index 00000000..bed41129 --- /dev/null +++ b/platforms/Linux/DEB/Ubuntu/shared/debian/swiftlang.prerm.in @@ -0,0 +1,5 @@ +#!/bin/sh -e + +if [ "$1" = remove ] || [ "$1" = deconfigure ]; then + update-alternatives --remove swiftlang /usr/bin/swift +fi