summaryrefslogtreecommitdiff
path: root/Build/source/.github/scripts/build-tl.sh
blob: b966800b2164cccd84b1bb2c02b772fc59fe42e0 (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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
#!/bin/sh -l

set -e

if [ "x$2" = "x" ]
then
  echo "Usage: `basename $0` arch buildsys [steps]" >&2
  exit 1
fi

arch="$1"
echo "Building TL for arch = $arch"
shift

buildsys=$1
echo "Building on $buildsys"
shift

STEPS=",$1,"
shift
if [ "x$STEPS" = "x" ]
  STEPS=",prepare,build,"
fi

destdir="$1"
shift

if [[ "$STEPS" == *,prepare,* ]]
then
  case $buildsys in 
     ubuntu|debian)
       export DEBIAN_FRONTEND=noninteractive
       export LANG=C.UTF-8
       export LC_ALL=C.UTF-8
       apt-get update -q -y
       apt-get install -y --no-install-recommends bash gcc g++ make perl libfontconfig-dev libx11-dev libxmu-dev libxaw7-dev build-essential
       ;;
     centos)
       yum update -y
       yum install -y centos-release-scl
       yum install -y devtoolset-9 fontconfig-devel libX11-devel libXmu-devel libXaw-devel
       ;;
     alpine)
       apk update
       apk add --no-progress bash gcc g++ make perl fontconfig-dev libx11-dev libxmu-dev libxaw-dev
       ;;
     freebsd|netbsd)
       pkg install gmake gcc pkgconf libX11 libXt libXaw fontconfig
       ;;
     solaris)
       echo "Solaris support is WIP, please help!" >&2
       exit 1
     *)
       echo "Unsupported build system: $buildsys" >&2
       exit 1
  esac


  # for CentOS we need to activate gcc-9
  if [ -f /opt/rh/devtoolset-9/enable ]
  then
    # we cannot call scl enable devtoolset-9 here since we need
    # the settings in the running shell
    . /opt/rh/devtoolset-9/enable
  fi
fi

if [[ "$STEPS" == *,build,* ]]
then
  find . -name \*.info -exec touch '{}' \;
  touch ./texk/detex/detex-src/detex.c
  touch ./texk/detex/detex-src/detex.h
  touch ./texk/gregorio/gregorio-src/src/gabc/gabc-score-determination.c
  touch ./texk/gregorio/gregorio-src/src/gabc/gabc-score-determination.h
  touch ./texk/gregorio/gregorio-src/src/vowel/vowel-rules.h
  touch ./texk/web2c/omegafonts/pl-lexer.c
  touch ./texk/web2c/omegafonts/pl-parser.c
  touch ./texk/web2c/omegafonts/pl-parser.h
  touch ./texk/web2c/otps/otp-lexer.c
  touch ./texk/web2c/otps/otp-parser.c
  touch ./texk/web2c/otps/otp-parser.h
  touch ./texk/web2c/web2c/web2c-lexer.c
  touch ./texk/web2c/web2c/web2c-parser.c
  touch ./texk/web2c/web2c/web2c-parser.h
  touch ./utils/asymptote/camp.tab.cc
  touch ./utils/asymptote/camp.tab.h
  touch ./utils/lacheck/lacheck.c
  touch ./utils/xindy/xindy-src/tex2xindy/tex2xindy.c
  
  # default settings
  TL_MAKE_FLAGS="-j 2"
  BUILDARGS=""
  
  # special cases
  case "$arch" in
    armhf-linux)
      TL_MAKE_FLAGS="-j 1"
      ;;
    aarch64-linux)
      BUILDARGS="--enable-arm-neon=on"
      ;;
    *-solaris)
      export CC="/path/to/gcc-5.5 -m64"
      export CXX="/path/to/g++-5.5 -m64"
      ;;
    *-freebsd)
      export TL_MAKE=gmake
      export CC=gcc 
      export CXX=g++
      export CFLAGS=-D_NETBSD_SOURCE
      export CXXFLAGS='-D_NETBSD_SOURCE -std=c++11'
      ;;
  esac
  export TL_MAKE_FLAGS
  
  ./Build -C $BUILDARGS
  
  mv inst/bin/* $arch
  tar czvf texlive-bin-$arch.tar.gz $arch
fi