Skip to content

Commit 6924ad6

Browse files
committed
Debian packaging for Ubuntu 20.04
1 parent 43acf97 commit 6924ad6

17 files changed

+607
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
swift for Debian
2+
---------------
3+
4+
The source package for Swift is composed of several different source components
5+
from different projects.
6+
7+
The shell fragment debian/source-versions.sh contains the version information
8+
for all source components, and the Debian package upstream version (debversion).
9+
10+
Fill in debian/source-versions.sh with the correct versions for all components,
11+
then run debian/getsource.sh to fetch the archives to the current directory.
12+
Source archives will be downloaded, renamed, and repacked if needed using
13+
mk-origtargz from devscripts, and any Debian patches will be refreshed; ensure
14+
devscripts and quilt are installed beforehand.
15+
16+
-- Julien Blache <[email protected]> Tue, 01 Mar 2022 15:04:23 -0800
17+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
swiftlang (5.6.0-1) focal; urgency=medium
2+
3+
* New upstream release.
4+
5+
-- Julien Blache <[email protected]> Tue, 15 Mar 2022 16:36:34 -0700
6+
7+
swiftlang (5.5.3-2) focal; urgency=medium
8+
9+
* Add a default swiftlang package with symlinks in the PATH.
10+
11+
-- Julien Blache <[email protected]> Fri, 11 Mar 2022 15:04:24 -0800
12+
13+
swiftlang (5.5.3-1) focal; urgency=medium
14+
15+
* Initial release.
16+
17+
-- Julien Blache <[email protected]> Tue, 01 Mar 2022 15:04:23 -0800
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
Source: swiftlang
2+
Section: devel
3+
Priority: optional
4+
Maintainer: Swift Maintainers <[email protected]>
5+
Build-Depends: debhelper-compat (= 12), devscripts,
6+
clang, cmake, git, icu-devtools, ninja-build, pkg-config,
7+
libcurl4-openssl-dev, libedit-dev, libicu-dev, libncurses5-dev,
8+
libpython3-dev, libsqlite3-dev, libxml2-dev,
9+
python, python-six, python2-dev, python3-six, python3-distutils, python3-psutil,
10+
rsync, swig, systemtap-sdt-dev, tzdata, unzip, uuid-dev
11+
Standards-Version: 4.4.1
12+
Homepage: https://www.swift.org
13+
14+
Package: swiftlang
15+
Architecture: all
16+
Depends: swiftlang-x.y.z, ${misc:Depends}
17+
Description: Swift programming language
18+
Swift is a general-purpose programming language built using
19+
a modern approach to safety, performance, and software design
20+
patterns.
21+
.
22+
The goal of the Swift project is to create the best available
23+
language for uses ranging from systems programming, to mobile
24+
and desktop apps, scaling up to cloud services. Most
25+
importantly, Swift is designed to make writing and maintaining
26+
correct programs easier for the developer.
27+
.
28+
This package contains the convenience symlinks for the latest
29+
version of Swift.
30+
31+
Package: swiftlang-x.y.z
32+
Architecture: amd64 arm64
33+
Depends: ${shlibs:Depends}, ${misc:Depends},
34+
libc6-dev, libgcc-9-dev, libstdc++-9-dev, libz3-dev, uuid-dev, zlib1g-dev,
35+
libxml2-dev, libcurl4-openssl-dev,
36+
binutils, git, pkg-config, tzdata, python3
37+
Description: Swift programming language, release x.y.z
38+
Swift is a general-purpose programming language built using
39+
a modern approach to safety, performance, and software design
40+
patterns.
41+
.
42+
The goal of the Swift project is to create the best available
43+
language for uses ranging from systems programming, to mobile
44+
and desktop apps, scaling up to cloud services. Most
45+
importantly, Swift is designed to make writing and maintaining
46+
correct programs easier for the developer.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
Source: swiftlang
2+
Section: devel
3+
Priority: optional
4+
Maintainer: Swift Maintainers <[email protected]>
5+
Build-Depends: debhelper-compat (= 12), devscripts,
6+
clang, cmake, git, icu-devtools, ninja-build, pkg-config,
7+
libcurl4-openssl-dev, libedit-dev, libicu-dev, libncurses5-dev,
8+
libpython3-dev, libsqlite3-dev, libxml2-dev,
9+
python, python-six, python2-dev, python3-six, python3-distutils, python3-psutil,
10+
rsync, swig, systemtap-sdt-dev, tzdata, unzip, uuid-dev
11+
Standards-Version: 4.4.1
12+
Homepage: https://www.swift.org
13+
14+
Package: swiftlang
15+
Architecture: all
16+
Depends: swiftlang-x.y.z, ${misc:Depends}
17+
Description: Swift programming language
18+
Swift is a general-purpose programming language built using
19+
a modern approach to safety, performance, and software design
20+
patterns.
21+
.
22+
The goal of the Swift project is to create the best available
23+
language for uses ranging from systems programming, to mobile
24+
and desktop apps, scaling up to cloud services. Most
25+
importantly, Swift is designed to make writing and maintaining
26+
correct programs easier for the developer.
27+
.
28+
This package contains the convenience symlinks for the latest
29+
version of Swift.
30+
31+
Package: swiftlang-x.y.z
32+
Architecture: amd64 arm64
33+
Depends: ${shlibs:Depends}, ${misc:Depends},
34+
libc6-dev, libgcc-9-dev, libstdc++-9-dev, libz3-dev, uuid-dev, zlib1g-dev,
35+
libxml2-dev, libcurl4-openssl-dev,
36+
binutils, git, pkg-config, tzdata, python3
37+
Description: Swift programming language, release x.y.z
38+
Swift is a general-purpose programming language built using
39+
a modern approach to safety, performance, and software design
40+
patterns.
41+
.
42+
The goal of the Swift project is to create the best available
43+
language for uses ranging from systems programming, to mobile
44+
and desktop apps, scaling up to cloud services. Most
45+
importantly, Swift is designed to make writing and maintaining
46+
correct programs easier for the developer.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
2+
Upstream-Name: swift
3+
Upstream-Contact: <preferred name and address to reach the upstream project>
4+
Source: <url://example.com>
5+
6+
Files: *
7+
Copyright: <years> <put author's name and email here>
8+
<years> <likewise for another author>
9+
License: Apache-2.0
10+
11+
Files: debian/*
12+
Copyright: <years> Author Name <[email protected]>
13+
License: Apache-2.0
14+
15+
License: Apache-2.0
16+
Licensed under the Apache License, Version 2.0 (the "License");
17+
you may not use this file except in compliance with the License.
18+
You may obtain a copy of the License at
19+
.
20+
https://www.apache.org/licenses/LICENSE-2.0
21+
.
22+
Unless required by applicable law or agreed to in writing, software
23+
distributed under the License is distributed on an "AS IS" BASIS,
24+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
25+
See the License for the specific language governing permissions and
26+
limitations under the License.
27+
.
28+
On Debian systems, the complete text of the Apache version 2.0 license
29+
can be found in "/usr/share/common-licenses/Apache-2.0".
30+
31+
# Please also look if there are files or directories which have a
32+
# different copyright/license attached and list them here.
33+
# Please avoid picking licenses with terms that are more restrictive than the
34+
# packaged work, as it may make Debian's contributions unacceptable upstream.
35+
#
36+
# If you need, there are some extra license texts available in two places:
37+
# /usr/share/debhelper/dh_make/licenses/
38+
# /usr/share/common-licenses/
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
#!/bin/sh
2+
3+
# This helper script will fetch the Swift sources, save the
4+
# tarballs following the appropriate naming convention, and
5+
# build a Debian source package.
6+
7+
# You will need the devscripts and quilt packages installed
8+
# to run this script and build the packages following these
9+
# instructions.
10+
11+
# Create swiftlang-X.Y.Z, unpack the debian tarball within,
12+
# proceed to adding the appropriate entry to the Debian
13+
# changelog, edit debian/source-version.sh, then run this
14+
# script from the directory containing swiftlang-X.Y.Z.
15+
# $ mkdir swiftlang-X.Y.Z
16+
# $ cd swiftlang-X.Y.Z
17+
# $ tar xvaf ../swiftlang_A.B.C-D.debian.tar.xz
18+
# $ dch -v X.Y.Z-1
19+
# $ cd ..
20+
# $ swiftlang-X.Y.Z/debian/getsource.sh
21+
#
22+
# This will download all the necessary sources, unpack them
23+
# as required, refresh any Debian patches, then create the
24+
# Debian source package.
25+
26+
# If all is well, proceed with building the packages.
27+
# $ cd swiftlang-X.Y.Z
28+
# $ DEB_BUILD_OPTIONS=parallel=64 debuild
29+
30+
set -eu
31+
32+
. $(dirname $0)/source-versions.sh
33+
34+
get_component ()
35+
{
36+
component=$1
37+
url="$2"
38+
39+
dest=swiftlang_${debversion}.orig-${component}
40+
41+
echo "Downloading ${component} from ${url}"
42+
43+
case "${url}" in
44+
*.zip)
45+
tmpdest=${component}.zip
46+
dest=${dest}.tar.gz
47+
48+
curl -L -o ${tmpdest} "${url}"
49+
mk-origtargz --package swiftlang -v ${debversion} -c ${component} --rename --compression gzip ${tmpdest}
50+
;;
51+
52+
*.tar.gz)
53+
dest=${dest}.tar.gz
54+
curl -L -o ${dest} "${url}"
55+
;;
56+
57+
*.tar.xz)
58+
dest=${dest}.tar.xz
59+
curl -L -o ${dest} "${url}"
60+
;;
61+
62+
*.tar.bz2)
63+
dest=${dest}.tar.bz2
64+
curl -L -o ${dest} "${url}"
65+
;;
66+
67+
*)
68+
echo "Source archive not in a suitable format for Debian sources: ${url}" >&2
69+
exit 1
70+
esac
71+
72+
mkdir swiftlang-${debversion}/${component}
73+
tar -C swiftlang-${debversion}/${component} --strip-components=1 -axf ${dest}
74+
}
75+
76+
get_component swift https://github.com/apple/swift/archive/swift-${swift_version}.tar.gz
77+
get_component swift-corelibs-libdispatch https://github.com/apple/swift-corelibs-libdispatch/archive/swift-${swift_version}.tar.gz
78+
get_component swift-corelibs-foundation https://github.com/apple/swift-corelibs-foundation/archive/swift-${swift_version}.tar.gz
79+
get_component swift-integration-tests https://github.com/apple/swift-integration-tests/archive/swift-${swift_version}.tar.gz
80+
get_component swift-corelibs-xctest https://github.com/apple/swift-corelibs-xctest/archive/swift-${swift_version}.tar.gz
81+
get_component swiftpm https://github.com/apple/swift-package-manager/archive/swift-${swift_version}.tar.gz
82+
get_component llbuild https://github.com/apple/swift-llbuild/archive/swift-${swift_version}.tar.gz
83+
get_component cmark https://github.com/apple/swift-cmark/archive/swift-${swift_version}.tar.gz
84+
get_component swift-xcode-playground-support https://github.com/apple/swift-xcode-playground-support/archive/swift-${swift_version}.tar.gz
85+
get_component sourcekit-lsp https://github.com/apple/sourcekit-lsp/archive/swift-${swift_version}.tar.gz
86+
get_component indexstore-db https://github.com/apple/indexstore-db/archive/swift-${swift_version}.tar.gz
87+
get_component llvm-project https://github.com/apple/llvm-project/archive/swift-${swift_version}.tar.gz
88+
get_component swift-tools-support-core https://github.com/apple/swift-tools-support-core/archive/swift-${swift_version}.tar.gz
89+
get_component swift-argument-parser https://github.com/apple/swift-argument-parser/archive/${swift_argument_parser_version}.tar.gz
90+
get_component swift-driver https://github.com/apple/swift-driver/archive/swift-${swift_version}.tar.gz
91+
get_component icu https://github.com/unicode-org/icu/archive/release-${icu_version}.tar.gz
92+
get_component swift-crypto https://github.com/apple/swift-crypto/archive/refs/tags/${swift_crypto_version}.tar.gz
93+
get_component ninja https://github.com/ninja-build/ninja/archive/refs/tags/v${ninja_version}.tar.gz
94+
get_component cmake https://github.com/KitWare/CMake/archive/refs/tags/v${cmake_version}.tar.gz
95+
get_component swift-syntax https://github.com/apple/swift-syntax/archive/swift-${swift_version}.tar.gz
96+
get_component yams https://github.com/jpsim/Yams/archive/${yams_version}.tar.gz
97+
get_component swift-atomics https://github.com/apple/swift-atomics/archive/${swift_atomics_version}.tar.gz
98+
get_component swift-cmark-gfm https://github.com/apple/swift-cmark/archive/swift-${swift_version}-gfm.tar.gz
99+
get_component swift-docc https://github.com/apple/swift-docc/archive/swift-${swift_version}.tar.gz
100+
get_component swift-docc-render-artifact https://github.com/apple/swift-docc-render-artifact/archive/swift-${swift_version}.tar.gz
101+
get_component swift-docc-symbolkit https://github.com/apple/swift-docc-symbolkit/archive/swift-${swift_version}.tar.gz
102+
get_component swift-collections https://github.com/apple/swift-collections/archive/${swift_collections_version}.tar.gz
103+
get_component swift-numerics https://github.com/apple/swift-numerics/archive/${swift_numerics_version}.tar.gz
104+
get_component swift-system https://github.com/apple/swift-system/archive/${swift_system_version}.tar.gz
105+
get_component swift-nio https://github.com/apple/swift-nio/archive/${swift_nio_version}.tar.gz
106+
get_component swift-nio-ssl https://github.com/apple/swift-nio-ssl/archive/${swift_nio_ssl_version}.tar.gz
107+
get_component swift-format https://github.com/apple/swift-format/archive/swift-${swift_version}.tar.gz
108+
get_component swift-lmdb https://github.com/apple/swift-lmdb/archive/swift-${swift_version}.tar.gz
109+
get_component swift-markdown https://github.com/apple/swift-markdown/archive/swift-${swift_version}.tar.gz
110+
111+
# Refresh patches, if any
112+
if [ -s swiftlang-${debversion}/debian/patches/series ]; then
113+
cd swiftlang-${debversion}
114+
115+
export QUILT_PATCHES=debian/patches
116+
export QUILT_REFRESH_ARGS="-p ab --no-timestamps --no-index"
117+
118+
while quilt push; do quilt refresh; done
119+
quilt pop -a
120+
121+
cd -
122+
fi
123+
124+
dpkg-source --create-empty-orig -b swiftlang-${debversion}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
Description: Change the target installation directory
2+
Presets will be modified to use the command line, after
3+
the dust settles.
4+
Author: Julien Blache <[email protected]>
5+
6+
Index: swiftlang-5.6.0/swift/utils/build-presets.ini
7+
===================================================================
8+
--- swiftlang-5.6.0.orig/swift/utils/build-presets.ini
9+
+++ swiftlang-5.6.0/swift/utils/build-presets.ini
10+
@@ -831,7 +831,7 @@ install-swiftpm
11+
install-swift-driver
12+
install-xctest
13+
install-libicu
14+
-install-prefix=/usr
15+
+install-prefix=/opt/swift/5.6.0
16+
install-libcxx
17+
install-sourcekit-lsp
18+
install-swiftdocc
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
Description: Enable parallel boostrap for CMake
2+
CMake's bootstrap can be parallelized, but wasn't.
3+
Author: Julien Blache <[email protected]>
4+
5+
Index: swiftlang-5.6.0/swift/utils/swift_build_support/swift_build_support/cmake.py
6+
===================================================================
7+
--- swiftlang-5.6.0.orig/swift/utils/swift_build_support/swift_build_support/cmake.py
8+
+++ swiftlang-5.6.0/swift/utils/swift_build_support/swift_build_support/cmake.py
9+
@@ -267,8 +267,10 @@ class CMake(object):
10+
11+
cwd = os.getcwd()
12+
os.chdir(cmake_build_dir)
13+
- shell.call_without_sleeping([cmake_bootstrap, '--no-qt-gui', '--',
14+
- '-DCMAKE_USE_OPENSSL=OFF'], echo=True)
15+
+ shell.call_without_sleeping([cmake_bootstrap, '--no-qt-gui',
16+
+ '--parallel=%s' % self.args.build_jobs,
17+
+ '--', '-DCMAKE_USE_OPENSSL=OFF'],
18+
+ echo=True)
19+
shell.call_without_sleeping(['make', '-j%s' % self.args.build_jobs],
20+
echo=True)
21+
os.chdir(cwd)

0 commit comments

Comments
 (0)