summaryrefslogtreecommitdiff
path: root/strata/build-essential/stage2-musl.morph
blob: 92b55f28ccbd05fe8d734f42b32a29b84cd419e0 (plain)
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
name: stage2-musl
kind: chunk
configure-commands:
# Configure flag notes:
#   1. Avoid installing to PREFIX/lib64 on x86_64.
#   2. Location of linux-api-headers.
#   3. Normal flags. See glibc.morph.
#   4. Force configuration values of certain things that can't be detected
#      in a cross-compile.
- |
  TARGET_STAGE1=`echo $TARGET_STAGE1 | sed -e 's/bootstrap-linux-gnu/linux-musl/'`; \
  export CFLAGS="-O2 $CFLAGS"; export CXX=false; \
  ./configure \
    CROSS_COMPILE="$TARGET_STAGE1-" \
    $ARCH_FLAGS \
    --prefix="$PREFIX" \
    --host=$TARGET_STAGE1 \
    --disable-gcc-wrapper \
    `# [1]` --libdir="$PREFIX/lib" \
    `# [2]` --with-headers="$(pwd)/../../$PREFIX/include" \
    `# [3]` --disable-profile  --enable-kernel=2.6.25 \
    `# [4]` libc_cv_c_cleanup=yes libc_cv_ctors_header=yes \
            libc_cv_forced_unwind=yes libc_cv_ssp=no

build-commands:
- make localtime=UTC

install-commands:
- make install_root="$DESTDIR" localtime=UTC install
- export TARGET_STAGE1=`echo $TARGET_STAGE1 | sed -e 's/bootstrap-linux-gnu/linux-musl/'`; sh stage2-musl-fix-specs

# Install a symlink for the program interpreter (ld.so) so that binaries
# built in stage 3 before the stage 3 musl is built can use it.        
# sysdeps/unix/sysv/linux/configure.      
- install -d $DESTDIR/lib           
- |                      
  case "$MORPH_ARCH" in
      armv7b|armv7l|armv7lhf)
          ARCH="arm" ;;
      x86_32)
          ARCH="i386" ;;
      x86_64)
          ARCH="x86_64" ;;
      ppc64)
          ARCH="powerpc" ;;
      mips*)
          ARCH="mips" ;;
      *)
          echo "Error: unsupported Morph architecture: $MORPH_ARCH" >&2
          exit 1
  esac
  loader=$(basename $(ls "$DESTDIR$PREFIX"/lib/libc.so))
  [ -z $loader ] && ( echo "Bug in stage2-musl ld.so symlinks" ; exit 1 )
   cd "$DESTDIR$PREFIX"/lib ; ln -s $loader ld-musl-$ARCH.so.1