Skip to content
This repository has been archived by the owner on Jan 31, 2023. It is now read-only.

Commit

Permalink
Add the build resources and scripts that have been assembled so far--…
Browse files Browse the repository at this point in the history
…still very sketchy for the most part.
  • Loading branch information
embray committed Dec 13, 2016
1 parent 6237fca commit f6f9240
Show file tree
Hide file tree
Showing 22 changed files with 2,727 additions and 0 deletions.
137 changes: 137 additions & 0 deletions SageMath.iss
@@ -0,0 +1,137 @@
#define MyAppName "SageMath"
#define MyAppVersion "7.4"
#define MyAppPublisher "SageMath"
#define MyAppURL "http://www.sagemath.org/"
#define MyAppContact "http://www.sagemath.org/"

#define SageGroupName "SageMath"

#ifndef Compression
#define Compression "lzma"
#endif

#ifndef AppBuildDir
#define AppBuildDir "build"
#endif

#ifndef DiskSpanning
#if Compression == "none"
#define DiskSpanning="yes"
#else
#define DiskSpanning="no"
#endif
#endif

#define Bin "{app}\app\bin"
#define OptSageMath "{app}\app\opt\sagemath-" + MyAppVersion
#define OptSageMathPosix "/opt/sagemath-" + MyAppVersion

