File tree Expand file tree Collapse file tree 5 files changed +36
-7
lines changed Expand file tree Collapse file tree 5 files changed +36
-7
lines changed Original file line number Diff line number Diff line change @@ -61,7 +61,7 @@ version = "2.32.0"
61
61
default-features = false
62
62
features = [" suggestions" ]
63
63
64
- [target .'cfg(target_env = "musl")' .dependencies .jemallocator ]
64
+ [target .'cfg(all( target_env = "musl", target_pointer_width = "64") )' .dependencies .jemallocator ]
65
65
version = " 0.3.0"
66
66
67
67
[build-dependencies ]
Original file line number Diff line number Diff line change @@ -8,12 +8,13 @@ set -ex
8
8
9
9
# Generate artifacts for release
10
10
mk_artifacts () {
11
+ CARGO=" $( builder) "
11
12
if is_arm; then
12
- cargo build --target " $TARGET " --release
13
+ " $CARGO " build --target " $TARGET " --release
13
14
else
14
15
# Technically, MUSL builds will force PCRE2 to get statically compiled,
15
16
# but we also want PCRE2 statically build for macOS binaries.
16
- PCRE2_SYS_STATIC=1 cargo build --target " $TARGET " --release --features ' pcre2'
17
+ PCRE2_SYS_STATIC=1 " $CARGO " build --target " $TARGET " --release --features ' pcre2'
17
18
fi
18
19
}
19
20
Original file line number Diff line number Diff line change @@ -7,11 +7,13 @@ set -ex
7
7
. " $( dirname $0 ) /utils.sh"
8
8
9
9
main () {
10
+ CARGO=" $( builder) "
11
+
10
12
# Test a normal debug build.
11
13
if is_arm; then
12
- cargo build --target " $TARGET " --verbose
14
+ " $CARGO " build --target " $TARGET " --verbose
13
15
else
14
- cargo build --target " $TARGET " --verbose --all --features ' pcre2'
16
+ " $CARGO " build --target " $TARGET " --verbose --all --features ' pcre2'
15
17
fi
16
18
17
19
# Show the output of the most recent build.rs stderr.
@@ -44,7 +46,7 @@ main() {
44
46
" $( dirname " ${0} " ) /test_complete.sh"
45
47
46
48
# Run tests for ripgrep and all sub-crates.
47
- cargo test --target " $TARGET " --verbose --all --features ' pcre2'
49
+ " $CARGO " test --target " $TARGET " --verbose --all --features ' pcre2'
48
50
}
49
51
50
52
main
Original file line number Diff line number Diff line change @@ -55,13 +55,27 @@ gcc_prefix() {
55
55
esac
56
56
}
57
57
58
+ is_musl () {
59
+ case " $TARGET " in
60
+ * -musl) return 0 ;;
61
+ * ) return 1 ;;
62
+ esac
63
+ }
64
+
58
65
is_x86 () {
59
66
case " $( architecture) " in
60
67
amd64|i386) return 0 ;;
61
68
* ) return 1 ;;
62
69
esac
63
70
}
64
71
72
+ is_x86_64 () {
73
+ case " $( architecture) " in
74
+ amd64) return 0 ;;
75
+ * ) return 1 ;;
76
+ esac
77
+ }
78
+
65
79
is_arm () {
66
80
case " $( architecture) " in
67
81
armhf) return 0 ;;
@@ -82,3 +96,12 @@ is_osx() {
82
96
* ) return 1 ;;
83
97
esac
84
98
}
99
+
100
+ builder () {
101
+ if is_musl && is_x86_64; then
102
+ cargo install cross
103
+ echo " cross"
104
+ else
105
+ echo " cargo"
106
+ fi
107
+ }
Original file line number Diff line number Diff line change @@ -35,7 +35,10 @@ mod subject;
35
35
// We don't unconditionally use jemalloc because it can be nice to use the
36
36
// system's default allocator by default. Moreover, jemalloc seems to increase
37
37
// compilation times by a bit.
38
- #[ cfg( target_env = "musl" ) ]
38
+ //
39
+ // Moreover, we only do this on 64-bit systems since jemalloc doesn't support
40
+ // i686.
41
+ #[ cfg( all( target_env = "musl" , target_pointer_width = "64" ) ) ]
39
42
#[ global_allocator]
40
43
static ALLOC : jemallocator:: Jemalloc = jemallocator:: Jemalloc ;
41
44
You can’t perform that action at this time.
0 commit comments