Skip to content

Commit

Permalink
Debian packaging for Ubuntu 20.04
Browse files Browse the repository at this point in the history
  • Loading branch information
jblache committed Mar 18, 2022
1 parent 43acf97 commit 6924ad6
Show file tree
Hide file tree
Showing 17 changed files with 607 additions and 0 deletions.
17 changes: 17 additions & 0 deletions platforms/Linux/DEB/Ubuntu/focal/debian/README.source
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
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.

-- Julien Blache <[email protected]> Tue, 01 Mar 2022 15:04:23 -0800

17 changes: 17 additions & 0 deletions platforms/Linux/DEB/Ubuntu/focal/debian/changelog
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
swiftlang (5.6.0-1) focal; urgency=medium

* New upstream release.

-- Julien Blache <[email protected]> Tue, 15 Mar 2022 16:36:34 -0700

swiftlang (5.5.3-2) focal; urgency=medium

* Add a default swiftlang package with symlinks in the PATH.

-- Julien Blache <[email protected]> Fri, 11 Mar 2022 15:04:24 -0800

swiftlang (5.5.3-1) focal; urgency=medium

* Initial release.

-- Julien Blache <[email protected]> Tue, 01 Mar 2022 15:04:23 -0800
46 changes: 46 additions & 0 deletions platforms/Linux/DEB/Ubuntu/focal/debian/control
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
Source: swiftlang
Section: devel
Priority: optional
Maintainer: Swift Maintainers <[email protected]>
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
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: swiftlang-x.y.z
Architecture: amd64 arm64
Depends: ${shlibs:Depends}, ${misc:Depends},
libc6-dev, libgcc-9-dev, libstdc++-9-dev, libz3-dev, uuid-dev, zlib1g-dev,
libxml2-dev, libcurl4-openssl-dev,
binutils, git, pkg-config, tzdata, 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.
46 changes: 46 additions & 0 deletions platforms/Linux/DEB/Ubuntu/focal/debian/control.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
Source: swiftlang
Section: devel
Priority: optional
Maintainer: Swift Maintainers <[email protected]>
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
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: swiftlang-x.y.z
Architecture: amd64 arm64
Depends: ${shlibs:Depends}, ${misc:Depends},
libc6-dev, libgcc-9-dev, libstdc++-9-dev, libz3-dev, uuid-dev, zlib1g-dev,
libxml2-dev, libcurl4-openssl-dev,
binutils, git, pkg-config, tzdata, 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.
38 changes: 38 additions & 0 deletions platforms/Linux/DEB/Ubuntu/focal/debian/copyright
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: swift
Upstream-Contact: <preferred name and address to reach the upstream project>
Source: <url://example.com>

Files: *
Copyright: <years> <put author's name and email here>
<years> <likewise for another author>
License: Apache-2.0