[Setup]
AppCopyright={#MyAppPublisher}
AppId={#MyAppName}
AppContact={#MyAppContact}
AppComments={#MyAppURL}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
ArchitecturesAllowed=x64
ArchitecturesInstallIn64BitMode=x64
DefaultDirName={pf}\{#SageGroupName}
DefaultGroupName={#SageGroupName}
DisableProgramGroupPage=yes
DisableWelcomePage=no
DiskSpanning={#DiskSpanning}
OutputDir=dist
OutputBaseFilename={#MyAppName}-{#MyAppVersion}
Compression={#Compression}
SolidCompression=yes
WizardImageFile=resources\sage-banner.bmp
WizardSmallImageFile=resources\sage-sticker.bmp
WizardImageStretch=yes
UninstallDisplayIcon={app}\unins000.exe
SetupIconFile=resources\sage-floppy-disk.ico
ChangesEnvironment=true
SetupLogging=yes

[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"

[Tasks]
Name: startmenu; Description: "Create &start menu icons"; GroupDescription: "Additional icons"
Name: desktop; Description: "Create &desktop icons"; GroupDescription: "Additional icons"

[Files]
Source: "dot_sage\*"; DestDir: "{#OptSageMath}\dot_sage"; Flags: recursesubdirs ignoreversion
Source: "{#AppBuildDir}\app\*"; DestDir: "{app}\app"; Flags: recursesubdirs ignoreversion
Source: "resources\sagemath.ico"; DestDir: "{app}"; Flags: ignoreversion; AfterInstall: FixupSymlinks

; InnoSetup will not create empty directories found when including files
; recursively in the [Files] section, so any directories that must exist
; (but start out empty) in the cygwin distribution must be created
;
; /etc/fstab.d is where user-specific mount tables go--this is used in
; sage for windows by /etc/sagerc to set up the /dot_sage mount point for
; each user's DOT_SAGE directory, since the actual path name might contain
; spaces and other special characters not handled well by some software that
; uses DOT_SAGE
;
; /dev/shm and /dev/mqueue are used by the system for POSIX semaphores, shared
; memory, and message queues and must be created world-writeable
[Dirs]
Name: "{app}\app\etc\fstab.d"; Permissions: users-modify
Name: "{app}\app\dev\shm"; Permissions: users-modify
Name: "{app}\app\dev\mqueue"; Permissions: users-modify

[UninstallDelete]
Type: filesandordirs; Name: "{app}\app\etc\fstab.d"
Type: filesandordirs; Name: "{app}\app\dev\shm"
Type: filesandordirs; Name: "{app}\app\dev\mqueue"

#define RunSage "/bin/bash --login -c '" + OptSageMathPosix + "/sage'"
#define RunSageDoc "The SageMath console interface"
#define RunSageSh "/bin/bash --login -c '" + OptSageMathPosix + "/sage -sh'"
#define RunSageShDoc "Command prompt in the SageMath shell environment"
#define RunSageNotebook "/bin/bash --login -c '" + OptSageMathPosix + "/sage --notebook jupyter'"
#define RunSageNotebookDoc "Start SageMath notebook server"

[Icons]
Name: "{app}\SageMath"; Filename: "{#bin}\mintty.exe"; Parameters: "-t SageMath -i sagemath.ico {#RunSage}"; WorkingDir: "{app}"; Comment: "{#RunSageDoc}"; IconFilename: "{app}\sagemath.ico"
Name: "{group}\SageMath"; Filename: "{#bin}\mintty.exe"; Parameters: "-t SageMath -i sagemath.ico {#RunSage}"; WorkingDir: "{app}"; Comment: "{#RunSageDoc}"; IconFilename: "{app}\sagemath.ico"; Tasks: startmenu
Name: "{commondesktop}\SageMath"; Filename: "{#bin}\mintty.exe"; Parameters: "-t SageMath -i sagemath.ico {#RunSage}"; WorkingDir: "{app}"; Comment: "{#RunSageDoc}"; IconFilename: "{app}\sagemath.ico"; Tasks: desktop

Name: "{app}\SageMath Shell"; Filename: "{#bin}\mintty.exe"; Parameters: "-t 'SageMath Shell' -i sagemath.ico {#RunSageSh}"; WorkingDir: "{app}"; Comment: "{#RunSageShDoc}"; IconFilename: "{app}\sagemath.ico"
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
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

Name: "{app}\SageMath Notebook"; Filename: "{#bin}\mintty.exe"; Parameters: "-t 'SageMath Shell' -i sagemath.ico {#RunSageNotebook}"; WorkingDir: "{app}"; Comment: "{#RunSageNotebookDoc}"; IconFilename: "{app}\sagemath.ico"
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
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

[Code]
procedure FixupSymlinks();
var
n: Integer;
i: Integer;
resultCode: Integer;
filenames: TArrayOfString;
filenam: String;
begin
LoadStringsFromFile(ExpandConstant('{app}\app\etc\symlinks.lst'), filenames);
n := GetArrayLength(filenames);
WizardForm.ProgressGauge.Min := 0;
WizardForm.ProgressGauge.Max := n - 1;
WizardForm.ProgressGauge.Position := 0;
WizardForm.StatusLabel.Caption := 'Fixing up symlinks...';
for i := 0 to n - 1 do
begin
filenam := filenames[i];
WizardForm.FilenameLabel.Caption := Copy(filenam, 2, Length(filenam));
WizardForm.ProgressGauge.Position := i;
Exec(ExpandConstant('{sys}\attrib.exe'), '+S ' + filenam,
ExpandConstant('{app}\app'), SW_HIDE,
ewNoWait, resultCode);
end;
end;
88 changes: 88 additions & 0 deletions build.py
@@ -0,0 +1,88 @@
"""
Currently just a hand-written and fairly informal list of manual steps for
performing the build. Will be turned into a script, which may not even be
in the form of a single Python script, but I just called it 'build.py' for
now.
"""

# 1. Download setup.exe
# 2. Install bash and other minimal system requirements
# Include this NOTE: This list was collected by manually running setup.exe,
# deslecting all default packages, then installing just bash and base-files,
# and a few dependencies needed for apt-cyg: coreutils, findutils, tar,
# grep, wget, hostname, gawk, bzip2, gzip, then accepting all their
# dependencies as well (which of course pulls in cygwin itself, and any
# other required minimal set of utilities and libraries--this set is even
# smaller than the default cygwin base system). The list was then generated
# by running `cygcheck -c -d | tail -n +3 > cygwin-bootstrap.list`
# 3. Install apt-cyg into the new cygwin's /usr/local/bin
# 4. Run build Cygwin's bash and use apt-cyg to install remaining required
# packages which wil be read from a text file (which will be determined
# mostly by trial and error) (note: this and the previous step could
# probably just be melded into step 2 by installing the full dependency list
# up front--I think for automated builds there's no particular advantage to
# involving apt-cyg if we already have the full list of dependencies)
# 5. Make /opt in the new cygwin
# 6. git clone sage sources to /opt/sagemath-<version> (for automation purposes
# just use the git:// URL)
# 7. Checkout the branch/tag to build (perhaps combine with the previous step)
# 8. cd into /opt/sagemath-7.4 and run
# $ make configure
# 9. Run
# $ ./configure --with-blas=atlas
# 10. Run
# $ SAGE_NUM_THREADS=1 \
# SAGE_INSTALL_CCACHE=yes \
# CCACHE_DIR=</path/to/real/home>/.ccache \
# SAGE_FAT_BINARY=yes \
# SAGE_ATLAS_LIB=/usr \
# make start
# Where </path/to/real/home> should be the path (through /cygdrive/c, most
# likely) to your home directory on the host system from which this Cygwin
# instance is being run--this is to allow it to share your normal .ccache
# directory. Or, if you like, you can use a separate .ccache just for Sage
# builds.
# 11. Upgrade the installed pip--this is annoying but required for some
# patches to how sage runs pip to work properly. This is only required
# for sage 7.4 which uses an older version of pip by default (maybe we
# could patch it in the 7.4-cygwn branch to use a newer version by
# default):
# $ ./sage -pip install --upgrade pip
# 12. From within the build Cygwin, run the sage_cygwin_packages script
# and output its results to cygwin-sage-runtime.list
# 13. Make a new Cygwin install inside build/app relative to this build
# script (or an optional alternative build dir); install all the packages
# listed in cygwin-sage-runtime.list
# $ setup-x86_64.exe --site ftp://mirrors.kernel.org/sourceware/cygwin/ \
# --local-package-dir "$(cygpath -w -a download)" \
# --root "$(cygpath -w -a build/app) \
# --arch x86_64 --no-admin --no-shortcuts --quiet-mode \
# --packages $(cat cygwin-sage-runtime.list | awk '{print $1}' | \
# tr '\n' ',' | sed 's/,$//')
#
# TODO: Right now using a hard-coded mirror, but in the future what we
# really want to ensure reproducibility is a custom mirror with the exact
# package versions we're building with
# TODO: In fact, using Cygwin's setup.exe for this purpose is quite noisy
# and a pain in the ass; when we set up our own local mirror it should
# contain only exactly the packages we need (via a custom setup.ini) and
# we can just install all those packages directly by unpacking them
# 14. Clean up a few files from the Cygwin installation--namely the Cygwin.bat
# and icons:
# $ rm -f build/app/Cygwin*.{bat,ico}
# 15. Copy the /opt directory from the *build* Cygwin into the *runtime*
# Cygwin in build/app, then perform the following cleanup (at a minimum)
# from within the $SAGE_ROOT in build/app (/opt/sagemath-<version>)
# $ rm -rf bootstrap config* logs m4 Makefile upstream \
# local/var/tmp/sage/build/* local/var/lock/* \
# src/build local/share/doc/sage/doctrees
# 16. Install the files in cygwin_extras by just
# $ cp -r cygwin_extras/* build/app/
# 17. Install the /etc/sage-version file:
# $ echo "SAGE_VERSION=<version>" > build/app/etc/sage-version
# where <version> should be the actual version string, like "7.4"
# 19. Add the tmp and home mounts to /etc/fstab:
# $ echo 'none /tmp usertemp binary,posix=0 0 0' >> build/app/etc/fstab
# $ echo 'C:\Users /home ntfs binary,posix=1,acl 0 0' >> build/app/etc/fstab
# 21. Generate the symlinks.lst file:
# $ (cd build/app/ && find . -type l) > build/app/etc/symlinks.lst
44 changes: 44 additions & 0 deletions cygwin-bootstrap.list
@@ -0,0 +1,44 @@
base-cygwin 3.8-1
base-files 4.2-3
bash 4.3.42-4
bzip2 1.0.6-2
ca-certificates 2.10-1
coreutils 8.25-3
cygwin 2.6.0-1
findutils 4.5.12-1
gawk 4.1.3-1
grep 2.25-1
gzip 1.7-2
hostname 3.12-1
libattr1 2.4.46-1
libbz2_1 1.0.6-2
libffi6 3.2.1-2
libgcc1 5.4.0-1
libgmp10 6.1.1-1
libgnutls28 3.3.17-1
libhogweed2 2.7.1-1
libiconv2 1.14-3
libidn11 1.29-1
libidn2_0 0.11-1
libintl8 0.19.8.1-2
liblzma5 5.2.2-1
libmpfr4 3.1.5-1
libncursesw10 6.0-8.20160917
libnettle4 2.7.1-1
libp11-kit0 0.22.1-1
libpcre1 8.39-1
libpsl5 0.14.0-2
libreadline7 6.3.8-1
libstdc++6 5.4.0-1
libtasn1_6 4.9-1
libunistring2 0.9.6-1
libuuid1 2.25.2-2
p11-kit 0.22.1-1
p11-kit-trust 0.22.1-1
sed 4.2.2-3
tar 1.28-1
terminfo 6.0-8.20160917
tzdata 2016j-1
wget 1.17.1-2
xz 5.2.2-1
zlib0 1.2.8-3

0 comments on commit f6f9240

Please sign in to comment.