-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathcwebbin.spec
319 lines (245 loc) · 9.37 KB
/
cwebbin.spec
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
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
# 'make fullmanual' requires TeX (pdftex or xetex).
# use '--without doc' to exclude this step; default is 'with'.
%bcond_without doc
# By default CWEB and CWEBBIN are compiled and linked with optimization
# switched on. Use '--with debuginfo' to switch debugging on.
%bcond_with debuginfo
# Prepare CWEBbin as base for TeXLive.
%bcond_with texlive
Name: cwebbin%{?with_texlive:-texlive}
Summary: The CWEBbin extension of the CWEB package
License: Public Domain
URL: http://www-cs-faculty.stanford.edu/~uno/cweb.html
Packager: Andreas Scherer <https://ascherer.github.io>
%if "%{_vendor}" == "debbuild"
Group: tex
Distribution: Kubuntu 22.04 (x86_64)
Requires: texlive
Recommends: gettext
BuildRequires: pandoc
%if %{with texlive}
BuildRequires: pax
%endif
%if %{with doc}
BuildRequires: texlive
%endif
%else
Group: Productivity/Publishing/TeX/Base
Distribution: openSUSE 42 (x86_64)
%global __msgfmt %{_bindir}/msgfmt
%global __pax /bin/pax
%global __touch %{_bindir}/touch
%global __texlive_local %(kpsewhich --var-value=TEXMFLOCAL)
%endif
BuildRoot: %{_tmppath}/%{name}-%{version}-root
Version: 4.12.1
Release: 2025
# Start with CTWILL; only very few things are actually used
Source0: ftp://ftp.cs.stanford.edu/pub/ctwill/ctwill.tar.gz
# Overwrite 'prod.w' with CWEB original
Source1: https://github.com/ascherer/cweb/releases/download/cweb-%{version}/cweb-%{version}.tar.gz
# Add CWEBbin stuff on top
Source2: https://github.com/ascherer/cwebbin/releases/download/cwebbin-%{release}/cwebbin-%{release}.tar.gz
# Patch macros from CTWILL 3.61
Patch1: 0001-Support-extended-syntax-for-numeric-literals.patch
Patch2: 0002-Purge-redundant-TeX-macro.patch
Patch3: 0003-Adapt-to-CWEB-4.5.patch
Patch4: 0004-Add-silent-datecontentspage-macro.patch
Patch5: 0005-Update-CTWILL-macros-for-CWEB-4.9.patch
Patch6: 0006-Rename-page-dimensions-to-match-cwebmac.patch
%global __sed_i %{__sed} -i
%global __make %{__make} -f Makefile.unix \\\
-e PDFTEX=pdftex \\\
-e TEXMFDIR=%{__texlive_local} \\\
%{!?with_texlive:-e CWEBINPUTS=%{_libdir}/cweb}
%global __pandoc %{_bindir}/pandoc \\\
--standalone --from markdown+all_symbols_escapable --to man
%{?with_texlive:%global __fcl %(dirname %(locate /bibtex.web))/tests/fix-changefile-lines.py --init}
%description
The 'CWEBbin' package is an extension of the 'CWEB' package by Silvio Levy
and Donald Knuth for Literate Programming in C/C++.
%prep
%if "%{_vendor}" == "debbuild"
%autosetup -c -a1 -a2
%else
%autosetup -c -T -a 0 -N
%autosetup -D -T -a 1 -N
%autosetup -D -T -a 2
%endif
for f in Makefile.unix po/cweb.pot po/*/cweb.po
do %{__sed_i} -e "s/@@VERSION@@/Version %{version} [CWEBbin %{release}]/" $f; done
%if %{with texlive}
%{__sed_i} -e "s/# \(.*-texlive\)/\1/" Makefile.unix
%else
%{!?with_doc:%{__sed_i} -e "s/cweave fullmanual/cweave # fullmanual/" Makefile.unix}
%if ! %{with debuginfo}
%{__sed_i} -e "s/\(CFLAGS = -g\)/#\1/" -e "s/#\(CFLAGS = -O\)/\1/" \
-e "s/\(LINKFLAGS = -g\)/#\1/" -e "s/#\(LINKFLAGS = -s\)/\1/" \
Makefile.unix
%endif
%endif
%build
%if %{with texlive}
%{__make} SUBVER="%{__sed_i} -e '1 {r texlive.w' -e 'N;}' \$@" \
-e CCHANGES=comm-w2c.ch comm-w2c.ch \
-e HCHANGES=comm-w2c.h comm-w2c.h \
-e TCHANGES=ctang-w2c.ch ctang-w2c.ch \
-e WCHANGES=cweav-w2c.ch cweav-w2c.ch \
-e LCHANGES=ctwill-w2c.ch ctwill-w2c.ch \
-e DCHANGES=cwebman-w2c.ch cwebman-w2c.ch \
prod-cweave.w prod-twill.w
%{__fcl} common.w comm-w2c.ch > comm-lines.ch 2>/dev/null
mv comm-lines.ch comm-w2c.ch
%{__fcl} ctangle.w ctang-w2c.ch > ctang-lines.ch 2>/dev/null
mv ctang-lines.ch ctang-w2c.ch
%{__fcl} cweave.w cweav-w2c.ch > cweav-lines.ch 2>/dev/null
mv cweav-lines.ch cweav-w2c.ch
%{__fcl} cweave.w ctwill-w2c.ch > ctwill-lines.ch 2>/dev/null
mv ctwill-lines.ch ctwill-w2c.ch
%{__fcl} cwebman.tex cwebman-w2c.ch > cwebman-lines.ch 2>/dev/null
mv cwebman-lines.ch cwebman-w2c.ch
%{__sed_i} -e "/@x/s/\[0\.[0-9]\] //" cwebman-w2c.ch
%else
%{__touch} *.cxx
%{__make} boot cautiously all
%endif
for m in ctwill cweb; do %{__pandoc} $m.md --output $m.1; done
%if %{with texlive}
%check
# Use system CWEB, most likely from TeXLive
%{__make} -e CTANGLE=ctangle -e HCHANGES=comm-w2c.h \
-e CCHANGES=comm-w2c.ch common.cxx \
-e TCHANGES=ctang-w2c.ch ctangle.cxx \
-e WCHANGES=cweav-w2c.ch cweave.cxx \
-e LCHANGES=ctwill-w2c.ch ctwill.cxx \
-e DCHANGES=cwebman-w2c.ch cwebbin.tex
ctie -m ctwill.w cweave.w ctwill-w2c.ch ctwill-mini.ch
ctie -m ctwill-hint.w cweave.w ctwill-w2c.ch ctwill-hint.ch
%endif
%install
%if %{with texlive}
for m in proof twinx; do %{__mv} ${m}mac.tex ct${m}mac.tex; done
%{__mv} texinputs/dproofmac.tex texinputs/dctproofmac.tex
%{__mv} texinputs/pdfproofmac.tex texinputs/pdfctproofmac.tex
%{__mv} proofsort ctwill-proofsort
%{__sed_i} -e "s/\(proofmac\)/ct\1/" texinputs/dctproofmac.tex
%{__sed_i} -e "s/\(twinxmac\)/ct\1/" twinx.w
%{__mkdir} man
for m in ctwill cweb
do %{__sed} -e "/Web2c/ s/\\\\\[at\]/@/g" \
-e "s/\(Automatically generated by Pandoc\).*/\1/" \
-e "s/\([a-zA-Z0-9]\)\\\\-\([a-zA-Z0-9]\)/\1-\2/g" \
$m.1 > man/$m.man
done
%{__sed_i} -e "s/\(proofmac\)/ct\1/g" \
-e "s/\(proofsort\)/ctwill-\1/g" \
-e "s/\(refsort\)/ctwill-\1/g" \
-e "s/\(twinx\)/ctwill-\1/g" \
-e "s/ctwill-\(twinx-startup\)/\1/g" \
man/ctwill.man
%{__sed_i} -e "s/\(proofmac\)/ct\1/g" \
-e "s/\(proofsort\)/ctwill-\1/g" \
-e "s/\(\# Public\)/\# \$Id\$\n\1/" \
-e "s/\"This is \$progname (2023)./\$progname.' \$Revision\$ \$Date\$'.\"/" \
ctwill-proofsort
%{__sed_i} -e "s/\(refsort\)/twill-\1/g" \
-e "s/\(\# Public\)/\# \$Id\$\n\1/" \
-e "s/\"This is \$progname (2023)./\$progname.' \$Revision\$ \$Date\$'.\"/" \
twill-refsort
%{__pax} *-w2c.ch comm-w2c.h prod-*.w ct*mac.tex po man tests \
cwebinputs texinputs refsort.w refsort.ch twinx.w twinx.ch \
*.bux *-mini.ch ctwill-hint.ch twinx-startup.tex \
ctwill-proofsort twill-refsort \
-L -wzf %{getenv:PWD}/cweb-texlive.tar.gz \
-s ,^man,texk/web2c/man, -s ,^,texk/web2c/cwebdir/,
%else
%{__rm} -rf %{buildroot}
%make_install
for l in de it
do
%{__install} -d %{buildroot}%{_datadir}/locale/$l/LC_MESSAGES
%{__msgfmt} po/$l/cweb.po \
-o %{buildroot}%{_datadir}/locale/$l/LC_MESSAGES/cweb.mo
done
for m in ctwill cweb
do %{__sed_i} -e "s/Web2c .*\[at\]/CWEBbin %{version}/" $m.1; done
%endif
%files
%if ! %{with texlive}
%{_bindir}/*
%{_datadir}/emacs/site-lisp/cweb.el
%{_libdir}/cweb/*
%{_mandir}/man1/*
%{_datadir}/locale/de/LC_MESSAGES/cweb.mo
%{_datadir}/locale/it/LC_MESSAGES/cweb.mo
%{__texlive_local}/tex/plain/cweb/*
%endif
%post
%{__texhash}
%postun
%{__texhash}
%changelog
* Wed Jan 01 2025 Andreas Scherer <https://ascherer.github.io>
- Tuneup for CWEB 4.12.1
* Mon Aug 12 2024 Andreas Scherer <https://ascherer.github.io>
- Tuneup for CWEB 4.12
* Sat Dec 02 2023 Andreas Scherer <https://ascherer.github.io>
- Tuneup for CWEB 4.11
* Sat Aug 19 2023 Andreas Scherer <https://ascherer.github.io>
- Tuneup for CWEB 4.10
* Mon May 15 2023 Andreas Scherer <https://ascherer.github.io>
- Tuneup for CWEB 4.9
* Sun Jun 05 2022 Andreas Scherer <https://ascherer.github.io>
- Tuneup for CWEB 4.8
* Sat Feb 05 2022 Andreas Scherer <https://ascherer.github.io>
- Tuneup for CWEB 4.7
* Sat Dec 25 2021 Andreas Scherer <https://ascherer.github.io>
- Tuneup for CWEB 4.6
* Wed Jul 14 2021 Andreas Scherer <https://ascherer.github.io>
- Tuneup for CWEB 4.5
* Sun Jun 06 2021 Andreas Scherer <https://ascherer.github.io>
- Tuneup for CWEB 4.4
* Tue Apr 13 2021 Andreas Scherer <https://ascherer.github.io>
- Tuneup for CWEB 4.3
* Thu Feb 25 2021 Andreas Scherer <https://ascherer.github.io>
- Tuneup for CWEB 4.2
* Sat Feb 20 2021 Andreas Scherer <https://ascherer.github.io>
- Tuneup for CWEB 4.1
* Sat Feb 06 2021 Andreas Scherer <https://ascherer.github.io>
- Tuneup for CWEB 4.0
* Sun Sep 22 2019 Andreas Scherer <https://ascherer.github.io>
- Prepare new release
* Tue Jan 01 2019 Andreas Scherer <https://ascherer.github.io>
- Prepare new release
* Sun Dec 30 2018 Andreas Scherer <https://ascherer.github.io>
- Add CTWILL and its utiliy programs and macros
* Fri Nov 09 2018 Andreas Scherer <https://ascherer.github.io>
- Add internationalization (i18n)
* Sun Feb 19 2017 Andreas Scherer <https://ascherer.github.io>
- Update for the 2017 sources
* Tue Mar 08 2016 Andreas Scherer <https://ascherer.github.io>
- Prepare release for CTAN/Web2c/TeX Live
* Tue Feb 23 2016 Andreas Scherer <https://ascherer.github.io>
- Update for the updated 2016 sources
* Sun Jan 31 2016 Andreas Scherer <https://ascherer.github.io>
- Update for the 2016 sources
* Sat Jan 09 2016 Andreas Scherer <https://ascherer.github.io>
- Conditional Build Stuff for non-TeX systems
* Thu Oct 29 2015 Andreas Scherer <andreas_tex@freenet.de> 22p-5
- Fully parametrized specfile
* Sat Aug 22 2015 Andreas Scherer <andreas_tex@freenet.de> 22p-4
- Put the TeX stuff into the correct 'local texmf tree'
* Sat Aug 15 2015 Andreas Scherer <andreas_tex@freenet.de> 22p-3
- Provide consistent information in URL and Source0
* Mon Jul 06 2015 Andreas Scherer <andreas_tex@freenet.de> 22p-2
- Use a simpler %prep section
* Thu Aug 18 2011 Andreas Scherer <andreas_tex@freenet.de> 22p-1
- Compile the package on Kubuntu 10.04
* Sat Apr 21 2007 Andreas Scherer <andreas_tug@freenet.de> p21-4
- Update for the 2006 sources
* Sun Dec 18 2005 Andreas Scherer <andreas_tug@freenet.de> p21-3
- Install (and hide) cwebmac.tex
* Fri Nov 04 2005 Andreas Scherer <andreas_tug@freenet.de> p21-2
- Build from two source archives (CWEBbin + cweb)
* Sat Oct 29 2005 Andreas Scherer <andreas_tug@freenet.de> p21-1
- Initial build