aboutsummaryrefslogtreecommitdiff
blob: 9f3e1b041cf014703d7511a2efbcf25782d3b0ba (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
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
include Makefile.common

include Makefile.def

include Makefile.revs

include Makefile.inherits

VERSIONNED_ZIPS = $(DESC:%=%.versionnedzips) $(EXTRA_DIST:%=%.versionnedzips) $(DESC:%=%.docversionnedzips) $(EXTRA_DIST:%=%.docversionnedzips) $(DESC:%=%.srcversionnedzips) $(EXTRA_DIST:%=%.srcversionnedzips)

FULLDESC = $(DESC) $(EXTRA_DIST)

lists : $(FULLDESC:%=%.list) $(FULLDESC:%=%.base)

unpacked : $(FULLDESC:%=%.unpacked)

%.base:
	$(CPF) $(@:texlive-%.base=$(TL_TRUNK)/Master/tlpkg/tlpsrc/collection-%.tlpsrc) $@
	-sh $(@:%.base=%.baseexec) $@

%.list: %.base
	grep -v "^#" $< | grep "depend " | awk '{print $$2}'  | grep -v "collection" | tr '\n' ' ' > $@
	-sh $(@:%.list=%.extraexec) $@
	echo "$(@:texlive-%.list=collection-%)" >> $@

%.doclist: %.tlpobj
	./gendoc.sh $(shell cat $(<:%.tlpobj=%.list)) > $@

%.srclist: %.tlpobj
	./gensrc.sh $(shell cat $(<:%.tlpobj=%.list)) > $@

%.licenselist: %.cataloguehtml
	./getlicense.sh $(shell cat $(@:%.licenselist=%.list)) | sort | uniq | tr '\n' ' ' > $@

%.gentoolicense: %.licenselist
	(./cataloguelicense2gentoolicense.sh $(shell cat $<) ; printf "\nGPL-2\n") | sort | uniq | tr '\n' ' ' > $@

%.desc: %.base
	grep "shortdesc " $< | sed -e "s/shortdesc //" | sed -e "s/.*/DESCRIPTION=\"TeXLive \0\"/" > $@

%.metadata: %.base
	echo '<?xml version="1.0" encoding="UTF-8"?>' > $@
	echo '<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">' >> $@
	echo '<pkgmetadata>' >> $@
	echo '	<maintainer type="person">' >> $@
	echo '		<email>aballier@gentoo.org</email>' >> $@
	echo '		<name>Alexis Ballier</name>' >> $@
	echo '	</maintainer>' >> $@
	echo '  <maintainer type="project">' >> $@
	echo '     <email>tex@gentoo.org</email>' >> $@
	echo '     <name>Gentoo TeX Project</name>' >> $@
	echo '  </maintainer>' >> $@
	echo '<longdescription lang="en">' >> $@
	grep "longdesc " $< | sed -e "s/longdesc //" >> $@
	echo '</longdescription>' >> $@
	echo '</pkgmetadata>' >> $@

%.deps: %.base
	grep "depend " $< | awk '{print $$2}' | grep "collection" | grep -v "collection-basicbin" | grep -v "collection-fontbin" |  sed -e "s/collection/texlive/g" | sed -e "s/^/>=dev-texlive\//" | sed -e "s/$$/-$(TEXLIVE_VERSION)/" > $@
	-cat $(@:.deps=.extradeps) >> $@

clean:
	$(RMF) $(FULLDESC:%=%.list)
	$(RMF) $(FULLDESC:%=%.srclist)
	$(RMF) $(FULLDESC:%=%.doclist)
	$(RMF) $(FULLDESC:%=%.licenselist)
	$(RMF) $(FULLDESC:%=%.base)
	$(RMF) $(FULLDESC:%=%.versionnedzips)
	$(RMF) $(FULLDESC:%=%.docversionnedzips)
	$(RMF) $(FULLDESC:%=%.srcversionnedzips)
	$(RMF) $(FULLDESC:%=%.unpacked)
	$(RMF) $(DESC:%=%.dotbase)
	$(RMF) $(DESC:%=%.deps)
	$(RMF) $(DESC:%=%.metadata)
	$(RMF) *.tlpobj
	$(RMF) *.tlplic
	$(RMF) *.cataloguehtml
	$(RMF) *.unpacked
	$(RMF) tldir

%.versionnedzips: %.list
	$(MAKE) CONTENTS="$(shell cat $<)" -f Makefile-dist versionnedzips
	touch $@

%.docversionnedzips: %.doclist
	$(MAKE) CONTENTS="$(shell cat $<)" -f Makefile-dist versionnedzips
	touch $@

%.srcversionnedzips: %.srclist
	$(MAKE) CONTENTS="$(shell cat $<)" -f Makefile-dist versionnedzips
	touch $@

%.unpacked: %.list
	$(MAKE) CONTENTS="$(shell cat $<)" -f Makefile-dist unpacked
	touch $@

%.tlpobj: %.list
	$(MAKE) CONTENTS="$(shell cat $<)" -f Makefile-dist tlpobj
	touch $@

%.tlplic: %.list
	$(MAKE) CONTENTS="$(shell cat $<)" -f Makefile-dist tlplic
	touch $@

%.cataloguehtml: %.list
	$(MAKE) CONTENTS="$(shell cat $<)" -f Makefile-dist cataloguehtml
	touch $@

%-post-ebuild:
	touch $@

%.extrardepend:
	touch $@

%-preinherit-ebuild:
	touch $@

%.ebuild: %.desc %.deps %.list %.doclist %.srclist %.gentoolicense %-post-ebuild %.extrardepend %-preinherit-ebuild
	cat $(PORTDIR)/header.txt > $@
	printf "EAPI=\"5\"\n\n" >> $@
	echo -n "TEXLIVE_MODULE_CONTENTS=\"" >> $@
	cat $(@:%.ebuild=%.list) >> $@
	echo "\"" >> $@
	echo -n "TEXLIVE_MODULE_DOC_CONTENTS=\"" >> $@
	cat $(@:%.ebuild=%.doclist) >> $@
	echo "\"" >> $@
	echo -n "TEXLIVE_MODULE_SRC_CONTENTS=\"" >> $@
	cat $(@:%.ebuild=%.srclist) >> $@
	echo "\"" >> $@
	cat $(@:%.ebuild=%-preinherit-ebuild) >> $@
	echo "inherit $(EXTRA_INHERIT) texlive-module" >> $@
	cat $< >> $@
	echo "" >> $@
	echo -n "LICENSE=\"" >> $@
	cat $(@:%.ebuild=%.gentoolicense) >> $@
	echo "\"" >> $@
	echo "SLOT=\"0\"" >> $@
	echo "KEYWORDS=\"~alpha ~amd64 ~arm ~hppa ~mips ~ppc ~ppc64 ~s390 ~sh ~x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~x64-solaris ~x86-solaris\"" >> $@
	echo "IUSE=\"\"" >> $@
	echo -n "DEPEND=\"" >> $@
	cat $(@:%.ebuild=%.deps) >> $@
	echo "\"" >> $@
	echo -n 'RDEPEND="$${DEPEND} ' >> $@
	cat $(@:%.ebuild=%.extrardepend) >> $@
	echo '"' >> $@
	cat $(@:%.ebuild=%-post-ebuild) >> $@

dist: lists $(VERSIONNED_ZIPS) $(EXTRA_DIST:%=%.doclist) $(EXTRA_DIST:%=%.srclist)
	$(MAKE) CONTENTS="$(EXTRA_ZIP)" -f Makefile-dist versionnedzips

#-ebuild $(TEXLIVE_OVERLAY_LOCATION)/app-text/texlive-core/texlive-core-$(TEXLIVE_VERSION).ebuild digest

ebuildsdir:
	$(MKDIRP) $(TEXLIVE_OVERLAY_LOCATION)/$(DESC:%=dev-texlive/%)

ebuilds: dist $(DESC:%=%.desc) $(DESC:%=%.ebuild) $(DESC:%=%.deps)

tlpobj: $(DESC:%=%.tlpobj)

tlpobj: $(DESC:%=%.tlplic)

licenselist: $(DESC:%=%.licenselist) $(EXTRA_DIST:%=%.licenselist)

gentoolicenses: $(DESC:%=%.gentoolicense) $(EXTRA_DIST:%=%.gentoolicense)

%.installed: %.ebuild %.metadata
	$(MKDIRP) $(TEXLIVE_OVERLAY_LOCATION)/dev-texlive/$(@:%.installed=%)
	$(CPF) $(@:%.installed=%.ebuild) $(TEXLIVE_OVERLAY_LOCATION)/dev-texlive/$(@:%.installed=%)/$(@:%.installed=%)-$(TEXLIVE_VERSION)$(EXTRA_REV).ebuild
	$(CPF) $(@:%.installed=%.metadata) $(TEXLIVE_OVERLAY_LOCATION)/dev-texlive/$(@:%.installed=%)/metadata.xml
	ebuild $(TEXLIVE_OVERLAY_LOCATION)/dev-texlive/$(@:%.installed=%)/$(@:%.installed=%)-$(TEXLIVE_VERSION)$(EXTRA_REV).ebuild digest
	echo "$(TEXLIVE_OVERLAY_LOCATION)/dev-texlive/$(@:%.installed=%)/$(@:%.installed=%)-$(TEXLIVE_VERSION)$(EXTRA_REV).ebuild" > $@

ebuilds-install: $(DESC:%=%.installed)


texlive-core.gentoolicense: $(EXTRA_DIST:%=%.gentoolicense)
	cat $(EXTRA_DIST:%=%.gentoolicense) | tr ' ' '\n' | sort | uniq | tr '\n' ' ' > $@

ebuildsclean: clean
	$(RMF) $(DESC:%=%.ebuild)
	$(RMF) $(DESC:%=%.desc)
	$(RMF) $(DESC:%=%.installed)
	$(RMF) $(DESC:%=%.gentoolicense)

%.dotbase: %.deps
	sed -e "s/^/\"$(<:%.deps=%)\" -> \"/" $< | tr '\n' '#' | sed -e "s/#/\"#/g" | tr '#' '\n' | sed -e "s:dev-texlive/texlive-::g" | sed -e "s:texlive-::g" > $@


dot: $(DESC:%=%.dotbase)
	echo "digraph G{" > texlive-$(TEXLIVE_VERSION).dot
	cat $(DESC:%=%.dotbase) >>  texlive-$(TEXLIVE_VERSION).dot
	echo "}" >>  texlive-$(TEXLIVE_VERSION).dot