summaryrefslogtreecommitdiff
path: root/strata/build-essential/gcc-runtime.morph
blob: 78547dd7e6f2df711212df546b09078de9d22121 (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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
name: gcc-runtime
kind: chunk
build-system: autotools
configure-commands:
- mkdir o
- |
  case "$MORPH_ARCH" in
      armv7lhf) ARCH_FLAGS="--with-arch=armv7-a \
                            --with-cpu=cortex-a9 \
                            --with-tune=cortex-a9 \
                            --with-fpu=vfpv3-d16 \
                            --with-float=hard" ;;
      armv7*)   ARCH_FLAGS="--with-arch=armv7-a" ;;
  esac

  # Do some really ugly setup stuff here, writing outside of our build area
  #
  ln -s . /usr/${TARGET}
  ln -s /tools/usr/cc /usr/cc
  ln -s /tools/usr/c++ /usr/c++
  cd o

  # Finally we're ready to run configure
  #
  RANLIB=`which ranlib` AR=`which ar` RANLIB_FOR_TARGET=`which ranlib` \
  AR_FOR_TARGET=`which ar` NM_FOR_TARGET=`which nm` AS_FOR_TARGET=`which as` \
  ac_cv_path_AR_FOR_TARGET=`which ar` \
  ac_cv_path_RANLIB_FOR_TARGET=`which ranlib` \
  ac_cv_path_NM_FOR_TARGET=`which nm` \
  ac_cv_path_AS_FOR_TARGET=`which as` \
  ac_cv_path_LD_FOR_TARGET=`which ld` \
  ../configure $ARCH_FLAGS --prefix="$PREFIX" \
               --build=${TARGET_MUSL}	      \
               --host=${TARGET_MUSL}	      \
               --target=${TARGET}	      \
               --disable-multilib --disable-libmudflap \
               --disable-libsanitizer --enable-tls --disable-lto \
               --disable-nls --enable-c99 --enable-__cxa_atexit \
               --enable-long-long --enable-shared \
               --enable-threads=posix --enable-languages=c,c++
build-commands:
- |
  # Here we specify LD_LIBRARY_PATH so that the built host tools which
  # run during the gcc build find the musl based libstdc++
  export LD_LIBRARY_PATH=/tools/usr/lib
  cd o
  make
install-commands:
- |
  # Thats right, still need to run C++ programs we built
  # at install time, so still need to set LD_LIBRARY_PATH
  export LD_LIBRARY_PATH=/tools/usr/lib
  cd o
  make DESTDIR=`pwd`/temp install

  # Create compiler specific directories that ccwrap searches in
  mkdir -p ${DESTDIR}/usr/cc/lib
  mkdir -p ${DESTDIR}/usr/c++

  # Get rid of a pesky directory first
  rm -rf temp/usr/lib/gcc/*/*/install-tools

  # Move the C headers in place
  mv temp/usr/lib/gcc/*/*/include ${DESTDIR}/usr/cc/include

  # Move gcc start/end stubs and static libraries in place,
  # this also includes the 'fixed-headers' directory
  #
  mv temp/usr/lib/gcc/*/*/* ${DESTDIR}/usr/cc/lib

  # Move C++ headers in place
  mv temp/usr/${TARGET}/include/c++/* ${DESTDIR}/usr/c++/include

  # Link the extra include path, the ccwrap program expects it in extra-includes
  ln -s ${TARGET} ${DESTDIR}/usr/c++/include/extra-includes

  # Finally move the target libstdc++ and other target libraries into the regular libdir
  mv temp/usr/${TARGET}/lib ${DESTDIR}/usr/lib