Skip to content

Commit

Permalink
chore(build): use mold linker instead of lld if available
Browse files Browse the repository at this point in the history
  • Loading branch information
mmstick committed Dec 12, 2023
1 parent ca1be40 commit 1d7cedf
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ To compile, a stable Rust compiler and [just](https://github.com/casey/just) are

- cargo
- just
- lld
- mold

Some C libraries are also required for font support at the moment.

Expand Down
12 changes: 6 additions & 6 deletions debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@ Priority: optional
Maintainer: Michael Murphy <[email protected]>
Build-Depends:
debhelper-compat (=13),
just (>= 1.13.0),
rust-all,
cmake,
just (>= 1.13.0),
libexpat1-dev,
libfontconfig-dev,
libfreetype-dev,
lld,
libinput-dev,
libudev-dev,
libwayland-dev,
pkg-config,
libxkbcommon-dev,
libudev-dev,
libinput-dev
mold,
pkg-config,
rust-all,
Standards-Version: 4.6.2
Homepage: https://github.com/pop-os/cosmic-settings

Expand Down
22 changes: 11 additions & 11 deletions justfile
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
name := 'cosmic-settings'
appid := 'com.system76.CosmicSettings'

# Use lld linker if available
ld-args := if `which lld || true` != '' {
'-C link-arg=-fuse-ld=lld -C link-arg=-Wl,--build-id=sha1'
# Use mold linker if clang and mold exists.
clang-path := `which clang || true`
mold-path := `which mold || true`

linker-arg := if clang-path != '' {
if mold-path != '' {
'-C linker=' + clang-path + ' -C link-arg=--ld-path=' + mold-path + ' '
} else {
''
}
} else {
''
}

# Use the x86-64-v2 target by default on x86-64 systems.
target-cpu := if arch() == 'x86_64' { 'x86-64-v2' } else { '' }

export RUSTFLAGS := if target-cpu != '' {
ld-args + ' -C target-cpu=' + target-cpu + ' ' + env_var_or_default('RUSTFLAGS', '')
} else {
ld-args + ' ' + env_var_or_default('RUSTFLAGS', '')
}
export RUSTFLAGS := linker-arg + env_var_or_default('RUSTFLAGS', '')

rootdir := ''
prefix := '/usr'
Expand Down

0 comments on commit 1d7cedf

Please sign in to comment.