Skip to content
This repository was archived by the owner on Apr 15, 2022. It is now read-only.

Commit f6f9240

Browse files
committed
Add the build resources and scripts that have been assembled so far--still very sketchy for the most part.
1 parent 6237fca commit f6f9240

22 files changed

+2727
-0
lines changed

SageMath.iss

Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
#define MyAppName "SageMath"
2+
#define MyAppVersion "7.4"
3+
#define MyAppPublisher "SageMath"
4+
#define MyAppURL "http://www.sagemath.org/"
5+
#define MyAppContact "http://www.sagemath.org/"
6+
7+
#define SageGroupName "SageMath"
8+
9+
#ifndef Compression
10+
#define Compression "lzma"
11+
#endif
12+
13+
#ifndef AppBuildDir
14+
#define AppBuildDir "build"
15+
#endif
16+
17+
#ifndef DiskSpanning
18+
#if Compression == "none"
19+
#define DiskSpanning="yes"
20+
#else
21+
#define DiskSpanning="no"
22+
#endif
23+
#endif
24+
25+
#define Bin "{app}\app\bin"
26+
#define OptSageMath "{app}\app\opt\sagemath-" + MyAppVersion
27+
#define OptSageMathPosix "/opt/sagemath-" + MyAppVersion
28+
29+
[Setup]
30+
AppCopyright={#MyAppPublisher}
31+
AppId={#MyAppName}
32+
AppContact={#MyAppContact}
33+
AppComments={#MyAppURL}
34+
AppName={#MyAppName}
35+
AppVersion={#MyAppVersion}
36+
AppPublisher={#MyAppPublisher}
37+
AppPublisherURL={#MyAppURL}
38+
AppSupportURL={#MyAppURL}
39+
AppUpdatesURL={#MyAppURL}
40+
ArchitecturesAllowed=x64
41+
ArchitecturesInstallIn64BitMode=x64
42+
DefaultDirName={pf}\{#SageGroupName}
43+
DefaultGroupName={#SageGroupName}
44+
DisableProgramGroupPage=yes
45+
DisableWelcomePage=no
46+
DiskSpanning={#DiskSpanning}
47+
OutputDir=dist
48+
OutputBaseFilename={#MyAppName}-{#MyAppVersion}
49+
Compression={#Compression}
50+
SolidCompression=yes
51+
WizardImageFile=resources\sage-banner.bmp
52+
WizardSmallImageFile=resources\sage-sticker.bmp
53+
WizardImageStretch=yes
54+
UninstallDisplayIcon={app}\unins000.exe
55+
SetupIconFile=resources\sage-floppy-disk.ico
56+
ChangesEnvironment=true
57+
SetupLogging=yes
58+
59+
[Languages]
60+
Name: "english"; MessagesFile: "compiler:Default.isl"
61+
62+
[Tasks]
63+
Name: startmenu; Description: "Create &start menu icons"; GroupDescription: "Additional icons"
64+
Name: desktop; Description: "Create &desktop icons"; GroupDescription: "Additional icons"
65+
66+
[Files]
67+
Source: "dot_sage\*"; DestDir: "{#OptSageMath}\dot_sage"; Flags: recursesubdirs ignoreversion
68+
Source: "{#AppBuildDir}\app\*"; DestDir: "{app}\app"; Flags: recursesubdirs ignoreversion
69+
Source: "resources\sagemath.ico"; DestDir: "{app}"; Flags: ignoreversion; AfterInstall: FixupSymlinks
70+
71+
; InnoSetup will not create empty directories found when including files
72+
; recursively in the [Files] section, so any directories that must exist
73+
; (but start out empty) in the cygwin distribution must be created
74+
;
75+
; /etc/fstab.d is where user-specific mount tables go--this is used in
76+
; sage for windows by /etc/sagerc to set up the /dot_sage mount point for
77+
; each user's DOT_SAGE directory, since the actual path name might contain
78+
; spaces and other special characters not handled well by some software that
79+
; uses DOT_SAGE
80+
;
81+
; /dev/shm and /dev/mqueue are used by the system for POSIX semaphores, shared
82+
; memory, and message queues and must be created world-writeable
83+
[Dirs]
84+
Name: "{app}\app\etc\fstab.d"; Permissions: users-modify
85+
Name: "{app}\app\dev\shm"; Permissions: users-modify
86+
Name: "{app}\app\dev\mqueue"; Permissions: users-modify
87+
88+
[UninstallDelete]
89+
Type: filesandordirs; Name: "{app}\app\etc\fstab.d"
90+
Type: filesandordirs; Name: "{app}\app\dev\shm"
91+
Type: filesandordirs; Name: "{app}\app\dev\mqueue"
92+
93+
#define RunSage "/bin/bash --login -c '" + OptSageMathPosix + "/sage'"
94+
#define RunSageDoc "The SageMath console interface"
95+
#define RunSageSh "/bin/bash --login -c '" + OptSageMathPosix + "/sage -sh'"
96+
#define RunSageShDoc "Command prompt in the SageMath shell environment"
97+
#define RunSageNotebook "/bin/bash --login -c '" + OptSageMathPosix + "/sage --notebook jupyter'"
98+
#define RunSageNotebookDoc "Start SageMath notebook server"
99+
100+
[Icons]
101+
Name: "{app}\SageMath"; Filename: "{#bin}\mintty.exe"; Parameters: "-t SageMath -i sagemath.ico {#RunSage}"; WorkingDir: "{app}"; Comment: "{#RunSageDoc}"; IconFilename: "{app}\sagemath.ico"
102+
Name: "{group}\SageMath"; Filename: "{#bin}\mintty.exe"; Parameters: "-t SageMath -i sagemath.ico {#RunSage}"; WorkingDir: "{app}"; Comment: "{#RunSageDoc}"; IconFilename: "{app}\sagemath.ico"; Tasks: startmenu
103+
Name: "{commondesktop}\SageMath"; Filename: "{#bin}\mintty.exe"; Parameters: "-t SageMath -i sagemath.ico {#RunSage}"; WorkingDir: "{app}"; Comment: "{#RunSageDoc}"; IconFilename: "{app}\sagemath.ico"; Tasks: desktop
104+
105+
Name: "{app}\SageMath Shell"; Filename: "{#bin}\mintty.exe"; Parameters: "-t 'SageMath Shell' -i sagemath.ico {#RunSageSh}"; WorkingDir: "{app}"; Comment: "{#RunSageShDoc}"; IconFilename: "{app}\sagemath.ico"
106+
Name: "{group}\SageMath Shell"; Filename: "{#bin}\mintty.exe"; Parameters: "-t 'SageMath Shell' -i sagemath.ico {#RunSageSh}"; WorkingDir: "{app}"; Comment: "{#RunSageShDoc}"; IconFilename: "{app}\sagemath.ico"; Tasks: startmenu
107+
Name: "{commondesktop}\SageMath Shell"; Filename: "{#bin}\mintty.exe"; Parameters: "-t SageMath -i sagemath.ico {#RunSageSh}"; WorkingDir: "{app}"; Comment: "{#RunSageShDoc}"; IconFilename: "{app}\sagemath.ico"; Tasks: desktop
108+
109+
Name: "{app}\SageMath Notebook"; Filename: "{#bin}\mintty.exe"; Parameters: "-t 'SageMath Shell' -i sagemath.ico {#RunSageNotebook}"; WorkingDir: "{app}"; Comment: "{#RunSageNotebookDoc}"; IconFilename: "{app}\sagemath.ico"
110+
Name: "{group}\SageMath Notebook"; Filename: "{#bin}\mintty.exe"; Parameters: "-t 'SageMath Shell' -i sagemath.ico {#RunSageNotebook}"; WorkingDir: "{app}"; Comment: "{#RunSageNotebookDoc}"; IconFilename: "{app}\sagemath.ico"; Tasks: startmenu
111+
Name: "{commondesktop}\SageMath Notebook"; Filename: "{#bin}\mintty.exe"; Parameters: "-t SageMath -i sagemath.ico {#RunSageNotebook}"; WorkingDir: "{app}"; Comment: "{#RunSageNotebookDoc}"; IconFilename: "{app}\sagemath.ico"; Tasks: desktop
112+
113+
[Code]
114+
procedure FixupSymlinks();
115+
var
116+
n: Integer;
117+
i: Integer;
118+
resultCode: Integer;
119+
filenames: TArrayOfString;
120+
filenam: String;
121+
begin
122+
LoadStringsFromFile(ExpandConstant('{app}\app\etc\symlinks.lst'), filenames);
123+
n := GetArrayLength(filenames);
124+
WizardForm.ProgressGauge.Min := 0;
125+
WizardForm.ProgressGauge.Max := n - 1;
126+
WizardForm.ProgressGauge.Position := 0;
127+
WizardForm.StatusLabel.Caption := 'Fixing up symlinks...';
128+
for i := 0 to n - 1 do
129+
begin
130+
filenam := filenames[i];
131+
WizardForm.FilenameLabel.Caption := Copy(filenam, 2, Length(filenam));
132+
WizardForm.ProgressGauge.Position := i;
133+
Exec(ExpandConstant('{sys}\attrib.exe'), '+S ' + filenam,
134+
ExpandConstant('{app}\app'), SW_HIDE,
135+
ewNoWait, resultCode);
136+
end;
137+
end;

build.py

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
"""
2+
Currently just a hand-written and fairly informal list of manual steps for
3+
performing the build. Will be turned into a script, which may not even be
4+
in the form of a single Python script, but I just called it 'build.py' for
5+
now.
6+
"""
7+
8+
# 1. Download setup.exe
9+
# 2. Install bash and other minimal system requirements
10+
# Include this NOTE: This list was collected by manually running setup.exe,
11+
# deslecting all default packages, then installing just bash and base-files,
12+
# and a few dependencies needed for apt-cyg: coreutils, findutils, tar,
13+
# grep, wget, hostname, gawk, bzip2, gzip, then accepting all their
14+
# dependencies as well (which of course pulls in cygwin itself, and any
15+
# other required minimal set of utilities and libraries--this set is even
16+
# smaller than the default cygwin base system). The list was then generated
17+
# by running `cygcheck -c -d | tail -n +3 > cygwin-bootstrap.list`
18+
# 3. Install apt-cyg into the new cygwin's /usr/local/bin
19+
# 4. Run build Cygwin's bash and use apt-cyg to install remaining required
20+
# packages which wil be read from a text file (which will be determined
21+
# mostly by trial and error) (note: this and the previous step could
22+
# probably just be melded into step 2 by installing the full dependency list
23+
# up front--I think for automated builds there's no particular advantage to
24+
# involving apt-cyg if we already have the full list of dependencies)
25+
# 5. Make /opt in the new cygwin
26+
# 6. git clone sage sources to /opt/sagemath-<version> (for automation purposes
27+
# just use the git:// URL)
28+
# 7. Checkout the branch/tag to build (perhaps combine with the previous step)
29+
# 8. cd into /opt/sagemath-7.4 and run
30+
# $ make configure
31+
# 9. Run
32+
# $ ./configure --with-blas=atlas
33+
# 10. Run
34+
# $ SAGE_NUM_THREADS=1 \
35+
# SAGE_INSTALL_CCACHE=yes \
36+
# CCACHE_DIR=</path/to/real/home>/.ccache \
37+
# SAGE_FAT_BINARY=yes \
38+
# SAGE_ATLAS_LIB=/usr \
39+
# make start
40+
# Where </path/to/real/home> should be the path (through /cygdrive/c, most
41+
# likely) to your home directory on the host system from which this Cygwin
42+
# instance is being run--this is to allow it to share your normal .ccache
43+
# directory. Or, if you like, you can use a separate .ccache just for Sage
44+
# builds.
45+
# 11. Upgrade the installed pip--this is annoying but required for some
46+
# patches to how sage runs pip to work properly. This is only required
47+
# for sage 7.4 which uses an older version of pip by default (maybe we
48+
# could patch it in the 7.4-cygwn branch to use a newer version by
49+
# default):
50+
# $ ./sage -pip install --upgrade pip
51+
# 12. From within the build Cygwin, run the sage_cygwin_packages script
52+
# and output its results to cygwin-sage-runtime.list
53+
# 13. Make a new Cygwin install inside build/app relative to this build
54+
# script (or an optional alternative build dir); install all the packages
55+
# listed in cygwin-sage-runtime.list
56+
# $ setup-x86_64.exe --site ftp://mirrors.kernel.org/sourceware/cygwin/ \
57+
# --local-package-dir "$(cygpath -w -a download)" \
58+
# --root "$(cygpath -w -a build/app) \
59+
# --arch x86_64 --no-admin --no-shortcuts --quiet-mode \
60+
# --packages $(cat cygwin-sage-runtime.list | awk '{print $1}' | \
61+
# tr '\n' ',' | sed 's/,$//')
62+
#
63+
# TODO: Right now using a hard-coded mirror, but in the future what we
64+
# really want to ensure reproducibility is a custom mirror with the exact
65+
# package versions we're building with
66+
# TODO: In fact, using Cygwin's setup.exe for this purpose is quite noisy
67+
# and a pain in the ass; when we set up our own local mirror it should
68+
# contain only exactly the packages we need (via a custom setup.ini) and
69+
# we can just install all those packages directly by unpacking them
70+
# 14. Clean up a few files from the Cygwin installation--namely the Cygwin.bat
71+
# and icons:
72+
# $ rm -f build/app/Cygwin*.{bat,ico}
73+
# 15. Copy the /opt directory from the *build* Cygwin into the *runtime*
74+
# Cygwin in build/app, then perform the following cleanup (at a minimum)
75+
# from within the $SAGE_ROOT in build/app (/opt/sagemath-<version>)
76+
# $ rm -rf bootstrap config* logs m4 Makefile upstream \
77+
# local/var/tmp/sage/build/* local/var/lock/* \
78+
# src/build local/share/doc/sage/doctrees
79+
# 16. Install the files in cygwin_extras by just
80+
# $ cp -r cygwin_extras/* build/app/
81+
# 17. Install the /etc/sage-version file:
82+
# $ echo "SAGE_VERSION=<version>" > build/app/etc/sage-version
83+
# where <version> should be the actual version string, like "7.4"
84+
# 19. Add the tmp and home mounts to /etc/fstab:
85+
# $ echo 'none /tmp usertemp binary,posix=0 0 0' >> build/app/etc/fstab
86+
# $ echo 'C:\Users /home ntfs binary,posix=1,acl 0 0' >> build/app/etc/fstab
87+
# 21. Generate the symlinks.lst file:
88+
# $ (cd build/app/ && find . -type l) > build/app/etc/symlinks.lst

cygwin-bootstrap.list

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
base-cygwin 3.8-1
2+
base-files 4.2-3
3+
bash 4.3.42-4
4+
bzip2 1.0.6-2
5+
ca-certificates 2.10-1
6+
coreutils 8.25-3
7+
cygwin 2.6.0-1
8+
findutils 4.5.12-1
9+
gawk 4.1.3-1
10+
grep 2.25-1
11+
gzip 1.7-2
12+
hostname 3.12-1
13+
libattr1 2.4.46-1
14+
libbz2_1 1.0.6-2
15+
libffi6 3.2.1-2
16+
libgcc1 5.4.0-1
17+
libgmp10 6.1.1-1
18+
libgnutls28 3.3.17-1
19+
libhogweed2 2.7.1-1
20+
libiconv2 1.14-3
21+
libidn11 1.29-1
22+
libidn2_0 0.11-1
23+
libintl8 0.19.8.1-2
24+
liblzma5 5.2.2-1
25+
libmpfr4 3.1.5-1
26+
libncursesw10 6.0-8.20160917
27+
libnettle4 2.7.1-1
28+
libp11-kit0 0.22.1-1
29+
libpcre1 8.39-1
30+
libpsl5 0.14.0-2
31+
libreadline7 6.3.8-1
32+
libstdc++6 5.4.0-1
33+
libtasn1_6 4.9-1
34+
libunistring2 0.9.6-1
35+
libuuid1 2.25.2-2
36+
p11-kit 0.22.1-1
37+
p11-kit-trust 0.22.1-1
38+
sed 4.2.2-3
39+
tar 1.28-1
40+
terminfo 6.0-8.20160917
41+
tzdata 2016j-1
42+
wget 1.17.1-2
43+
xz 5.2.2-1
44+
zlib0 1.2.8-3

0 commit comments

Comments
 (0)