File: compiler.bats

package info (click to toggle)
ruby-build 20241225.2-1.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,988 kB
  • sloc: sh: 1,980; makefile: 19; ruby: 14
file content (45 lines) | stat: -rwxr-xr-x 911 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
#!/usr/bin/env bats

load test_helper
export MAKE=make
export MAKE_OPTS='-j 2'
export -n CFLAGS
export -n CC
export -n RUBY_CONFIGURE_OPTS

@test "CC=clang by default on OS X 10.10" {
  mkdir -p "$INSTALL_ROOT"
  cd "$INSTALL_ROOT"

  stub_repeated uname '-s : echo Darwin'
  stub sw_vers '-productVersion : echo 10.10'
  stub_repeated brew 'false'
  # shellcheck disable=SC2016
  stub_repeated make 'echo "make $(inspect_args "$@")" >> build.log'

  cat > ./configure <<CON
#!${BASH}
echo ./configure "\$@" > build.log
echo CC=\$CC >> build.log
echo CFLAGS=\${CFLAGS-no} >> build.log
CON
  chmod +x ./configure

  run_inline_definition <<DEF
build_package_standard ruby-2.5.0
DEF
  assert_success
  run cat build.log
  assert_output <<OUT
./configure --prefix=$INSTALL_ROOT --with-ext=openssl,psych,+
CC=clang
CFLAGS=no
make -j 2
make install
OUT

  unstub uname
  unstub sw_vers
  unstub brew
  unstub make
}