aboutsummaryrefslogtreecommitdiff
path: root/tl-build.sh
blob: dcf3bfeed5b6f9e937c1707e88913a46f25a27da (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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
#!/bin/sh

# Public domain.  Originally written 2005 by Karl Berry.

this_dir=`pwd`
tl_sourcedir=${this_dir}/source

. ${this_dir}/variables.conf

echo ""
echo "            TeX Live for OpenBSD built script                "
echo ""
echo "You are about to build TeX Live from the development sources."
echo "Please specify whether you also want to include xindy, context"
echo "and asymptote in the process."
echo ""

echo "Do I have to get the sources?  (You ought to have done so before launching this script.)"
read get_dev_src?'[y/n] '
if [[ ${get_dev_src} == "y" ]]; then
    ./checkout-tl.sh $1 && echo "... Ok."
fi

echo "Include clisp and xindy?"
read with_clisp?'[y/n] '
enable_xindy=""

# Context
echo "Include Context?"
read with_context?'[y/n] '

# Asymptote
echo "Include Asymptote?"
read with_asymptote?'[y/n] '

# TL
echo "Build TL?"
read build_tl?'[y/n] '

# First build: clisp
if [[ ${with_clisp} == "y" ]]; then
    mkdir $tl_sourcedir/clisp && cd $tl_sourcedir/clisp
    utils_README=$tl_sourcedir/utils/README
    clisp_basedir=`pwd`
    clisp_toolsdir=$clisp_basedir/clisp-tools
    clisp_builddir=$clisp_basedir/clisp-build
    mkdir $clisp_toolsdir
    wget=wget  # or "curl -O" or whatever
    #libsigsegv_ver=libsigsegv-2.13
    libsigsegv_ver=$(cat ${utils_README} | grep libsigsegv_ver= | sed 's/.*=//')
    cd $clisp_basedir
    $wget http://ftp.gnu.org/gnu/libsigsegv/$libsigsegv_ver.tar.gz
    gzip -dc $libsigsegv_ver.tar.gz | tar xf -
    cd $libsigsegv_ver
    ./configure -C --prefix=$clisp_toolsdir --disable-shared --enable-static \
	&& make && make check && make install
    # iconv
    #libiconv_ver=libiconv-1.16
    libiconv_ver=$(cat ${utils_README} | grep libiconv_ver= | sed 's/.*=//')
    cd $clisp_basedir
    $wget http://ftp.gnu.org/gnu/libiconv/$libiconv_ver.tar.gz
    gzip -dc $libiconv_ver.tar.gz | tar xf -
    cd $libiconv_ver
    ./configure -C --prefix=$clisp_toolsdir \
		--disable-shared --enable-static --disable-nls \
	&& make && make check && make install
    
    #clisp_ver=clisp-2.49.92
    clisp_ver=$(cat ${utils_README} | grep clisp_ver= | sed 's/.*=//')
    cd $clisp_basedir
    $wget https://alpha.gnu.org/gnu/clisp/$clisp_ver.tar.bz2
    bunzip2 -dc $clisp_ver.tar.bz2 | tar xf -
    cd $clisp_ver
    ./configure CPPFLAGS=-DUNIX_BINARY_DISTRIB --prefix=$clisp_toolsdir \
		--without-readline --without-dynamic-modules \
		--disable-nls \
		--with-libsigsegv-prefix=$clisp_toolsdir \
		--with-libiconv-prefix=$clisp_toolsdir \
		$clisp_builddir \
	&& (cd $clisp_builddir && make)
    # define --enable-xindy variable
    enable_xindy="--enable-xindy CLISP=$clisp_builddir/clisp"
fi

# If Context is required, then retrieve and build it first
if [[ ${with_context} == "y" ]]; then
    cd $tl_sourcedir
    if [[ -e $1 ]];then
	context_ver=$(svn list svn://tug.org/texlive/branches/branch${TL_BRANCH}/Master/source | grep luametatex-.*xz | sed 's/.*-\(.*\).tar.xz/\1/')
	if [[ -d luametatex ]];then
	    rm -f luametatex-{$context_ver}.tar.xz
	    rm -rf luametatex
	fi
	svn export svn://tug.org/texlive/branches/branch${TL_BRANCH}/Master/source/luametatex-${context_ver}.tar.xz
    else
	context_ver=$(svn list svn://tug.org/texlive/trunk/Master/source | grep luametatex-.*xz | sed 's/.*-\(.*\).tar.xz/\1/')
	if [[ -d luametatex ]];then
	    rm -f luametatex-{$context_ver}.tar.xz
	    rm -rf luametatex
	fi
	svn export svn://tug.org/texlive/trunk/Master/source/luametatex-${context_ver}.tar.xz
    fi
    xzcat luametatex-$context_ver.tar.xz | tar xf -
    luametatex_src_dir=$(xzcat luametatex-$context_ver.tar.xz | tar tf - | head -1)
    cd ${luametatex_src_dir}
    sh build.sh
fi

function include_context {
    cd ${tl_sourcedir}
    if [[ -d ${tl_sourcedir}/inst/bin ]];then
	tl_bindir=${tl_sourcedir}/inst/bin/`ls ${tl_sourcedir}/inst/bin`
	cp ${luametatex_src_dir}/build/native/luametatex $tl_bindir
	cd ${tl_bindir}
	ln -s luametatex context
	ln -s luametatex mtxrun
	ln -s ../../texmf-dist/scripts/context/lua/context.lua context.lua
	ln -s ../../texmf-dist/scripts/context/lua/mtxrun.lua mtxrun.lua
	ln -s ../../texmf-dist/scripts/context-texlive/stubs-mkiv/unix/luatools luatools
	ln -s ../../texmf-dist/scripts/context-texlive/stubs-mkiv/unix/contextjit contextjit
	ln -s ../../texmf-dist/scripts/context-texlive/stubs-mkiv/unix/mtxrunjit mtxrunjit
	ln -s ../../texmf-dist/scripts/context-texlive/stubs/unix/texexec texexec
	ln -s ../../texmf-dist/scripts/context-texlive/stubs/unix/texmfstart texmfstart
    fi
}

# Build Asymptote
if [[ ${with_asymptote} == "y" ]];then
    cd ${tl_sourcedir}/utils/asymptote
    ./configure --prefix=/tmp/asyinst --enable-texlive-build \
		--enable-static CXXFLAGS=-std=c++11 \
		--disable-curl --disable-lsp --disable-gsl --disable-fftw
    sed -i.bak -e 's/^LIBS = /LIBS = -static /' Makefile
    gmake
    strip asy
fi

function include_asymptote {
    cd ${tl_sourcedir}
    if [[ -d ${tl_sourcedir}/inst/bin ]];then
	tl_bindir=${tl_sourcedir}/inst/bin/`ls ${tl_sourcedir}/inst/bin`
	cp utils/asymptote/asy ${tl_bindir}
	cd ${tl_bindir}
	ln -s ../../texmf-dist/asymptote/GUI/xasy.py xasy
    fi
}

function include_extras {
    if [[ -d ${tl_sourcedir}/inst/bin ]];then
	tl_bindir=${tl_sourcedir}/inst/bin/`ls ${tl_sourcedir}/inst/bin`
	install -m 0755 ${this_dir}/tlobsd-mksymlinks ${tl_bindir}/tlobsd-mksymlinks
	install -m 0755 ${this_dir}/tlobsd ${tl_bindir}/tlobsd
    fi
}

# Now build TL
if [[ ${build_tl} == "y" ]]; then
    cd ${tl_sourcedir}
    export TL_MAKE=gmake
    ./Build ${enable_xindy}
    if [[ ${with_context} == "y" ]]; then
	include_context
    fi
    if [[ ${with_asymptote} == "y" ]];then
	include_asymptote
    fi
    include_extras
else
    if [[ ${with_context} == "y" ]]; then
	include_context
    fi    
    if [[ ${with_asymptote} == "y" ]];then
	include_asymptote
    fi
fi

cd ${this_dir}