Files: debian/*
Copyright: <years> Author Name <[email protected]>
License: Apache-2.0

License: Apache-2.0
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
.
https://www.apache.org/licenses/LICENSE-2.0
.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
.
On Debian systems, the complete text of the Apache version 2.0 license
can be found in "/usr/share/common-licenses/Apache-2.0".

# Please also look if there are files or directories which have a
# different copyright/license attached and list them here.
# Please avoid picking licenses with terms that are more restrictive than the
# packaged work, as it may make Debian's contributions unacceptable upstream.
#
# If you need, there are some extra license texts available in two places:
# /usr/share/debhelper/dh_make/licenses/
# /usr/share/common-licenses/
124 changes: 124 additions & 0 deletions platforms/Linux/DEB/Ubuntu/focal/debian/getsource.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
#!/bin/sh

# This helper script will fetch the Swift sources, save the
# tarballs following the appropriate naming convention, and
# build a Debian source package.

# You will need the devscripts and quilt packages installed
# to run this script and build the packages following these
# instructions.

# Create swiftlang-X.Y.Z, unpack the debian tarball within,
# proceed to adding the appropriate entry to the Debian
# changelog, edit debian/source-version.sh, then run this
# script from the directory containing swiftlang-X.Y.Z.
# $ mkdir swiftlang-X.Y.Z
# $ cd swiftlang-X.Y.Z
# $ tar xvaf ../swiftlang_A.B.C-D.debian.tar.xz
# $ dch -v X.Y.Z-1
# $ cd ..
# $ swiftlang-X.Y.Z/debian/getsource.sh
#
# This will download all the necessary sources, unpack them
# as required, refresh any Debian patches, then create the
# Debian source package.

# If all is well, proceed with building the packages.
# $ cd swiftlang-X.Y.Z
# $ DEB_BUILD_OPTIONS=parallel=64 debuild

set -eu

. $(dirname $0)/source-versions.sh

get_component ()
{
component=$1
url="$2"

dest=swiftlang_${debversion}.orig-${component}

echo "Downloading ${component} from ${url}"

case "${url}" in
*.zip)
tmpdest=${component}.zip
dest=${dest}.tar.gz

curl -L -o ${tmpdest} "${url}"
mk-origtargz --package swiftlang -v ${debversion} -c ${component} --rename --compression gzip ${tmpdest}
;;

*.tar.gz)
dest=${dest}.tar.gz
curl -L -o ${dest} "${url}"
;;

*.tar.xz)
dest=${dest}.tar.xz
curl -L -o ${dest} "${url}"
;;

*.tar.bz2)
dest=${dest}.tar.bz2
curl -L -o ${dest} "${url}"
;;

*)
echo "Source archive not in a suitable format for Debian sources: ${url}" >&2
exit 1
esac

mkdir swiftlang-${debversion}/${component}
tar -C swiftlang-${debversion}/${component} --strip-components=1 -axf ${dest}
}

get_component swift https://github.com/apple/swift/archive/swift-${swift_version}.tar.gz
get_component swift-corelibs-libdispatch https://github.com/apple/swift-corelibs-libdispatch/archive/swift-${swift_version}.tar.gz
get_component swift-corelibs-foundation https://github.com/apple/swift-corelibs-foundation/archive/swift-${swift_version}.tar.gz
get_component swift-integration-tests https://github.com/apple/swift-integration-tests/archive/swift-${swift_version}.tar.gz
get_component swift-corelibs-xctest https://github.com/apple/swift-corelibs-xctest/archive/swift-${swift_version}.tar.gz
get_component swiftpm https://github.com/apple/swift-package-manager/archive/swift-${swift_version}.tar.gz
get_component llbuild https://github.com/apple/swift-llbuild/archive/swift-${swift_version}.tar.gz
get_component cmark https://github.com/apple/swift-cmark/archive/swift-${swift_version}.tar.gz
get_component swift-xcode-playground-support https://github.com/apple/swift-xcode-playground-support/archive/swift-${swift_version}.tar.gz
get_component sourcekit-lsp https://github.com/apple/sourcekit-lsp/archive/swift-${swift_version}.tar.gz
get_component indexstore-db https://github.com/apple/indexstore-db/archive/swift-${swift_version}.tar.gz
get_component llvm-project https://github.com/apple/llvm-project/archive/swift-${swift_version}.tar.gz
get_component swift-tools-support-core https://github.com/apple/swift-tools-support-core/archive/swift-${swift_version}.tar.gz
get_component swift-argument-parser https://github.com/apple/swift-argument-parser/archive/${swift_argument_parser_version}.tar.gz
get_component swift-driver https://github.com/apple/swift-driver/archive/swift-${swift_version}.tar.gz
get_component icu https://github.com/unicode-org/icu/archive/release-${icu_version}.tar.gz
get_component swift-crypto https://github.com/apple/swift-crypto/archive/refs/tags/${swift_crypto_version}.tar.gz
get_component ninja https://github.com/ninja-build/ninja/archive/refs/tags/v${ninja_version}.tar.gz
get_component cmake https://github.com/KitWare/CMake/archive/refs/tags/v${cmake_version}.tar.gz
get_component swift-syntax https://github.com/apple/swift-syntax/archive/swift-${swift_version}.tar.gz
get_component yams https://github.com/jpsim/Yams/archive/${yams_version}.tar.gz
get_component swift-atomics https://github.com/apple/swift-atomics/archive/${swift_atomics_version}.tar.gz
get_component swift-cmark-gfm https://github.com/apple/swift-cmark/archive/swift-${swift_version}-gfm.tar.gz
get_component swift-docc https://github.com/apple/swift-docc/archive/swift-${swift_version}.tar.gz
get_component swift-docc-render-artifact https://github.com/apple/swift-docc-render-artifact/archive/swift-${swift_version}.tar.gz
get_component swift-docc-symbolkit https://github.com/apple/swift-docc-symbolkit/archive/swift-${swift_version}.tar.gz
get_component swift-collections https://github.com/apple/swift-collections/archive/${swift_collections_version}.tar.gz
get_component swift-numerics https://github.com/apple/swift-numerics/archive/${swift_numerics_version}.tar.gz
get_component swift-system https://github.com/apple/swift-system/archive/${swift_system_version}.tar.gz
get_component swift-nio https://github.com/apple/swift-nio/archive/${swift_nio_version}.tar.gz
get_component swift-nio-ssl https://github.com/apple/swift-nio-ssl/archive/${swift_nio_ssl_version}.tar.gz
get_component swift-format https://github.com/apple/swift-format/archive/swift-${swift_version}.tar.gz
get_component swift-lmdb https://github.com/apple/swift-lmdb/archive/swift-${swift_version}.tar.gz
get_component swift-markdown https://github.com/apple/swift-markdown/archive/swift-${swift_version}.tar.gz

# Refresh patches, if any
if [ -s swiftlang-${debversion}/debian/patches/series ]; then
cd swiftlang-${debversion}

export QUILT_PATCHES=debian/patches
export QUILT_REFRESH_ARGS="-p ab --no-timestamps --no-index"

while quilt push; do quilt refresh; done
quilt pop -a

cd -
fi

dpkg-source --create-empty-orig -b swiftlang-${debversion}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
Description: Change the target installation directory
Presets will be modified to use the command line, after
the dust settles.
Author: Julien Blache <[email protected]>

Index: swiftlang-5.6.0/swift/utils/build-presets.ini
===================================================================
--- swiftlang-5.6.0.orig/swift/utils/build-presets.ini
+++ swiftlang-5.6.0/swift/utils/build-presets.ini
@@ -831,7 +831,7 @@ install-swiftpm
install-swift-driver
install-xctest
install-libicu
-install-prefix=/usr
+install-prefix=/opt/swift/5.6.0
install-libcxx
install-sourcekit-lsp
install-swiftdocc
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Description: Enable parallel boostrap for CMake
CMake's bootstrap can be parallelized, but wasn't.
Author: Julien Blache <[email protected]>

Index: swiftlang-5.6.0/swift/utils/swift_build_support/swift_build_support/cmake.py
===================================================================
--- swiftlang-5.6.0.orig/swift/utils/swift_build_support/swift_build_support/cmake.py
+++ swiftlang-5.6.0/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)
Loading

0 comments on commit 6924ad6

Please sign in to comment.