summaryrefslogtreecommitdiffstats
path: root/mmix.spec
blob: ec73bebaa63712fa3065a1f3e846afc783765534 (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
Name:           mmix
Version:        20131017
Release:        1%{?dist}
Summary:        MMIX simulators, assembler, and tools
License:        Knuth
URL:            http://mmix.cs.hm.edu/
Source0:        http://mmix.cs.hm.edu/src/mmix-%{version}.tgz
# CWEB "patches" to fix various GCC warnings
Source100:      https://raw.githubusercontent.com/ascherer/mmix/local/abstime.ch
Source101:      https://raw.githubusercontent.com/ascherer/mmix/local/mmix-arith.ch
Source102:      https://raw.githubusercontent.com/ascherer/mmix/local/mmix-config.ch
Source103:      https://raw.githubusercontent.com/ascherer/mmix/local/mmix-io.ch
Source104:      https://raw.githubusercontent.com/ascherer/mmix/local/mmix-pipe.ch
Source105:      https://raw.githubusercontent.com/ascherer/mmix/local/mmix-sim.ch
Source106:      https://raw.githubusercontent.com/ascherer/mmix/local/mmixal.ch
# CWEB "patches" to add features
Source200:      http://mmix.cs.hm.edu/tools/mmoimg/mmoimg.ch

BuildRequires:  tex-amsfonts
BuildRequires:  tex-cm
BuildRequires:  tex-cweb
BuildRequires:  tex-epsf
BuildRequires:  tex-etex
BuildRequires:  tex-knuth-lib
BuildRequires:  tex-pdftex
BuildRequires:  tex-tex
BuildRequires:  tex-texconfig

%description
MMIX is a computer intended to illustrate machine-level aspects of
programming. In the books The Art of Computer Programming, it replaces
MIX, the 1960s-style machine that formerly played such a role.  MMIX was
designed so that its machine language would be simple, elegant, and easy
to learn. At the same time it includes all of the complexities needed to
achieve high performance in practice, so that MMIX could in principle be
built and even perhaps be competitive with some of the fastest
general-purpose computers in the marketplace.

%prep
%setup -q -c -a 0
cp %{SOURCE100} %{SOURCE101} %{SOURCE102} %{SOURCE103} %{SOURCE104} \
   %{SOURCE105} %{SOURCE106} %{SOURCE200} .


%build
ctangle mmotype.w mmoimg.ch mmoimg.c
cweave mmotype.w mmoimg.ch mmoimg.tex

make all mmoimg CFLAGS="$RPM_OPT_FLAGS"

for f in mm*.w; do
  make ${f%.w}.pdf PDFTEX=pdftex
done
pdftex mmoimg.tex


%check
./mmixal -x -b 250 -l copy.mml copy.mms
./mmix copy copy.mms > copy.out
diff -u copy.mms copy.out

./mmixal -x -b 250 -l hello.mml hello.mms
./mmix -Dhello.mmb hello.mmo
echo -e '10000\nq' | ./mmmix plain.mmconfig hello.mmb

./mmixal -x -b 250 -l silly.mml silly.mms
./mmix -Dsilly.mmb silly.mmo
echo -e '10000\nq' | ./mmmix plain.mmconfig silly.mmb


%install
mkdir -p $RPM_BUILD_ROOT%{_bindir}
install mmix mmixal mmmix mmotype mmoimg $RPM_BUILD_ROOT%{_bindir}/


%files
%doc README *.pdf
%{_bindir}/mmix
%{_bindir}/mmixal
%{_bindir}/mmmix
%{_bindir}/mmotype
%{_bindir}/mmoimg


%changelog
* Tue Aug 18 2015 Yaakov Selkowitz <yselkowi@redhat.com>
- Initial release