aboutsummaryrefslogtreecommitdiff
path: root/makefile
blob: b127cfe643f5fa164b1e07d680d6c7c8a12ad0d9 (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
TL_YEAR?=2024
PREFIX?=/usr/local/texlive/${TL_YEAR}/bin/custom
BINREPO=https://www.ekdosis.org/texlive
TMPDIR!=mktemp -d
OPENBSD_VERSION!=uname -r | sed 's/\.//'
TLBINPATH!=which latex | sed 's/\/latex//'
TMPSOURCE?=""
UPDATING!=curl -s ${BINREPO}/status.txt | grep updating= | sed 's/.*=//'

DONT_TOUCH_DIRS:=${HOME}/bin /bin /sbin /usr/bin /usr/sbin /usr/X11R6/bin /usr/local/bin /usr/local/sbin


.MAIN: update

fetch:
.if "${UPDATING}" == "yes"
	@echo "The binaries are being updated.  Please re-run this command later."
.else
	curl ${BINREPO}/amd64-openbsd${OPENBSD_VERSION}.tar.xz \
		-o ${TMPDIR}/amd64-openbsd${OPENBSD_VERSION}.tar.xz
	curl ${BINREPO}/amd64-openbsd${OPENBSD_VERSION}.tar.xz.asc \
		-o ${TMPDIR}/amd64-openbsd${OPENBSD_VERSION}.tar.xz.asc
	gpg --verify ${TMPDIR}/amd64-openbsd${OPENBSD_VERSION}.tar.xz.asc
	unxz ${TMPDIR}/amd64-openbsd${OPENBSD_VERSION}.tar.xz
	mkdir ${TMPDIR}/bin \
		&& tar xf ${TMPDIR}/amd64-openbsd${OPENBSD_VERSION}.tar \
		-C ${TMPDIR}/bin
	@echo "Looks good."
	@echo "Now do this to install TeX Live with custom binaries:"
	@echo "  cd /path/to/install-tl"
	@echo "  ./install-tl --custom-bin=${TMPDIR}/bin"
.endif

update:
.if "${UPDATING}" == "yes"
	@echo "The binaries are being updated.  Please re-run this command later."
.else
	curl ${BINREPO}/amd64-openbsd${OPENBSD_VERSION}.tar.xz \
		-o ${TMPDIR}/amd64-openbsd${OPENBSD_VERSION}.tar.xz
	curl ${BINREPO}/amd64-openbsd${OPENBSD_VERSION}.tar.xz.asc \
		-o ${TMPDIR}/amd64-openbsd${OPENBSD_VERSION}.tar.xz.asc
	gpg --verify ${TMPDIR}/amd64-openbsd${OPENBSD_VERSION}.tar.xz.asc
.for DIR in ${DONT_TOUCH_DIRS}
.if "${DIR}" == ${TLBINPATH}
	@echo ""
	@echo "This program will never affect a system directory such as ${TLBINPATH}"
	@echo "To complete the update, you must replace by hand your binaries"
	@echo "with those in ${TMPDIR}/amd64-openbsd${OPENBSD_VERSION}.tar.xz"
	@echo "Exiting now."
	exit 1
.endif
.endfor
.if "${PREFIX}" == ${TLBINPATH}
	@echo ""
	@echo "Looks good."
	@echo "Now do this to update the binaries:"
	@echo "1. Remove the binaries that are currently installed:"
	@echo "   doas rm ${PREFIX}/*"
	@echo "2. Run this command:"
	@echo "   make TMPSOURCE=${TMPDIR} install"
.else
	@echo ""
	@echo "Looks like your TL binaries are in ${TLBINPATH}"
	@echo "instead of the expected ${PREFIX}."
	@echo "To complete the update, you must remove by hand your binaries."
	@echo "******************************************************************************"
	@echo "* CAUTION: You must first ensure that ${TLBINPATH} contains nothing"
	@echo "* but the TeX Live binaries, otherwise you may damage your system permanently."
	@echo "******************************************************************************"
	@echo "Then do:"
	@echo "1.  doas rm ${TLBINPATH}/*"
	@echo "2.  make TMPSOURCE=${TMPDIR} PREFIX=${TLBINPATH} install"
.endif
.endif

install:
	unxz ${TMPSOURCE}/amd64-openbsd${OPENBSD_VERSION}.tar.xz
	doas tar xf ${TMPSOURCE}/amd64-openbsd${OPENBSD_VERSION}.tar -C ${PREFIX}/

.PHONY: fetch update install