File: rules

package info (click to toggle)
swiftlang 6.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,519,992 kB
  • sloc: cpp: 9,107,863; ansic: 2,040,022; asm: 1,135,751; python: 296,500; objc: 82,456; f90: 60,502; lisp: 34,951; pascal: 19,946; sh: 18,133; perl: 7,482; ml: 4,937; javascript: 4,117; makefile: 3,840; awk: 3,535; xml: 914; fortran: 619; cs: 573; ruby: 573
file content (113 lines) | stat: -rwxr-xr-x 4,180 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
#!/usr/bin/make -f

include /usr/share/dpkg/pkg-info.mk

export DH_VERBOSE = 1


# see FEATURE AREAS in dpkg-buildflags(1)
#export DEB_BUILD_MAINT_OPTIONS = hardening=+all

# see ENVIRONMENT in dpkg-buildflags(1)
# package maintainers to append CFLAGS
#export DEB_CFLAGS_MAINT_APPEND  = -Wall -pedantic
# package maintainers to append LDFLAGS
#export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed

# Disable LTO on Ubuntu where they enable it by default which breaks the
# build
export DEB_BUILD_MAINT_OPTIONS=$(shell if dpkg-vendor --derives-from Ubuntu; then echo "optimize=-lto"; fi)
export DEB_BUILD_MAINT_OPTIONS=$(shell if dpkg-vendor --derives-from Debian; then echo "optimize=-lto"; fi)

VERSION = $(DEB_VERSION_UPSTREAM)

export PATH := $(CURDIR)/binforpython:$(PATH)

BUILD_SCRIPT_ARGS =
ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
	NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
	BUILD_SCRIPT_ARGS += -j $(NUMJOBS)
endif

%:
	dh $@

override_dh_auto_configure:
	mkdir -p $(CURDIR)/binforpython
	if test ! -f $(CURDIR)/binforpython/python; then \
		ln -s /usr/bin/python3 $(CURDIR)/binforpython/python; \
	fi

override_dh_auto_build:
	swift/utils/build-script $(BUILD_SCRIPT_ARGS) --preset=buildbot_linux,no_test install_destdir=$(CURDIR) installable_package=$(CURDIR)/swiftlang_$(VERSION)-debian.tar.gz

override_dh_auto_install:
	mkdir -p lib/swift
	cp -r usr/* lib/swift
	mkdir -p bin
	mkdir -p lib
	ln -fs lib/swift/bin/swift bin/swift
	ln -fs lib/swift/bin/swiftc bin/swiftc
	ln -fs lib/swift/bin/sourcekit-lsp bin/sourcekit-lsp
	ln -fs libexec/swift/lib/swift lib/swift
	rm -f usr/share/swift/LICENSE.txt
	rm -rf usr/bin/sdk-module-lists
	rm -f usr/bin/*.cfg

execute_after_dh_fixperms:
	if test -d debian/swiftlang; then \
	    chmod -f -x debian/swiftlang/usr/libexec/swift/bin/sdk-module-lists/create-module-lists.sh; \
	    chmod -f -x debian/swiftlang/usr/libexec/swift/bin/sdk-module-lists/*.txt; \
	    find debian/swiftlang/usr/libexec/swift/lib -type f -exec chmod -f 0644 -- {} +; \
	    find debian/swiftlang/usr/libexec/swift/share -type f -exec chmod -f 0644 -- {} +; \
	fi
	if test -d debian/libswiftlang; then \
	    find debian/libswiftlang/usr/libexec/swift/lib -type f -exec chmod -f 0644 -- {} +; \
	fi
	if test -d debian/swiftlang-dev; then \
	    find debian/swiftlang-dev/usr/libexec/swift/include -type f -exec chmod 0644 -f -- {} +; \
	    find debian/swiftlang-dev/usr/libexec/swift/local -type f -exec chmod 0644 -f -- {} +; \
	fi
	if test -d debian/swiftlang-doc; then \
	    find debian/swiftlang-doc/usr/libexec/swift/share -type f -exec chmod 0644 -f -- {} +; \
	fi

EXCLUDE_DWZ_BINS = lldb-server sourcekit-lsp swift-build swift-build-sdk-interfaces \
    swift-driver swift-frontend swift-help swift-package swift-package-collection \
    swift-run swift-test liblldb.so libsourcekitdInProc.so lib_InternalSwiftScan.so \
    lib_InternalSwiftSyntaxParser.so libPackageDescription.so libPackagePlugin.so \
    docc libBlocksRuntime.so libFoundation.so libFoundationNetworking.so \
    libFoundationXML.so libdispatch.so libswiftDispatch.so libclang_rt libllbuild.so \
    plutil libllbuildSwift.so lib_FoundationICU.so swift-format

override_dh_dwz:
	# These binaries have "Unknown" debugging sections which cause dwz to return 1
	dh_dwz $(foreach bin,$(EXCLUDE_DWZ_BINS),--exclude=$(bin))

# Running strip on repl_swift breaks the Swift REPL
override_dh_strip:
	dh_strip --exclude=swift/bin/repl_swift

override_dh_shlibdeps:
	dh_shlibdeps -ldebian/libswiftlang/usr/libexec/swift/lib/swift/linux/

override_dh_auto_clean:
	rm -rf $(CURDIR)/binforpython
	rm -rf debian/libswiftlang
	rm -rf debian/swiftlang
	rm -rf debian/swiftlang-dev
	rm -rf debian/swiftlang-doc
	rm -rf build
	rm -rf usr
	rm -rf lib
	rm -rf bin
	rm -rf man
	rm -f swiftlang_$(VERSION)-debian.tar.gz
	rm -f swift-corelibs-libdispatch/dispatch/module.mod
	rm -f swift-corelibs-libdispatch/dispatch/module.modulemap
	rm -f swift-corelibs-libdispatch/private/module.modulemap
	rm -f swift-driver/Package.resolved
	rm -f swift-docc/Package.resolved
	rm -rf swift-integration-tests/test-swift-docc/Output
	py3clean .
	debconf-updatepo