forked from fzimmermann89/texlive.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
150 lines (121 loc) · 4.72 KB
/
Makefile
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
TLVERSION = $(shell wget -qO- http://mirrors.ctan.org/systems/texlive/Source | grep -o 'texlive-[^-]*-source.tar.xz' | grep -o -m1 '[0-9]\{8\}[^-]\?')
TLDATE = $(shell echo ${TLVERSION}|grep -o [[:digit:]]*)
TLDIR = texlive-${TLDATE}-source
TLFILE = texlive-${TLVERSION}-source.tar.xz
SHELL=bash
CFG_OPTS_COMMON=\
--enable-native-texlive-build \
--enable-static \
--enable-cxx-runtime-hack \
--disable-all-pkgs \
--without-x \
--without-system-poppler \
--without-system-freetype2 \
--without-system-kpathsea \
--without-system-libpng \
--without-system-xpdf \
--without-system-zlib \
--without-system-teckit \
--without-system-zziplib \
--without-system-gd \
--disable-ptex \
--disable-largefile \
all: pdftex bibtex texlive.lst
test:
makefile_path := $(abspath $(lastword $(MAKEFILE_LIST)))
cur_dir := $(notdir $(patsubst %/,%,$(dir $(mkfile_path))))
$(TLFILE):
@echo "downloading Texlive"
wget -nc "http://mirrors.ctan.org/systems/texlive/Source/${TLFILE}"
$(TLDIR): $(TLFILE)
@echo "unpacking sources"
rm -rf ${TLDIR}
tar -xf ${TLFILE}
touch ${TLDIR}
%tangle %tie %web2c: $(TLDIR)
@echo "building web2c binaries"
rm -rf tmp&&mkdir tmp
rm -rf binary&&mkdir binary
cd tmp&&../${TLDIR}/configure -C $(CFG_OPTS_COMMON) --disable-ptex --enable-pdftex &>configure.log
cd tmp&&make &>make.log
cd tmp/texk/web2c&&make pdftex &>make.log
cp -rp tmp/texk/web2c/{tangle,tie,web2c} binary/
#rm -rf tmp
.PHONY: tangle tie web2c
tangle tie web2c: binary/tangle binary/tie binary/web2c
libs: $(TLDIR)
build:
rm -rf build
mkdir build
build/Makefile: $(TLDIR) | build
@echo "configure.."
cd build&& \
CONFIG_SHELL=/bin/bash \
EMCONFIGURE_JS=0 \
emconfigure ../$(TLDIR)/configure -C $(CFG_OPTS_COMMON) --enable-pdftex --enable-bibtex CFLAGS="-DELIDE_CODE -Wno-implicit"\
&>configure.log
%texk/web2c/Makefile %texk/kpathsea/Makefile: build/Makefile
@echo "make in TeXLive root.."
cd build&& ax_cv_c_float_words_bigendian=no emconfigure make &>make.log
build/texk/kpathsea/rebuild.stamp: build/texk/kpathsea/Makefile
cd build/texk/kpathsea/&&emmake make rebuild &> make.log
.PHONY: kpathsea
kpathsea: build/texk/kpathsea/rebuild.stamp
pdftex.bc: binary/tangle binary/tie binary/web2c build/texk/web2c/Makefile kpathsea
@echo "make pdftex"
cp -rfp binary/{tangle,tie,web2c} build/texk/web2c/
cd build/texk/web2c && emmake make pdftex -o tangle -o tie -o web2c -o web2c/makecpool &>pdftex.log
opt -strip-debug build/texk/web2c/pdftex >pdftex.bc
pdftex-worker.js: pdftex-pre.js pdftex-post.js pdftex.bc
@echo "create pdftex worker"
#OBJFILES=$$(for i in `find build/texk/web2c/lib build/texk/kpathsea -name '*.o'` ; do llvm-nm $$i | grep main >/dev/null || echo $$i ; done) && \
emcc --memory-init-file 0 -v --closure 1 -s TOTAL_MEMORY=$$((128*1024*1024)) -O3 pdftex.bc -s INVOKE_RUN=0 --pre-js pdftex-pre.js --post-js pdftex-post.js -o pdftex-worker.js
.PHONY: pdftex
pdftex: pdftex-worker.js
bibtex.bc: binary/tangle binary/tie binary/web2c build/texk/web2c/Makefile kpathsea
@echo "make bibtex"
cp -rfp binary/{tangle,tie,web2c} build/texk/web2c/
cd build/texk/web2c && emmake make bibtex -o tangle &> bibtex.log
opt -strip-debug build/texk/web2c/bibtex >bibtex.bc
bibtex-worker.js: bibtex-pre.js bibtex-post.js bibtex.bc
emcc --memory-init-file 0 --closure 1 -v -O3 --pre-js bibtex-pre.js --post-js bibtex-post.js -s INVOKE_RUN=0 bibtex.bc -o bibtex-worker.js
.PHONY: bibtex
bibtex: bibtex-worker.js
install-tl-unx.tar.gz:
wget http://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz
texlive: install-tl-unx.tar.gz
rm -rf texlive&&mkdir texlive
cd texlive && tar xzvf ../install-tl-unx.tar.gz
echo selected_scheme scheme-basic > texlive/profile.input
echo TEXDIR `pwd`/texlive >> texlive/profile.input
echo TEXMFLOCAL `pwd`/texlive/texmf-local >> texlive/profile.input
echo TEXMFSYSVAR `pwd`/texlive/texmf-var >> texlive/profile.input
echo TEXMFSYSCONFIG `pwd`/texlive/texmf-config >> texlive/profile.input
echo TEXMFVAR `pwd`/home/texmf-var >> texlive/profile.input
@echo "Installing Texlive"
@cd texlive && ./install-tl-*/install-tl -profile profile.input
@echo "Removing unnecessary files"
cd texlive && rm -rf bin readme* tlpkg install* *.html texmf-dist/doc
texlive.lst: texlive
find texlive -type d -exec echo {}/. \; | sed 's/^texlive//g' >texlive.lst
find texlive -type f | sed 's/^texlive//g' >>texlive.lst
clean:
rm -rf tmp
rm -rf binary
rm -rf build
rm -rf texlive-*-source*
rm -f install-tl-unx.tar.gz
rm -f texlive.lst
rm -f pdftex-worker.js
rm -f bibtex-worker.js
rm -f pdftex.bc
rm -f bibtex.bc
rm -rf texlive
dist:
rm -rf tmp
rm -rf binary
rm -rf build
rm -rf texlive-*-source*
rm -f install-tl-unx.tar.gz
rm -f pdftex.bc
rm -f bibtex.bc