1#!/bin/sh
2# Shell script for creating the Windows 32-bit executables "mathomatic.exe" and Prime Number Tools.
3# In Debian or its derivatives, install the MinGW cross-compiler package mingw32 (tested;
4# run "sudo apt-get install mingw32").  MinGW doesn't recognize long longs or
5# long doubles, and the 64-bit version doesn't appear to work yet.
6#
7# The 32-bit executables created here are very capable, work standalone or with Cygwin,
8# and do not require readline or editline to recall and edit command-line history,
9# this already works in the Windows console (cmd.exe and command.com).
10#
11# To compile everything with MinGW, just type:
12#	./compile.mingw
13# This file may require editing if you are not using Debian or a derivative distro.
14#
15
16# Abort on any errors:
17set -e
18
19# Define the C cross-compiler and flags we are using here:
20export CC=i586-mingw32msvc-cc
21export CFLAGS="-O3 -Wall -DMINGW -DWIN32_CONSOLE_COLORS -DBOLD_COLOR $CFLAGS"
22
23echo Compiling Windows 32-bit Mathomatic...
24make clean
25cd icons
26i586-mingw32msvc-windres icon.rc icon.o
27cd ..
28AOUT=mathomatic.exe MATHOMATIC_OBJECTS="icons/icon.o" make -j
29make clean
30
31echo
32echo Compiling the 32-bit Prime Number Tools...
33cd primes
34make flush
35CFLAGS="-DUSE_DOUBLES $CFLAGS" make -j
36make clean
37echo
38mv matho-primes matho-primes.exe
39mv matho-pascal matho-pascal.exe
40mv matho-sumsq matho-sumsq.exe
41echo Prime Number Tools executables had .exe appended to the filenames.
42cd ..
43
44exit 0 # 64-bits isn't completely supported by MinGW yet.
45
46export CC=amd64-mingw32msvc-cc
47
48echo Compiling Windows 64-bit Mathomatic...
49make clean
50cd icons
51amd64-mingw32msvc-windres icon.rc icon.o
52cd ..
53AOUT=mathomatic64.exe MATHOMATIC_OBJECTS="icons/icon.o" make -j
54make clean
55