├── version.txt ├── .github └── FUNDING.yml ├── cygwin-sage-build-x86_64.list ├── cygwin-sage-runtime-x86_64.list ├── patches ├── 8.9 │ ├── 0002-Trac-28801-Fix-ThreeJS-script-paths-for-Firefox-on-W.patch │ └── 0001-Trac-28120-Convert-existing-shared-lock-to-an-exclus.patch ├── 9.0 │ ├── 0001-Trac-28120-Convert-existing-shared-lock-to-an-exclus.patch │ ├── 0002-Trac-28695-These-settings-if-they-are-even-needed-at.patch │ └── 0003-If-a-src-.norebuild-file-is-present-running-make-won.patch ├── 9.2 │ ├── 0001-Downgrade-zeromq-to-the-current-version-supported-in.patch │ └── 0002-Update-Cygwin-psutil-patch-to-properly-use-raw-strin.patch ├── 8.8 │ ├── 0002-Trac-27970-Disable-vpx-support-when-building-libgd-f.patch │ ├── 0001-Trac-28120-Convert-existing-shared-lock-to-an-exclus.patch │ └── 0003-Trac-28154-Patch-scipy-to-including-missing-coding-l.patch └── 8.7 │ ├── 0002-Trac-27493-Patch-OpenBLAS-to-read-environment-variab.patch │ ├── 0001-Trac-27385-Patch-for-Cygwin-to-re-disable-threaded-e.patch │ ├── 0005-Trac-27702-Remove-version-parsing-from-Cygwin-patch-.patch │ ├── 0004-Trac-27565-Add-patch-from-upstream-to-fix-segfaults.patch │ └── 0003-Trac-27509-Add-patch-from-upstream-pull-request-to-f.patch ├── resources ├── sagemath.ico ├── sagemath.png ├── sage-banner.bmp ├── sage-banner.ico ├── sage-banner.png ├── sage-sticker.bmp ├── sage-sticker.ico ├── sage-sticker.png ├── sage-floppy-disk.ico ├── sage-floppy-disk.png ├── sagemath.svg ├── sage-floppy-disk.svg └── sage-banner.svg ├── dot_sage └── ipython-5.0.0 │ └── profile_default │ └── ipython_config.py ├── .gitignore ├── cygwin_extras ├── usr │ └── local │ │ └── bin │ │ ├── _sage-complete-install.sh │ │ ├── sage-sethome │ │ └── apt-cyg └── etc │ ├── minttyrc │ └── profile.d │ └── sagerc.sh ├── README.md ├── tools ├── fixup-symlinks ├── sage-prep-runtime-extras ├── setup-package-list ├── subcyg ├── sage-fixup-doc-symlinks └── sage-prep-runtime ├── cygwin-sage-runtime.list ├── CHANGES.md ├── Makefile ├── cygwin-sage-build.list └── SageMath.iss /version.txt: -------------------------------------------------------------------------------- 1 | 0.6.3 2 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: [embray, sagemath] 2 | -------------------------------------------------------------------------------- /cygwin-sage-build-x86_64.list: -------------------------------------------------------------------------------- 1 | cygwin-sage-build.list -------------------------------------------------------------------------------- /cygwin-sage-runtime-x86_64.list: -------------------------------------------------------------------------------- 1 | cygwin-sage-runtime.list -------------------------------------------------------------------------------- /patches/8.9/0002-Trac-28801-Fix-ThreeJS-script-paths-for-Firefox-on-W.patch: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /resources/sagemath.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sagemath/sage-windows-cygwin/master/resources/sagemath.ico -------------------------------------------------------------------------------- /resources/sagemath.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sagemath/sage-windows-cygwin/master/resources/sagemath.png -------------------------------------------------------------------------------- /resources/sage-banner.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sagemath/sage-windows-cygwin/master/resources/sage-banner.bmp -------------------------------------------------------------------------------- /resources/sage-banner.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sagemath/sage-windows-cygwin/master/resources/sage-banner.ico -------------------------------------------------------------------------------- /resources/sage-banner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sagemath/sage-windows-cygwin/master/resources/sage-banner.png -------------------------------------------------------------------------------- /resources/sage-sticker.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sagemath/sage-windows-cygwin/master/resources/sage-sticker.bmp -------------------------------------------------------------------------------- /resources/sage-sticker.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sagemath/sage-windows-cygwin/master/resources/sage-sticker.ico -------------------------------------------------------------------------------- /resources/sage-sticker.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sagemath/sage-windows-cygwin/master/resources/sage-sticker.png -------------------------------------------------------------------------------- /resources/sage-floppy-disk.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sagemath/sage-windows-cygwin/master/resources/sage-floppy-disk.ico -------------------------------------------------------------------------------- /resources/sage-floppy-disk.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sagemath/sage-windows-cygwin/master/resources/sage-floppy-disk.png -------------------------------------------------------------------------------- /patches/8.9/0001-Trac-28120-Convert-existing-shared-lock-to-an-exclus.patch: -------------------------------------------------------------------------------- 1 | ../8.8/0001-Trac-28120-Convert-existing-shared-lock-to-an-exclus.patch -------------------------------------------------------------------------------- /patches/9.0/0001-Trac-28120-Convert-existing-shared-lock-to-an-exclus.patch: -------------------------------------------------------------------------------- 1 | ../8.8/0001-Trac-28120-Convert-existing-shared-lock-to-an-exclus.patch -------------------------------------------------------------------------------- /dot_sage/ipython-5.0.0/profile_default/ipython_config.py: -------------------------------------------------------------------------------- 1 | c.TerminalInteractiveShell.colors = 'Linux' 2 | c.TerminalInteractiveShell.term_title = False 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore vim cruft 2 | .*.sw[po] 3 | 4 | # Directories created during the build, containing build artifacts 5 | dist 6 | download 7 | envs 8 | .stamps 9 | -------------------------------------------------------------------------------- /cygwin_extras/usr/local/bin/_sage-complete-install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | export PATH=/usr/bin:/bin 3 | for filename in /etc/fstab.d/*; do 4 | dos2unix "$filename" 5 | chmod 600 "$filename" 6 | done 7 | 8 | rm -f /usr/local/bin/_sage-complete-install.sh 9 | -------------------------------------------------------------------------------- /cygwin_extras/etc/minttyrc: -------------------------------------------------------------------------------- 1 | ForegroundColour=248,248,242 2 | BackgroundColour=39,40,34 3 | CursorColour=253,157,79 4 | Black=39,40,34 5 | BoldBlack=117,113,94 6 | Red=249,38,114 7 | BoldRed=204,6,78 8 | Green=166,226,46 9 | BoldGreen=122,172,24 10 | Yellow=244,191,117 11 | BoldYellow=240,169,69 12 | Blue=102,217,239 13 | BoldBlue=33,199,233 14 | Magenta=174,129,255 15 | BoldMagenta=126,51,255 16 | Cyan=161,239,228 17 | BoldCyan=95,227,210 18 | White=248,248,242 19 | BoldWhite=249,248,245 20 | CursorType=block 21 | ScrollbackLines=1000000 22 | BellType=0 23 | BoldAsFont=-1 24 | FontHeight=9 25 | Term=xterm-256color 26 | Font=Consolas 27 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | SageMath for Windows 2 | ==================== 3 | 4 | Build files and instructions for the Cygwin-compatible build of Sage and 5 | its executable installer and auxiliary files. 6 | 7 | You can find the latest release (for now) at https://github.com/sagemath/sage-windows/releases 8 | 9 | Occasionally new versions of SageMath for Windows are released independently 10 | of the Sage version (e.g. to make improvements with the Windows installer 11 | itself). The changes between installer versions are listed in the 12 | [changelog](CHANGES.md). 13 | 14 | Instructions 15 | ============ 16 | 17 | This repository should be run from within Cygwin. 18 | 19 | This Cygwin requires the 'wget' and 'python' packages. 20 | -------------------------------------------------------------------------------- /patches/9.2/0001-Downgrade-zeromq-to-the-current-version-supported-in.patch: -------------------------------------------------------------------------------- 1 | From a5e443ee0cce5bfb28d566b6238b2a855e21a3d8 Mon Sep 17 00:00:00 2001 2 | From: "E. Madison Bray" 3 | Date: Thu, 12 Nov 2020 15:06:52 +0100 4 | Subject: [PATCH] Downgrade zeromq to the current version supported in Cygwin, 5 | which should still be good enough 6 | 7 | --- 8 | build/pkgs/zeromq/spkg-configure.m4 | 2 +- 9 | 1 file changed, 1 insertion(+), 1 deletion(-) 10 | 11 | diff --git a/build/pkgs/zeromq/spkg-configure.m4 b/build/pkgs/zeromq/spkg-configure.m4 12 | index a584a74cc2..ef64680313 100644 13 | --- a/build/pkgs/zeromq/spkg-configure.m4 14 | +++ b/build/pkgs/zeromq/spkg-configure.m4 15 | @@ -1,3 +1,3 @@ 16 | SAGE_SPKG_CONFIGURE([zeromq], [ 17 | - AX_ZMQ([4.2.5], [], [sage_spkg_install_zeromq=yes]) 18 | + AX_ZMQ([4.2.3], [], [sage_spkg_install_zeromq=yes]) 19 | ]) 20 | -- 21 | 2.29.2 22 | 23 | -------------------------------------------------------------------------------- /tools/fixup-symlinks: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # This tool goes through a directory tree and recreates all symlinks it finds 4 | # as winsymlinks:lnk (.lnk shortcut files) since InnoSetup cannot store symlinks 5 | # as WSL reparse points, which are now how Cygwin creates symlinks by default 6 | # on Windows 10 on NTFS filesystems (see 7 | # https://www.cygwin.com/cygwin-ug-net/using.html#pathnames-symlinks); this changed 8 | # in Cygwin 3.1. 9 | # 10 | # There is also not an option I can find to force creation of old-style "magic cookie" 11 | # Cygwin symlinks which are what we used before. 12 | # 13 | # It also outputs the path to each link which can be used to create a list of all 14 | # symlinks in the tree. 15 | 16 | dirname="$1" 17 | cd "$dirname" 18 | 19 | export CYGWIN="winsymlinks:lnk" 20 | 21 | for link in $(find . -type l); do 22 | # Recreate the link in the .lnk format 23 | target="$(readlink "$link")" 24 | rm -f "$link" 25 | ln -s "$target" "$link" 26 | echo "$link" 27 | done 28 | -------------------------------------------------------------------------------- /tools/sage-prep-runtime-extras: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Install additional files into the runtime Cygwin environment and/or update 3 | # existing files where necessary. 4 | 5 | ENV_RUNTIME_DIR="$1" 6 | CYGWIN_EXTRAS="$2" 7 | SAGE_VERSION="$3" 8 | 9 | if [ -z "$ENV_RUNTIME_DIR" -o -z "$CYGWIN_EXTRAS" -o -z "$SAGE_VERSION" ]; then 10 | # Be extra safe here; e.g. if $CYGWIN_EXTRAS is missing then the next 11 | # line will try to copy all of / 12 | echo "sage-prep-runtime-extras missing arguments" >&2 13 | exit 1 14 | fi 15 | 16 | cp -r "$CYGWIN_EXTRAS"/* "$ENV_RUNTIME_DIR" 17 | echo "SAGE_VERSION=$SAGE_VERSION" > "${ENV_RUNTIME_DIR}/etc/sage-version" 18 | 19 | NSSWITCH="${ENV_RUNTIME_DIR}/etc/nsswitch.conf" 20 | NSSWITCH_LINE='db_home: /home/sage' 21 | if ! grep "$NSSWITCH_LINE" "$NSSWITCH" > /dev/null; then 22 | echo "$NSSWITCH_LINE" >> "$NSSWITCH" 23 | fi 24 | 25 | # Set the package download cache to something sensible; otherwise it 26 | # will hard-code the package download cache used when building the 27 | # environment in the installer, which is not what we want 28 | # See https://github.com/sagemath/sage-windows/issues/24 29 | sed -i '/^last-cache/{n;s|.*|\t/tmp|;}' "${ENV_RUNTIME_DIR}/etc/setup/setup.rc" 30 | -------------------------------------------------------------------------------- /tools/setup-package-list: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | """ 4 | Script that reads a Cygwin package list and returns a comma-separated list of 5 | package names to be passed to Cygwin's setup.exe as the --packages argument. 6 | """ 7 | 8 | from __future__ import print_function 9 | 10 | import argparse 11 | import sys 12 | 13 | 14 | def main(argv=None): 15 | parser = argparse.ArgumentParser(description=__doc__) 16 | parser.add_argument('file', metavar='FILE', type=argparse.FileType('r'), 17 | help='path to a list of Cygwin packages; the format ' 18 | 'of this file is currently underspecified, but ' 19 | 'is typically two columns: one of package names ' 20 | 'and one of package versions; currently only the ' 21 | 'package names are used') 22 | args = parser.parse_args(argv) 23 | 24 | with args.file as f: 25 | packages = [] 26 | for line in f: 27 | package, version = [s.strip() for s in line.split()][:2] 28 | packages.append((package, version)) 29 | 30 | print(','.join(p[0] for p in packages)) 31 | 32 | 33 | if __name__ == '__main__': 34 | sys.exit(main()) 35 | -------------------------------------------------------------------------------- /patches/9.0/0002-Trac-28695-These-settings-if-they-are-even-needed-at.patch: -------------------------------------------------------------------------------- 1 | From ca7013b61464c3516db1554534f6f01f2b6514ad Mon Sep 17 00:00:00 2001 2 | From: "E. Madison Bray" 3 | Date: Wed, 8 Jan 2020 15:20:50 +0100 4 | Subject: [PATCH] Trac #28695: These settings (if they are even needed at all) 5 | should use -print-prog-name, which on current gcc versions will provide the 6 | full path to the program. 7 | 8 | --- 9 | src/bin/sage-env | 4 ++-- 10 | 1 file changed, 2 insertions(+), 2 deletions(-) 11 | 12 | diff --git a/src/bin/sage-env b/src/bin/sage-env 13 | index 49f29942df..c9623effc8 100644 14 | --- a/src/bin/sage-env 15 | +++ b/src/bin/sage-env 16 | @@ -500,7 +500,7 @@ fi 17 | 18 | # Set AS to assembler used by $CC ("as" by default) 19 | if [ "$AS" = "" ]; then 20 | - CC_as=`$CC -print-file-name=as 2>/dev/null` 21 | + CC_as=`$CC -print-prog-name=as 2>/dev/null` 22 | if command -v $CC_as >/dev/null 2>/dev/null; then 23 | AS="$CC_as" 24 | fi 25 | @@ -512,7 +512,7 @@ export AS 26 | 27 | # Set LD to linker used by $CC ("ld" by default) 28 | if [ "$LD" = "" ]; then 29 | - CC_ld=`$CC -print-file-name=ld 2>/dev/null` 30 | + CC_ld=`$CC -print-prog-name=ld 2>/dev/null` 31 | if command -v $CC_ld >/dev/null 2>/dev/null; then 32 | LD="$CC_ld" 33 | fi 34 | -- 35 | 2.21.0 36 | 37 | -------------------------------------------------------------------------------- /patches/9.0/0003-If-a-src-.norebuild-file-is-present-running-make-won.patch: -------------------------------------------------------------------------------- 1 | From c2173096eee85975cbb0708ece03586438796135 Mon Sep 17 00:00:00 2001 2 | From: "E. Madison Bray" 3 | Date: Thu, 6 Feb 2020 12:47:11 +0100 4 | Subject: [PATCH] If a src/.norebuild file is present, running make won't 5 | re-build sagelib under any circumstances 6 | 7 | --- 8 | src/Makefile.in | 5 +++++ 9 | 1 file changed, 5 insertions(+) 10 | 11 | diff --git a/src/Makefile.in b/src/Makefile.in 12 | index b296775710..ae914013fe 100644 13 | --- a/src/Makefile.in 14 | +++ b/src/Makefile.in 15 | @@ -29,6 +29,7 @@ all: sage 16 | ## TODO: Currently providing --install-base=$(SAGE_LOCAL) leads to this error: 17 | ## [sagelib-7.4.beta4] running install 18 | ## [sagelib-7.4.beta4] error: install-base or install-platbase supplied, but installation scheme is incomplete 19 | +ifeq (,$(wildcard $(srcdir)/.norebuild)) 20 | sage: 21 | cd $(srcdir) && export \ 22 | SAGE_ROOT=/doesnotexist \ 23 | @@ -41,6 +42,10 @@ sage: 24 | if [ "$$UNAME" = "CYGWIN" ]; then \ 25 | sage-rebase.sh "$$SAGE_LOCAL" 2>/dev/null; \ 26 | fi 27 | +else 28 | +sage: 29 | + @echo "Not rebuilding sagelib due to presence of $(srcdir)/.norebuild" 30 | +endif 31 | 32 | clean: 33 | @echo "Deleting Sage library build artifacts..." 34 | -- 35 | 2.21.0 36 | 37 | -------------------------------------------------------------------------------- /cygwin_extras/usr/local/bin/sage-sethome: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Windows only: Update the Windows directory you would prefer to mount 3 | # to /home/sage 4 | # 5 | # Usage: 6 | # 7 | # sage-sethome [-h|--help] [DIRECTORY] 8 | # 9 | # Arguments: 10 | # DIRECTORY the path (Windows-style or POSIX-style, but correctly 11 | # quoted); if ommitted this defaults to the value Windows 12 | # $USERPROFILE environment variable (e.g. 13 | # C:\Users\ on most systems) 14 | # -h --help print this usage message 15 | 16 | THIS="$0" 17 | case "$1" in 18 | -h|--help) 19 | while read line 20 | do 21 | if [[ "${line:0:2}" == '#!' ]]; then 22 | continue 23 | elif [[ "${line:0:1}" == '#' ]]; then 24 | echo "${line:2}" 25 | else 26 | break 27 | fi 28 | done < "$THIS" 29 | exit 0 30 | ;; 31 | esac 32 | 33 | DIR="$1" 34 | if [ -z "$DIR" ]; then 35 | DIR="$USERPROFILE" 36 | fi 37 | 38 | DIR="$(cygpath -w -a "${DIR}")" 39 | SAFE_DIR="$(echo "${DIR}" | sed 's/ /\\040/g')" 40 | FSTAB="/etc/fstab.d/${USERNAME}" 41 | echo "${SAFE_DIR} /home/sage ntfs binary,posix=1,user,acl 0 0" > "$FSTAB" 42 | echo 'none /tmp usertemp binary,posix=0 0 0' >> "$FSTAB" 43 | chmod 600 "$FSTAB" 44 | mount -a 45 | echo "Sage home directory set to '${DIR}'" 46 | echo "Close and restart all Sage sessions for the new setting to take effect." 47 | -------------------------------------------------------------------------------- /patches/8.8/0002-Trac-27970-Disable-vpx-support-when-building-libgd-f.patch: -------------------------------------------------------------------------------- 1 | From cec95ace7ebf8339940a500e07b4d1066624af39 Mon Sep 17 00:00:00 2001 2 | From: "Erik M. Bray" 3 | Date: Tue, 11 Jun 2019 22:30:39 +0200 4 | Subject: [PATCH] Trac #27970: Disable vpx support when building libgd for 5 | Cygwin 6 | 7 | We don't use this functionality anyways. If it happens to exist in the system 8 | package that is also harmless. It just happens that the system package for 9 | libvpx is broken in some cases (Cygwin < 2.10). 10 | --- 11 | build/pkgs/libgd/spkg-install | 8 ++++++++ 12 | 1 file changed, 8 insertions(+) 13 | 14 | diff --git a/build/pkgs/libgd/spkg-install b/build/pkgs/libgd/spkg-install 15 | index 85cafb7f63..52271ce138 100644 16 | --- a/build/pkgs/libgd/spkg-install 17 | +++ b/build/pkgs/libgd/spkg-install 18 | @@ -7,6 +7,14 @@ cd src 19 | 20 | export CFLAGS="-g $CFLAGS" 21 | 22 | +if [ "$UNAME" = "CYGWIN" ]; then 23 | + # Compiling with vpx support creates a broken library in some cases 24 | + # because the vpx package itself is broken on some older Cygwin versions; 25 | + # we don't need this feature so safer to just disable 26 | + # https://trac.sagemath.org/ticket/27970 27 | + LIBGD_CONFIGURE="--without-vpx $LIBGD_CONFIGURE" 28 | +fi 29 | + 30 | # We explicitly disable X and fontconfig support, since (1) X is not a SAGE dependency, 31 | # and (2) the gd build fails on a lot of OS X PPC machines when X is enabled. 32 | sdh_configure --without-jpeg --without-xpm --without-x --without-fontconfig \ 33 | -- 34 | 2.21.0 35 | 36 | -------------------------------------------------------------------------------- /patches/8.8/0001-Trac-28120-Convert-existing-shared-lock-to-an-exclus.patch: -------------------------------------------------------------------------------- 1 | From 70cc3c231b780b5868a544e097d671533fdbd8b7 Mon Sep 17 00:00:00 2001 2 | From: "Erik M. Bray" 3 | Date: Fri, 5 Jul 2019 14:53:40 +0200 4 | Subject: [PATCH] Trac #28120: Convert existing shared lock to an exclusively 5 | lock on the same fd. 6 | 7 | --- 8 | build/bin/sage-spkg | 18 +++++++++++------- 9 | 1 file changed, 11 insertions(+), 7 deletions(-) 10 | 11 | diff --git a/build/bin/sage-spkg b/build/bin/sage-spkg 12 | index eff76b082b..2433c429ad 100755 13 | --- a/build/bin/sage-spkg 14 | +++ b/build/bin/sage-spkg 15 | @@ -952,16 +952,20 @@ if [ -f spkg-postinst ]; then 16 | fi 17 | 18 | if [ "$UNAME" = "CYGWIN" ]; then 19 | - # Drop our sage-spkg's shared lock, and try to call sage-rebase.sh 20 | - # under an exclusive lock 21 | - sage-flock -u 200 22 | - 23 | # Rebase after installing each package--in case any packages load this 24 | # package at build time we need to ensure during the build that no binaries 25 | # have conflicting address spaces 26 | - echo "Waiting for rebase lock" 27 | - sage-flock -x "$SAGE_LOCAL/var/lock/rebase.lock" \ 28 | - sage-rebase.sh "$SAGE_LOCAL" 2>/dev/null 29 | + # 30 | + # Convert the existing shared lock to an exclusive lock; this isn't 31 | + # necessarily atomic, so another process *may* grab a shared lock in the 32 | + # meantime and keep us waiting. 33 | + echo "Waiting for rebase lock..." 34 | + sage-flock -x 200 35 | + 36 | + sage-rebase.sh "$SAGE_LOCAL" 2>/dev/null 37 | + 38 | + # Explicitly release the flock 39 | + sage-flock -u 200 40 | fi 41 | 42 | 43 | -- 44 | 2.21.0 45 | 46 | -------------------------------------------------------------------------------- /cygwin_extras/etc/profile.d/sagerc.sh: -------------------------------------------------------------------------------- 1 | # Startup configuration for SageMath for Windows 2 | # Sets a few environment variables and initializes files in the user's home 3 | # directory 4 | source /etc/sage-version 5 | 6 | # Simply hard-coded for now 7 | export SAGE_ROOT=/opt/sagemath-${SAGE_VERSION} 8 | 9 | # Mount the user's real home directory to /home/sage if not already done 10 | if [ -n "${USERNAME}" -a ! -f "/etc/fstab.d/${USERNAME}" ]; then 11 | /usr/local/bin/sage-sethome 12 | fi 13 | 14 | # .sage migration--older versions of Sage for Windows put DOT_SAGE in 15 | # ~/.sagemath-${SAGE_VERSION}, but now we are switching over to just 16 | # ~/.sage, and sharing it between versions. 17 | # If the user already has ~/.sage we leave it alone and do nothing. 18 | # Otherwise we move the old ~/.sagemath-${SAGE_VERSION} to ~/.sage. 19 | OLD_DOT_SAGE="${HOME}/.sagemath-${SAGE_VERSION}" 20 | NEW_DOT_SAGE="${HOME}/.sage" 21 | if [ ! -d "$NEW_DOT_SAGE" ]; then 22 | if [ -d "$OLD_DOT_SAGE" ]; then 23 | mv "$OLD_DOT_SAGE" "$NEW_DOT_SAGE" 24 | else 25 | # Else create an empty directory to copy into 26 | mkdir "$NEW_DOT_SAGE" 27 | fi 28 | # Initialize dot_sage with some defaults 29 | cp -R "$SAGE_ROOT/dot_sage/"* "$NEW_DOT_SAGE" 30 | fi 31 | 32 | # This is needed so that the Python webbrowser module can easily open the 33 | # system browser through Cygwin 34 | export BROWSER=cygstart 35 | 36 | # Set the default editor to nano; best for beginners. More advanced users 37 | # should change this in their `.profile`. 38 | export EDITOR=nano 39 | 40 | # See https://github.com/embray/sage-windows/issues/12 41 | export PYTHONWARNINGS="ignore:not adding directory '' to sys.path" 42 | -------------------------------------------------------------------------------- /patches/8.7/0002-Trac-27493-Patch-OpenBLAS-to-read-environment-variab.patch: -------------------------------------------------------------------------------- 1 | From abe0d276b890bc1005158ad39011443b62d55296 Mon Sep 17 00:00:00 2001 2 | From: "Erik M. Bray" 3 | Date: Fri, 15 Mar 2019 15:37:56 +0100 4 | Subject: [PATCH] Trac #27493: Patch OpenBLAS to read environment variables 5 | properly on Cygwin 6 | 7 | --- 8 | .../patches/0001-Use-POSIX-getenv-on-Cygwin.patch | 28 ++++++++++++++++++++++ 9 | 1 file changed, 28 insertions(+) 10 | create mode 100644 build/pkgs/openblas/patches/0001-Use-POSIX-getenv-on-Cygwin.patch 11 | 12 | diff --git a/build/pkgs/openblas/patches/0001-Use-POSIX-getenv-on-Cygwin.patch b/build/pkgs/openblas/patches/0001-Use-POSIX-getenv-on-Cygwin.patch 13 | new file mode 100644 14 | index 0000000000..3a26960a9f 15 | --- /dev/null 16 | +++ b/build/pkgs/openblas/patches/0001-Use-POSIX-getenv-on-Cygwin.patch 17 | @@ -0,0 +1,28 @@ 18 | +From 1006ff8a7bc4ee77150d6f13483838c96789e3fc Mon Sep 17 00:00:00 2001 19 | +From: "Erik M. Bray" 20 | +Date: Fri, 15 Mar 2019 15:06:30 +0100 21 | +Subject: [PATCH] Use POSIX getenv on Cygwin 22 | + 23 | +The Windows-native GetEnvironmentVariable cannot be relied on, as 24 | +Cygwin does not always copy environment variables set through Cygwin 25 | +to the Windows environment block, particularly after fork(). 26 | +--- 27 | + common.h | 2 +- 28 | + 1 file changed, 1 insertion(+), 1 deletion(-) 29 | + 30 | +diff --git a/common.h b/common.h 31 | +index 7fcd5e31..f239c3d7 100644 32 | +--- a/common.h 33 | ++++ b/common.h 34 | +@@ -439,7 +439,7 @@ please https://github.com/xianyi/OpenBLAS/issues/246 35 | + typedef char env_var_t[MAX_PATH]; 36 | + #define readenv(p, n) 0 37 | + #else 38 | +-#ifdef OS_WINDOWS 39 | ++#if defined(OS_WINDOWS) && !defined(OS_CYGWIN_NT) 40 | + typedef char env_var_t[MAX_PATH]; 41 | + #define readenv(p, n) GetEnvironmentVariable((LPCTSTR)(n), (LPTSTR)(p), sizeof(p)) 42 | + #else 43 | +-- 44 | +2.15.1 45 | + 46 | -- 47 | 2.15.1 48 | 49 | -------------------------------------------------------------------------------- /tools/subcyg: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Ensure job control is enabled 4 | set -o monitor 5 | 6 | if [ -z "$SHELL" ]; then 7 | SHELL=/bin/bash 8 | fi 9 | 10 | env=$(which env) 11 | cygstart=$(which cygstart) 12 | cmdpath=$(dirname $(which cmd)) 13 | 14 | subcyg_root=${1%/} 15 | shift 16 | 17 | trap 'rm -f "$subcyg_root$outtmp" "$subcyg_root$pidtmp"' EXIT 18 | 19 | tmpfile_name() { 20 | tmp=$(mktemp) 21 | rm -f "$tmp" 22 | echo "$tmp" 23 | } 24 | 25 | outtmp=$(tmpfile_name) 26 | pidtmp=$(tmpfile_name) 27 | 28 | clean_env="$env -i PATH=$cmdpath" 29 | subcyg_shell="$clean_env $cygstart --wait --hide ${subcyg_root}$SHELL" 30 | 31 | on_interrupt() { 32 | # Use a second subcyg shell to forward the SIGINT through to the first 33 | # subcyg, interrupting whatever process it's running 34 | if [ -e "$subcyg_root$pidtmp" ]; then 35 | $subcyg_shell -l -c "'""kill -- -$(cat "$subcyg_root$pidtmp")""'" 36 | fi 37 | exit $(kill -l SIGINT) 38 | } 39 | 40 | trap 'on_interrupt' INT 41 | # NOTE: Have to be *very* careful about quoting everything after the -c 42 | # This does not yet cover all cases 43 | $subcyg_shell -l -c "'(""$@"') >'$outtmp' 2>&1 & cat /proc/$!/pgid >'$pidtmp'; wait $!'"'" & 44 | pid=$! 45 | 46 | # We can't simply do a fd redirect from the temp file to console this script is 47 | # running in, since they're in different Cygwins that don't know about each 48 | # other. In other words, this Cygwin can't simply follow writes to outtmp. So 49 | # instead we just watch it with tail 50 | # 51 | # Some commands don't produce any output, so also ensure that the output file 52 | # exists first. But wait at least a second for the file to show up since 53 | # sometimes there can be a delay. 54 | sleep 1 55 | if [ -f "$subcyg_root$outtmp" ]; then 56 | tail -F --pid=$pid "$subcyg_root$outtmp" 2>/dev/null 57 | if [ $? -eq 130 ]; then 58 | # tail was interrupted by Ctrl-C, so treat this as though the 59 | # wrapped command were terminated as well. 60 | on_interrupt 61 | fi 62 | fi 63 | 64 | wait $pid 65 | exit $? 66 | -------------------------------------------------------------------------------- /patches/8.7/0001-Trac-27385-Patch-for-Cygwin-to-re-disable-threaded-e.patch: -------------------------------------------------------------------------------- 1 | From 8d0a9df87cfe93082085f2805e47ef75026588a3 Mon Sep 17 00:00:00 2001 2 | From: "Erik M. Bray" 3 | Date: Wed, 6 Mar 2019 15:52:01 +0100 4 | Subject: [PATCH] Trac #27385: Patch for Cygwin to re-disable threaded eval 5 | until/unless it can be fixed. 6 | 7 | --- 8 | build/pkgs/giac/package-version.txt | 2 +- 9 | build/pkgs/giac/patches/cygwin-icas.patch | 23 +++++++++++++++++++++++ 10 | 2 files changed, 24 insertions(+), 1 deletion(-) 11 | create mode 100644 build/pkgs/giac/patches/cygwin-icas.patch 12 | 13 | diff --git a/build/pkgs/giac/package-version.txt b/build/pkgs/giac/package-version.txt 14 | index ce3c8deec6..b894ff7476 100644 15 | --- a/build/pkgs/giac/package-version.txt 16 | +++ b/build/pkgs/giac/package-version.txt 17 | @@ -1 +1 @@ 18 | -1.5.0.37.p0 19 | +1.5.0.37.p1 20 | diff --git a/build/pkgs/giac/patches/cygwin-icas.patch b/build/pkgs/giac/patches/cygwin-icas.patch 21 | new file mode 100644 22 | index 0000000000..8866980664 23 | --- /dev/null 24 | +++ b/build/pkgs/giac/patches/cygwin-icas.patch 25 | @@ -0,0 +1,23 @@ 26 | +Disable threaded eval function on Cygwin since it's currently 27 | +buggy, and not strictly needed in the first place since we don't 28 | +build giac with FLTK support; see https://trac.sagemath.org/ticket/27385 29 | +--- a/src/icas.cc 2018-12-22 17:08:24.000000000 +0100 30 | ++++ b/src/icas.cc 2019-03-06 14:38:19.814030200 +0100 31 | +@@ -160,7 +160,7 @@ 32 | + using namespace giac; 33 | + #define STDIN_FILENO 0 34 | + namespace xcas { 35 | +- /* 36 | ++#ifdef __CYGWIN__ 37 | + void icas_eval(giac::gen & g,giac::gen & gg,int & reading_file,std::string &filename,giac::context * contextptr){ 38 | + gg=protecteval(g,10,contextptr); 39 | + } 40 | +@@ -168,7 +168,7 @@ 41 | + bool fltk_view(const giac::gen & g,giac::gen & ge,const std::string & filename,std::string & figure_filename,int file_type,const giac::context *contextptr){ 42 | + return false; 43 | + } 44 | +- */ 45 | ++#endif 46 | + } 47 | + 48 | + #else 49 | -- 50 | 2.15.1 51 | 52 | -------------------------------------------------------------------------------- /patches/9.2/0002-Update-Cygwin-psutil-patch-to-properly-use-raw-strin.patch: -------------------------------------------------------------------------------- 1 | From ea185519e6f0ea6365514b7b822ea9eab44b6342 Mon Sep 17 00:00:00 2001 2 | From: "E. Madison Bray" 3 | Date: Wed, 18 Nov 2020 15:02:34 +0100 4 | Subject: [PATCH] Update Cygwin psutil patch to properly use raw strings for 5 | regexps 6 | 7 | --- 8 | build/pkgs/psutil/patches/cygwin-support.patch | 6 +++--- 9 | 1 file changed, 3 insertions(+), 3 deletions(-) 10 | 11 | diff --git a/build/pkgs/psutil/patches/cygwin-support.patch b/build/pkgs/psutil/patches/cygwin-support.patch 12 | index 96538e65d9..ca92c0d35a 100644 13 | --- a/build/pkgs/psutil/patches/cygwin-support.patch 14 | +++ b/build/pkgs/psutil/patches/cygwin-support.patch 15 | @@ -516,7 +516,7 @@ index 0000000..ffba639 16 | + # https://github.com/giampaolo/psutil/issues/200 17 | + # try to parse /proc/stat as a last resort 18 | + if num == 0: 19 | -+ search = re.compile('cpu\d') 20 | ++ search = re.compile(r'cpu\d') 21 | + with open_text('%s/stat' % get_procfs_path()) as f: 22 | + for line in f: 23 | + line = line.split(' ')[0] 24 | @@ -1081,7 +1081,7 @@ index 0000000..ffba639 25 | + return int(self._parse_stat_file()[2]) 26 | + 27 | + @wrap_exceptions 28 | -+ def uids(self, _uids_re=re.compile(b'Uid:\t(\d+)')): 29 | ++ def uids(self, _uids_re=re.compile(rb'Uid:\t(\d+)')): 30 | + # More or less the same as on Linux, but the fields are separated by 31 | + # spaces instead of tabs; and anyways there is no difference on Cygwin 32 | + # between real, effective, and saved uids. 33 | @@ -1092,7 +1092,7 @@ index 0000000..ffba639 34 | + return _common.puids(int(real), int(real), int(real)) 35 | + 36 | + @wrap_exceptions 37 | -+ def gids(self, _gids_re=re.compile(b'Gid:\t(\d+)')): 38 | ++ def gids(self, _gids_re=re.compile(rb'Gid:\t(\d+)')): 39 | + # See note in uids 40 | + data = self._read_status_file() 41 | + real = _gids_re.findall(data)[0] 42 | -- 43 | 2.29.2 44 | 45 | -------------------------------------------------------------------------------- /patches/8.7/0005-Trac-27702-Remove-version-parsing-from-Cygwin-patch-.patch: -------------------------------------------------------------------------------- 1 | From 97f0883e6001aa8d9a139944359707c391ad4ea7 Mon Sep 17 00:00:00 2001 2 | From: "Erik M. Bray" 3 | Date: Fri, 19 Apr 2019 09:04:22 +0200 4 | Subject: [PATCH] Trac #27702: Remove version parsing from Cygwin patch to 5 | psutil. 6 | 7 | It currently is not used, and is broken on Cygwin 3.0.0+. 8 | --- 9 | build/pkgs/psutil/package-version.txt | 2 +- 10 | build/pkgs/psutil/patches/cygwin-support.patch | 19 +------------------ 11 | 2 files changed, 2 insertions(+), 19 deletions(-) 12 | 13 | diff --git a/build/pkgs/psutil/package-version.txt b/build/pkgs/psutil/package-version.txt 14 | index 17b5de986f..3d61945d1e 100644 15 | --- a/build/pkgs/psutil/package-version.txt 16 | +++ b/build/pkgs/psutil/package-version.txt 17 | @@ -1 +1 @@ 18 | -5.2.0.p1 19 | +5.2.0.p2 20 | diff --git a/build/pkgs/psutil/patches/cygwin-support.patch b/build/pkgs/psutil/patches/cygwin-support.patch 21 | index 6ef41fb658..17eac80028 100644 22 | --- a/build/pkgs/psutil/patches/cygwin-support.patch 23 | +++ b/build/pkgs/psutil/patches/cygwin-support.patch 24 | @@ -205,7 +205,7 @@ new file mode 100644 25 | index 0000000..ffba639 26 | --- /dev/null 27 | +++ b/psutil/_pscygwin.py 28 | -@@ -0,0 +1,908 @@ 29 | +@@ -0,0 +1,891 @@ 30 | +"""Cygwin platform implementation.""" 31 | + 32 | +# TODO: Large chunks of this module are copy/pasted from the Linux module; 33 | @@ -253,23 +253,6 @@ index 0000000..ffba639 34 | +# --- constants 35 | +# ===================================================================== 36 | + 37 | -+_cygwin_version_re = re.compile(r'(?P\d+)\.(?P\d+)\.' 38 | -+ '(?P\d+)\((?P\d+)\.' 39 | -+ '(?P\d+)/(?P\d+)/' 40 | -+ '(?P\d+)\)') 41 | -+_cygwin_version = _cygwin_version_re.match(os.uname()[2]).groupdict() 42 | -+ 43 | -+CYGWIN_VERSION = (int(_cygwin_version['major']), 44 | -+ int(_cygwin_version['minor']), 45 | -+ int(_cygwin_version['micro'])) 46 | -+ 47 | -+CYGWIN_VERSION_API = (int(_cygwin_version['api_major']), 48 | -+ int(_cygwin_version['api_minor'])) 49 | -+ 50 | -+CYGWIN_VERSION_SHARED_DATA = int(_cygwin_version['shared_data']) 51 | -+ 52 | -+CYGWIN_VERSION_MOUNT_REGISTRY = int(_cygwin_version['mount_registry']) 53 | -+ 54 | + 55 | +if enum is None: 56 | + AF_LINK = -1 57 | -- 58 | 2.15.1 59 | 60 | -------------------------------------------------------------------------------- /tools/sage-fixup-doc-symlinks: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | """ 4 | Used to work around the issue of symlinks in the offline HTML docs on 5 | Windows. 6 | 7 | Because Windows browsers do not know how to interpret Cygwin symlinks, we 8 | instead need to fix up relative URIs in the HTML to avoid the use of 9 | symlinked paths. 10 | """ 11 | 12 | import argparse 13 | import os 14 | import re 15 | import sys 16 | 17 | 18 | def fixup_doc_link(link_path, verbose=False): 19 | dirname = os.path.dirname(link_path) 20 | link_real_path = os.path.realpath(link_path) 21 | 22 | for curdir, dirs, files in os.walk(dirname): 23 | # The path of the link relative to the current file; this is the 24 | # path that is currently used in URLs 25 | old = os.path.relpath(link_path, curdir) 26 | 27 | # The new relative path after resolving the link 28 | new = os.path.relpath(link_real_path, curdir) 29 | regexp = re.compile(r'(src|href)="' + re.escape(old)) 30 | repl = r'\1="' + new 31 | 32 | for filename in files: 33 | if not filename.endswith('.html'): 34 | continue 35 | 36 | if verbose: 37 | print(' -> ' + filename) 38 | 39 | filepath = os.path.join(curdir, filename) 40 | with open(filepath) as fobj: 41 | text = fobj.readlines() 42 | 43 | with open(filepath, 'w') as fobj: 44 | for line in text: 45 | line = regexp.sub(repl, line) 46 | fobj.write(line) 47 | 48 | 49 | def main(argv=None): 50 | doc = [l.rstrip() for l in __doc__.strip().splitlines()] + [''] 51 | split = doc.index('') 52 | usage = '\n'.join(doc[:split]) 53 | epilog = '\n'.join(doc[split:]).strip() 54 | parser = argparse.ArgumentParser(usage=usage, epilog=epilog) 55 | parser.add_argument('dir', metavar='DIR', 56 | help='path to the Sage HTML documentation') 57 | parser.add_argument('-V', '--verbose', action='store_true', 58 | help='verbose output') 59 | args = parser.parse_args() 60 | 61 | for curdir, dirs, files in os.walk(args.dir): 62 | # For the purposes of this script we are only interested in symlinks to 63 | # directories which, slightly paradoxically, show up in the dirs list 64 | # in os.walk... 65 | for dirname in dirs: 66 | dirpath = os.path.join(curdir, dirname) 67 | if os.path.islink(dirpath): 68 | if args.verbose: 69 | print("Fixing up links to {}".format(dirpath)) 70 | fixup_doc_link(dirpath, verbose=args.verbose) 71 | 72 | 73 | if __name__ == '__main__': 74 | sys.exit(main()) 75 | -------------------------------------------------------------------------------- /patches/8.8/0003-Trac-28154-Patch-scipy-to-including-missing-coding-l.patch: -------------------------------------------------------------------------------- 1 | From e6ae4f7b909b468e23d12f2c40d3aa0ca91d8a2a Mon Sep 17 00:00:00 2001 2 | From: "Erik M. Bray" 3 | Date: Wed, 10 Jul 2019 12:17:34 +0200 4 | Subject: [PATCH] Trac #28154: Patch scipy to including missing coding lines on 5 | some source files containing unicode. 6 | 7 | --- 8 | ...35f2c27be9f209cfc6f347e7a57a4a62e693.patch | 48 +++++++++++++++++++ 9 | 1 file changed, 48 insertions(+) 10 | create mode 100644 build/pkgs/scipy/patches/4a8a35f2c27be9f209cfc6f347e7a57a4a62e693.patch 11 | 12 | diff --git a/build/pkgs/scipy/patches/4a8a35f2c27be9f209cfc6f347e7a57a4a62e693.patch b/build/pkgs/scipy/patches/4a8a35f2c27be9f209cfc6f347e7a57a4a62e693.patch 13 | new file mode 100644 14 | index 0000000000..17e04da533 15 | --- /dev/null 16 | +++ b/build/pkgs/scipy/patches/4a8a35f2c27be9f209cfc6f347e7a57a4a62e693.patch 17 | @@ -0,0 +1,48 @@ 18 | +From 4a8a35f2c27be9f209cfc6f347e7a57a4a62e693 Mon Sep 17 00:00:00 2001 19 | +From: Eric Larson 20 | +Date: Wed, 19 Dec 2018 10:50:47 -0500 21 | +Subject: [PATCH] FIX: Fix encoding lines 22 | + 23 | +--- 24 | + scipy/io/__init__.py | 2 +- 25 | + scipy/stats/_continuous_distns.py | 1 + 26 | + scipy/stats/_stats_mstats_common.py | 3 +++ 27 | + 3 files changed, 5 insertions(+), 1 deletion(-) 28 | + 29 | +diff --git a/scipy/io/__init__.py b/scipy/io/__init__.py 30 | +index 64a7aa55d39..056c742687b 100644 31 | +--- a/scipy/io/__init__.py 32 | ++++ b/scipy/io/__init__.py 33 | +@@ -1,4 +1,4 @@ 34 | +-# -*- encoding:utf-8 -*- 35 | ++# -*- coding: utf-8 -*- 36 | + """ 37 | + ================================== 38 | + Input and output (:mod:`scipy.io`) 39 | +diff --git a/scipy/stats/_continuous_distns.py b/scipy/stats/_continuous_distns.py 40 | +index 44c05bb7d67..b48d7e7af32 100644 41 | +--- a/scipy/stats/_continuous_distns.py 42 | ++++ b/scipy/stats/_continuous_distns.py 43 | +@@ -1,3 +1,4 @@ 44 | ++# -*- coding: utf-8 -*- 45 | + # 46 | + # Author: Travis Oliphant 2002-2011 with contributions from 47 | + # SciPy Developers 2004-2011 48 | +diff --git a/scipy/stats/_stats_mstats_common.py b/scipy/stats/_stats_mstats_common.py 49 | +index e86c8287b48..be478da1f2a 100644 50 | +--- a/scipy/stats/_stats_mstats_common.py 51 | ++++ b/scipy/stats/_stats_mstats_common.py 52 | +@@ -1,3 +1,5 @@ 53 | ++# -*- coding: utf-8 -*- 54 | ++ 55 | + from collections import namedtuple 56 | + 57 | + import numpy as np 58 | +@@ -11,6 +13,7 @@ 59 | + 'rvalue', 'pvalue', 60 | + 'stderr')) 61 | + 62 | ++ 63 | + def linregress(x, y=None): 64 | + """ 65 | + Calculate a linear least-squares regression for two sets of measurements. 66 | -- 67 | 2.21.0 68 | 69 | -------------------------------------------------------------------------------- /patches/8.7/0004-Trac-27565-Add-patch-from-upstream-to-fix-segfaults.patch: -------------------------------------------------------------------------------- 1 | From 3d0a86bebe0233d277c60a315ea82ed5a3a0f24f Mon Sep 17 00:00:00 2001 2 | From: "Erik M. Bray" 3 | Date: Mon, 1 Apr 2019 11:35:38 +0200 4 | Subject: [PATCH] Trac #27565: Add patch from upstream to fix segfaults. 5 | 6 | --- 7 | build/pkgs/openblas/package-version.txt | 2 +- 8 | ...03-Move-TLS-key-deletion-to-openblas_quit.patch | 50 ++++++++++++++++++++++ 9 | 2 files changed, 51 insertions(+), 1 deletion(-) 10 | create mode 100644 build/pkgs/openblas/patches/0003-Move-TLS-key-deletion-to-openblas_quit.patch 11 | 12 | diff --git a/build/pkgs/openblas/package-version.txt b/build/pkgs/openblas/package-version.txt 13 | index f5447be62e..faa2471518 100644 14 | --- a/build/pkgs/openblas/package-version.txt 15 | +++ b/build/pkgs/openblas/package-version.txt 16 | @@ -1 +1 @@ 17 | -0.3.5.p0 18 | +0.3.5.p1 19 | diff --git a/build/pkgs/openblas/patches/0003-Move-TLS-key-deletion-to-openblas_quit.patch b/build/pkgs/openblas/patches/0003-Move-TLS-key-deletion-to-openblas_quit.patch 20 | new file mode 100644 21 | index 0000000000..6984c83e56 22 | --- /dev/null 23 | +++ b/build/pkgs/openblas/patches/0003-Move-TLS-key-deletion-to-openblas_quit.patch 24 | @@ -0,0 +1,50 @@ 25 | +Fixes incorrect releasing of TLS variable keys, resulting in possible 26 | +segfaults / crashes. Fix from https://github.com/xianyi/OpenBLAS/pull/1957 27 | +added in https://trac.sagemath.org/ticket/27565 28 | +This patch can be removed upon a future update to an OpenBLAS which 29 | +includes it. 30 | + 31 | +From ad2c386d6ad99d3021e33cbbfb311150b2586c93 Mon Sep 17 00:00:00 2001 32 | +From: Martin Kroeker 33 | +Date: Thu, 10 Jan 2019 00:32:50 +0100 34 | +Subject: [PATCH] Move TLS key deletion to openblas_quit 35 | + 36 | +fixes #1954 (as suggested by thrasibule in that issue) 37 | +--- 38 | + driver/others/memory.c | 13 ++++++++----- 39 | + 1 file changed, 8 insertions(+), 5 deletions(-) 40 | + 41 | +diff --git a/driver/others/memory.c b/driver/others/memory.c 42 | +index 6f7a7db8..72d3e173 100644 43 | +--- a/driver/others/memory.c 44 | ++++ b/driver/others/memory.c 45 | +@@ -1073,11 +1073,6 @@ static volatile int memory_initialized = 0; 46 | + } 47 | + free(table); 48 | + } 49 | +-#if defined(OS_WINDOWS) 50 | +- TlsFree(local_storage_key); 51 | +-#else 52 | +- pthread_key_delete(local_storage_key); 53 | +-#endif 54 | + } 55 | + 56 | + static void blas_memory_init(){ 57 | +@@ -1491,6 +1486,14 @@ void DESTRUCTOR gotoblas_quit(void) { 58 | + 59 | + blas_shutdown(); 60 | + 61 | ++#if defined(SMP) 62 | ++#if defined(OS_WINDOWS) 63 | ++ TlsFree(local_storage_key); 64 | ++#else 65 | ++ pthread_key_delete(local_storage_key); 66 | ++#endif 67 | ++#endif 68 | ++ 69 | + #ifdef PROFILE 70 | + moncontrol (0); 71 | + #endif 72 | +-- 73 | +2.15.1 74 | + 75 | -- 76 | 2.15.1 77 | 78 | -------------------------------------------------------------------------------- /cygwin-sage-runtime.list: -------------------------------------------------------------------------------- 1 | base-files 4.2-3 2 | bash 4.3.42-4 3 | cmake 3.14.5-1 4 | cddlib-tools 094j-1 5 | curl 7.73.0-1 6 | cygutils 1.4.15-2 7 | cygwin 2.6.0-1 8 | cygwin-devel 2.6.0-1 9 | dos2unix 7.4.0-1 10 | gcc-core 5.3.0-5 11 | gcc-fortran 5.3.0-5 12 | gcc-g++ 5.3.0-5 13 | ghostscript 9.23-1 14 | git 2.21.0-1 15 | glpk 4.65-1 16 | grep 2.25-1 17 | hostname 3.12-1 18 | ImageMagick 6.9.9.11-3 19 | libX11_6 1.6.4-1 20 | libXau6 1.0.8-1 21 | libXdmcp6 1.1.2-1 22 | libXpm4 3.5.11-1 23 | libbz2-devel 1.0.6-3 24 | libbz2_1 1.0.6-3 25 | libcurl-devel 7.73.0-1 26 | libcurl4 7.73.0-1 27 | libcrypt-devel 2.1-1 28 | libcrypt0 1.4-1 29 | libexpat1 2.2.0-0 30 | libffi-devel 3.2.1-2 31 | libffi6 3.2.1-2 32 | libfontconfig1 2.12.1-1 33 | libfreetype6 2.10.4-2 34 | libgc1 8.0.4-1 35 | libgcc1 5.4.0-1 36 | libgd-devel 2.2.5-2 37 | libgd3 2.2.5-1 38 | libgfortran3 5.4.0-1 39 | libgplk-devel 4.65-1 40 | libgmp-devel 6.2.0-2 41 | libgmp10 6.2.0-2 42 | libgmpxx 6.2.0-2 43 | libiconv2 1.16-2 44 | libjbig2-2.0 14 45 | libjpeg8 1.5.0-1 46 | liblapack-devel 3.8.0-1 47 | liblapack0 3.6.1-1 48 | liblzma-devel 5.2.3-1 49 | liblzma5 5.2.3-1 50 | libmpc-devel 1.1.0-1 51 | libmpc3 1.1.0-1 52 | libmpfr-devel 4.0.2-1 53 | libmpfr4 3.1.5-1 54 | libncursesw10 6.1-1.20190727 55 | libopenssl100 1.0.2j-1 56 | libpcre-devel 8.43-1 57 | libpcre1 8.43-1 58 | libpng-devel 1.6.24-1 59 | libpng16 1.6.24-1 60 | libquadmath0 5.4.0-1 61 | libreadline7 7.0.3-3 62 | libsqlite3_0 3.32.3-1 63 | libssl1.0 1.0.2t-1 64 | libssl1.1 1.1.1f-1 65 | libstdc++6 5.4.0-1 66 | libtiff6 4.0.6-1 67 | libtirpc3 1.1.4-1 68 | libwebp5 0.4.4-1 69 | libxcb1 1.12-1 70 | libzmq5 4.2.3-1 71 | m4 1.4.18-1 72 | make 4.1-1 73 | nano 2.9.7-1 74 | patch 2.7.4-1 75 | perl 5.26.3-1 76 | python37 3.7.7-1 77 | python37-devel 3.7.7-1 78 | python37-tkinter 3.7.7-1 79 | python37-urllib3 1.25.10-1 80 | rebase 4.4.2-1 81 | sed 4.2.2-3 82 | sqlite3 3.32.3-1 83 | wget 1.17.1-2 84 | yasm 1.3.0-2 85 | zlib-devel 1.2.11-1 86 | zlib0 1.2.8-3 87 | -------------------------------------------------------------------------------- /tools/sage-prep-runtime: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Script which performs cleanup of files in the runtime environment in 4 | # preparation for bundling. This performs various tasks such as removing 5 | # unneeded files, stripping binaries, etc. 6 | # 7 | # The one thing it does not do is to run rebase; this needs to be done using a 8 | # subcyg shell see the $(SAGE_ROOT_RUNTIME) target in the Makefile. 9 | set -x 10 | 11 | SAGE_ROOT_RUNTIME="$1" 12 | 13 | cd "$SAGE_ROOT_RUNTIME" 14 | 15 | # Clean up some files that are not needed at runtime 16 | rm -rf bootstrap config.* logs upstream local/var/tmp/sage/build/* \ 17 | local/var/lock/* build/pkgs/sagelib/src src/build \ 18 | local/share/doc/sage/doctrees local/var/lib/sage/wheels .git* 19 | 20 | # This shouldn't be necessary but it seems to help ensure that the main 21 | # Makefile is newer than its prerequisites 22 | touch "build/make/Makefile" 23 | 24 | # Add src/.norebuild to prevent sagelib from getting rebuilt, since src/build 25 | # has been removed; see https://trac.sagemath.org/ticket/29158 26 | touch src/.norebuild 27 | 28 | # Delete a number of static libraries that are not needed for any 29 | # reason at runtime (and ideally should not be intalled at all if 30 | # unnecessary) 31 | # 32 | # There are a few static libs that may need to be kept for re-building sagelib 33 | # so we back them up first. 34 | # (NOTE: It should never be necessary to re-build sagelib in the runtime 35 | # environment, but currently this can happen when installing optional packages; 36 | # see https://github.com/sagemath/sage-windows/issues/34) 37 | SAVE_STATIC_LIBS="bliss braiding cliquer ratpoints rw symmetrica" 38 | 39 | for libname in $SAVE_STATIC_LIBS; do 40 | # ignore any files that happen to be missing (e.g. some of these may be 41 | # optional packages) 42 | lib="local/lib/lib${libname}.a" 43 | if [ -f "$lib" ]; then 44 | mv "$lib" "${lib}.bak" 45 | fi 46 | done 47 | 48 | find "local/lib" \ 49 | \( -type f -a -name '*.a' -a ! -name '*.dll.a' \) \ 50 | -exec rm -f {} \; 51 | 52 | for libname in $SAVE_STATIC_LIBS; do 53 | lib="local/lib/lib${libname}.a" 54 | if [ -f "${lib}.bak" ]; then 55 | mv "${lib}.bak" "$lib" 56 | fi 57 | done 58 | 59 | # Strip debug symbols from exes and dlls, saving hundreds of MB 60 | find . -type f \( -name '*.exe' -o -name '*.dll' \) \ 61 | -exec strip -g {} \; 62 | 63 | 64 | # Move stupid, misnamed giac docs: the directory name ends with a space when it 65 | # shouldn't, and InnoSetup has trouble with this 66 | # Update: As of Sage 9.3, the version of the giac docs is now even more broken, 67 | # containing both an 'fr' directory *and* an 'fr ' directory. Rather than try 68 | # to move it, just delete these docs entirely, as I doubt anyone is going to go 69 | # looking for them in their Sage Windows install. 70 | BROKEN_GIAC_DOC_DIR='local/share/doc/giac' 71 | if [ -d "$BROKEN_GIAC_DOC_DIR" ]; then 72 | rm -rf "$BROKEN_GIAC_DOC_DIR" 73 | fi 74 | -------------------------------------------------------------------------------- /patches/8.7/0003-Trac-27509-Add-patch-from-upstream-pull-request-to-f.patch: -------------------------------------------------------------------------------- 1 | From ee6e4a3eb09aebc2ed9fe7959c4f997b5e75664f Mon Sep 17 00:00:00 2001 2 | From: "Erik M. Bray" 3 | Date: Tue, 19 Mar 2019 16:34:15 +0100 4 | Subject: [PATCH] Trac #27509: Add patch from upstream pull request to fix 5 | memory leak on Cygwin 6 | 7 | --- 8 | build/pkgs/openblas/patches/2064.patch | 137 +++++++++++++++++++++++++++++++++ 9 | 1 file changed, 137 insertions(+) 10 | create mode 100644 build/pkgs/openblas/patches/2064.patch 11 | 12 | diff --git a/build/pkgs/openblas/patches/2064.patch b/build/pkgs/openblas/patches/2064.patch 13 | new file mode 100644 14 | index 0000000000..399277a00e 15 | --- /dev/null 16 | +++ b/build/pkgs/openblas/patches/2064.patch 17 | @@ -0,0 +1,137 @@ 18 | +Fixes memory leak in Cygwin that occurs when repeatedly shutting down 19 | +and re-intializing the the thread pool, e.g. when forking the process. 20 | +See https://trac.sagemath.org/ticket/27509 21 | + 22 | +From 4ad694eda1ff79040778648d44cda5b8f774c38d Mon Sep 17 00:00:00 2001 23 | +From: "Erik M. Bray" 24 | +Date: Mon, 18 Mar 2019 20:32:48 +0100 25 | +Subject: [PATCH 1/2] Fix for #2063: The DllMain used in Cygwin did not run the 26 | + thread memory pool cleanup upon THREAD_DETACH which is needed when compiled 27 | + with USE_TLS=1. 28 | + 29 | +--- 30 | + driver/others/memory.c | 11 +++++++++-- 31 | + exports/dllinit.c | 24 +++++++++++++++++------- 32 | + 2 files changed, 26 insertions(+), 9 deletions(-) 33 | + 34 | +diff --git a/driver/others/memory.c b/driver/others/memory.c 35 | +index ed407a858..ac8545f35 100644 36 | +--- a/driver/others/memory.c 37 | ++++ b/driver/others/memory.c 38 | +@@ -1313,6 +1313,13 @@ void blas_memory_free_nolock(void * map_address) { 39 | + free(map_address); 40 | + } 41 | + 42 | ++#ifdef SMP 43 | ++void blas_thread_memory_cleanup(void) { 44 | ++ blas_memory_cleanup((void*)get_memory_table()); 45 | ++} 46 | ++#endif 47 | ++ 48 | ++ 49 | + void blas_shutdown(void){ 50 | + #ifdef SMP 51 | + BLASFUNC(blas_thread_shutdown)(); 52 | +@@ -1322,7 +1329,7 @@ void blas_shutdown(void){ 53 | + /* Only cleanupIf we were built for threading and TLS was initialized */ 54 | + if (local_storage_key) 55 | + #endif 56 | +- blas_memory_cleanup((void*)get_memory_table()); 57 | ++ blas_thread_memory_cleanup(); 58 | + 59 | + #ifdef SEEK_ADDRESS 60 | + base_address = 0UL; 61 | +@@ -1552,7 +1559,7 @@ BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReser 62 | + break; 63 | + case DLL_THREAD_DETACH: 64 | + #if defined(SMP) 65 | +- blas_memory_cleanup((void*)get_memory_table()); 66 | ++ blas_thread_memory_cleanup(); 67 | + #endif 68 | + break; 69 | + case DLL_PROCESS_DETACH: 70 | +diff --git a/exports/dllinit.c b/exports/dllinit.c 71 | +index 02ff092e9..0e1bb34e3 100644 72 | +--- a/exports/dllinit.c 73 | ++++ b/exports/dllinit.c 74 | +@@ -40,15 +40,25 @@ 75 | + 76 | + void gotoblas_init(void); 77 | + void gotoblas_quit(void); 78 | ++#if defined(SMP) && defined(USE_TLS) 79 | ++void blas_thread_memory_cleanup(void); 80 | ++#endif 81 | + 82 | + BOOL APIENTRY DllMain(HINSTANCE hInst, DWORD reason, LPVOID reserved) { 83 | +- 84 | +- if (reason == DLL_PROCESS_ATTACH) { 85 | +- gotoblas_init(); 86 | +- } 87 | +- 88 | +- if (reason == DLL_PROCESS_DETACH) { 89 | +- gotoblas_quit(); 90 | ++ switch(reason) { 91 | ++ case DLL_PROCESS_ATTACH: 92 | ++ gotoblas_init(); 93 | ++ break; 94 | ++ case DLL_PROCESS_DETACH: 95 | ++ gotoblas_quit(); 96 | ++ break; 97 | ++ case DLL_THREAD_ATTACH: 98 | ++ break; 99 | ++ case DLL_THREAD_DETACH: 100 | ++#if defined(SMP) && defined(USE_TLS) 101 | ++ blas_thread_memory_cleanup(void); 102 | ++#endif 103 | ++ break; 104 | + } 105 | + 106 | + return TRUE; 107 | + 108 | +From 8ba9e2a61a1cf34e9b2efc5af61f5ebaaf6ab902 Mon Sep 17 00:00:00 2001 109 | +From: "Erik M. Bray" 110 | +Date: Tue, 19 Mar 2019 10:22:02 +0100 111 | +Subject: [PATCH 2/2] Also call CloseHandle on each thread, as well as on the 112 | + event so as to not leak thread handles. 113 | + 114 | +--- 115 | + driver/others/blas_server_win32.c | 5 +++++ 116 | + exports/dllinit.c | 2 +- 117 | + 2 files changed, 6 insertions(+), 1 deletion(-) 118 | + 119 | +diff --git a/driver/others/blas_server_win32.c b/driver/others/blas_server_win32.c 120 | +index bae344c59..0b38ee365 100644 121 | +--- a/driver/others/blas_server_win32.c 122 | ++++ b/driver/others/blas_server_win32.c 123 | +@@ -461,13 +461,18 @@ int BLASFUNC(blas_thread_shutdown)(void){ 124 | + SetEvent(pool.killed); 125 | + 126 | + for(i = 0; i < blas_num_threads - 1; i++){ 127 | ++ // Could also just use WaitForMultipleObjects 128 | + WaitForSingleObject(blas_threads[i], 5); //INFINITE); 129 | + #ifndef OS_WINDOWSSTORE 130 | + // TerminateThread is only available with WINAPI_DESKTOP and WINAPI_SYSTEM not WINAPI_APP in UWP 131 | + TerminateThread(blas_threads[i],0); 132 | + #endif 133 | ++ CloseHandle(blas_threads[i]); 134 | + } 135 | + 136 | ++ CloseHandle(pool.filled); 137 | ++ CloseHandle(pool.killed); 138 | ++ 139 | + blas_server_avail = 0; 140 | + } 141 | + 142 | +diff --git a/exports/dllinit.c b/exports/dllinit.c 143 | +index 0e1bb34e3..4a05c0e14 100644 144 | +--- a/exports/dllinit.c 145 | ++++ b/exports/dllinit.c 146 | +@@ -56,7 +56,7 @@ BOOL APIENTRY DllMain(HINSTANCE hInst, DWORD reason, LPVOID reserved) { 147 | + break; 148 | + case DLL_THREAD_DETACH: 149 | + #if defined(SMP) && defined(USE_TLS) 150 | +- blas_thread_memory_cleanup(void); 151 | ++ blas_thread_memory_cleanup(); 152 | + #endif 153 | + break; 154 | + } 155 | -- 156 | 2.15.1 157 | 158 | -------------------------------------------------------------------------------- /CHANGES.md: -------------------------------------------------------------------------------- 1 | Changelog for the Windows Installer 2 | =================================== 3 | 4 | 0.6.3 (2021-08-25) 5 | ------------------ 6 | 7 | * No user-facing changes. 8 | 9 | * Minor Makefile fixes. 10 | 11 | * Updates to use InnoSetup 6 which is now the most current. 12 | 13 | 14 | 0.6.2 (2021-01-05) 15 | ------------------ 16 | 17 | * Reverted use of Cygwin's system package for libntl, which is not built 18 | to be portable enough for enough users' CPUs. Likewise reverted use of 19 | system libflint package which depends on NTL. 20 | 21 | **NOTE**: If you haven't experienced problems with build 0.6.1 of Sage 9.2 22 | there is no need to upgrade to this build, as the issue this fixes only 23 | impacts some users depending on their CPU. 24 | 25 | 26 | 0.6.1 (2020-11-28) 27 | ------------------ 28 | 29 | * Updated to Python 3.7. 30 | 31 | * Updated to Cygwin 3.1.x. 32 | 33 | 34 | 0.6.0 (2020-02-13) 35 | ------------------ 36 | 37 | * The following optional packages, and their associated Sage extensions are 38 | now come pre-installed by default: 39 | 40 | * bliss 41 | * coxeter3 42 | * mcqd 43 | * primecount 44 | * tdlib 45 | 46 | * Improved support for installing additional optional packages. 47 | 48 | * Downgraded Cygwin version in order to fix an issue with running external 49 | Windows programs from Sage (in particular, this caused problems when 50 | running external LaTeX distributions (#42). 51 | 52 | * Build system can now use a local Cygwin mirror; this can make for more 53 | consistent builds. 54 | 55 | 56 | 0.5.2 (2020-01-08) 57 | ------------------ 58 | 59 | * Added patch from SageMath 9.0 to builds of SageMath 8.9 to fix support for 60 | threejs plots in Firefox on Windows. 61 | 62 | * Removed unneeded static libraries from the installer, reducing install 63 | size. 64 | 65 | 66 | 0.5.1 (2019-07-12) 67 | ------------------ 68 | 69 | * Fixed installation path of the HTML documentation. 70 | 71 | * Include a copy of the `nano` editor, for use with `git`. 72 | 73 | * Fixed initialization of the `.sage` directory on new installs, ensuring 74 | that the default config files are copied to the correct locations. This 75 | fixes a bug with the default IPython terminal color scheme not being set 76 | correctly. 77 | 78 | 79 | 0.5.0 (2019-07-11) 80 | ------------------ 81 | 82 | * Debug symbols, which are not needed at runtime, are stripped from most 83 | binaries, resulting in a noticeably smaller install footprint. Now the 84 | installer and the installation itself are smaller despite packing in more 85 | features! 86 | 87 | * Includes a copy of `git` in the SageMath Shell, so no need to install a 88 | separate Git or integrate an existing Git for Windows installation. 89 | 90 | * Installing the HTML documentation is now optional. Although some help 91 | features won't work without it, it saves about 600 MB of installation 92 | size, and if you have an internet connection you can still read the docs 93 | at doc.sagemath.org. 94 | 95 | * Updates to use a few more Cygwin system packages rather than including 96 | Sage-specific copies, including: 97 | 98 | * bzip2 99 | * libffi 100 | * libpng 101 | * patch 102 | * pcre 103 | * xz 104 | * yasm 105 | * zlib 106 | 107 | We still build our own copies of MPIR and anything that depends on it, 108 | as there are still too many bugs with the system GMP on Cygwin. 109 | 110 | 111 | 0.4.3 (2019-05-06) 112 | ------------------ 113 | 114 | * Not a change to the installer itself but to the build toolchain, allowing 115 | version-specific patches to be applied after a Sage release. From 116 | time-to-time critical bugs are found and fixed in Sage only after an 117 | official release. And Sage's development process is not quick enough 118 | about making new releases. So we add the ability to include post-release 119 | patches as needed. 120 | 121 | * Added patch for giac to prevent possible hang in the Sage-Giac interface 122 | (https://trac.sagemath.org/ticket/27385). 123 | 124 | * Added several patches for stability in OpenBLAS. Note, however, that 125 | the current release does not use OpenBLAS, but rather just uses 126 | Cygwin's default BLAS. A future release will switch to OpenBLAS for 127 | likely performance gains (https://trac.sagemath.org/ticket/27493 128 | https://trac.sagemath.org/ticket/27509 129 | https://trac.sagemath.org/ticket/27565). 130 | 131 | * Added patch needed for psutil to work with Cygwin 3.0 on which this 132 | build is based (https://trac.sagemath.org/ticket/27702). 133 | 134 | 135 | 0.4.2 (2019-02-11) 136 | ------------------ 137 | 138 | * Added the `m4` and `perl` packages (and by extension their dependencies) 139 | to the runtime environment, since they appear to be needed when 140 | installing optional packages. 141 | 142 | 143 | 0.4.1 (2018-09-24) 144 | ------------------ 145 | 146 | * Added some dependencies to the runtime environment that were necessary 147 | for compiling Cython code at runtime to work (e.g. `cython()`). 148 | 149 | * Improved support for `sage -i`, at least in principle (not all optional 150 | packages work yet, but one can at least install some of the ones that do 151 | work). 152 | 153 | * Fixed bug preventing `sage-sethome` from working properly. 154 | 155 | 156 | 0.4 (2018-08-10) 157 | ---------------- 158 | 159 | * Added single-user installation mode as the default installation mode--now 160 | Sage can be installed without Administrator privileges on the system. 161 | Installing Sage with this mode means users can modify files in their Sage 162 | installation without Administrator privileges (ideal for tinkering and 163 | installing additional packages!) 164 | 165 | * Reworked how home directories are handled: 166 | 167 | * Now Sage runs under a single "home directory" that is named 168 | `/home/sage`. For each user, `/home/sage` actually points by default to 169 | their Windows profile directory (i.e. `C:\Users\`). This is 170 | consistent with previous versions of Sage for Windows, except that 171 | `/home/sage/` is used instead of `/home//` where `` 172 | was your Windows username. This choice is motivated by compatibility 173 | with some UNIX software that does not handle spaces or special 174 | characters in home directories. 175 | 176 | * It is now possible to change the default home directory used for Sage: 177 | For single-user installs you are asked at install time where you would 178 | like to set your home directory. However, it can be changed at any time 179 | from within the Sage Shell by running `sage-sethome [DIRECTORY]` where 180 | `[DIRECTORY]` is the Windows path you'd like to set as the home 181 | directory for Sage. 182 | 183 | * Included ImageMagick in the distribution. This is a dependency of some 184 | functionality in Sage, such as for converting LaTeX to PNG images for 185 | displaying in the Sage Notebook. 186 | 187 | 188 | 0.3 (2017-12-15) 189 | ---------------- 190 | 191 | * Added a license agreement page to the install wizard. 192 | 193 | 194 | 0.2 (2017-08-07) 195 | ---------------- 196 | 197 | * Initial version tagged for the SageMath 8.0 release. 198 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | TARGETS=env-build env-runtime cygwin-build cygwin-runtime sage-build \ 2 | sage-runtime cygwin-extras-runtime 3 | .PHONY: all $(TARGETS) $(addprefix clean-,$(TARGETS)) clean-envs \ 4 | clean-installer clean-all 5 | 6 | ############################ Configurable Variables ########################### 7 | 8 | # Can be x86 or x86_64 9 | ARCH?=x86_64 10 | 11 | # Set to 1 to build a test version of the installer for testing the installer 12 | # itself itself; it excludes Sage but is faster to build and install 13 | SAGE_TEST_INSTALLER?=0 14 | 15 | SAGE_VERSION?=develop 16 | SAGE_BRANCH?=$(SAGE_VERSION) 17 | INSTALLER_VERSION=$(shell cat version.txt) 18 | 19 | # Output paths 20 | DIST?=dist 21 | DOWNLOAD?=download 22 | ENVS?=envs 23 | STAMPS?=.stamps 24 | 25 | # Path to the Inno Setup executable 26 | ISCC?="/cygdrive/c/Program Files (x86)/Inno Setup 6/ISCC.exe" 27 | 28 | ################################################################################ 29 | 30 | # Actual targets for the main build stages (the stamp files) 31 | env-build=$(STAMPS)/env-build-$(SAGE_VERSION)-$(ARCH) 32 | env-runtime=$(STAMPS)/env-runtime-$(SAGE_VERSION)-$(ARCH) 33 | cygwin-build=$(STAMPS)/cygwin-build-$(SAGE_VERSION)-$(ARCH) 34 | cygwin-runtime=$(STAMPS)/cygwin-runtime-$(SAGE_VERSION)-$(ARCH) 35 | sage-build=$(STAMPS)/sage-build-$(SAGE_VERSION)-$(ARCH) 36 | sage-runtime=$(STAMPS)/sage-runtime-$(SAGE_VERSION)-$(ARCH) 37 | cygwin-runtime-extras=$(STAMPS)/cygwin-runtime-extras-$(SAGE_VERSION)-$(ARCH) 38 | 39 | ############################################################################### 40 | 41 | # Resource paths 42 | PATCHES=patches 43 | CYGWIN_EXTRAS=cygwin_extras 44 | RESOURCES=resources 45 | DOT_SAGE=dot_sage 46 | ICONS:=$(wildcard $(RESOURCES)/*.bmp) $(wildcard $(RESOURCES)/*.ico) 47 | 48 | ENV_BUILD_DIR=$(ENVS)/build-$(SAGE_VERSION)-$(ARCH) 49 | ENV_RUNTIME_DIR=$(ENVS)/runtime-$(SAGE_VERSION)-$(ARCH) 50 | 51 | SAGE_GIT=git://git.sagemath.org/sage.git 52 | SAGE_ROOT=/opt/sagemath-$(SAGE_VERSION) 53 | SAGE_ROOT_BUILD=$(ENV_BUILD_DIR)$(SAGE_ROOT) 54 | SAGE_ROOT_RUNTIME=$(ENV_RUNTIME_DIR)$(SAGE_ROOT) 55 | 56 | N_CPUS=$(shell cat /proc/cpuinfo | grep '^processor' | wc -l) 57 | 58 | # TODO: These variables should be made dependent on the Sage version being 59 | # built, as we may need to change this from version to version. In practice 60 | # though we usually just care about building the latest version. 61 | # NOTE: The latest version, 9.2, still does not work with system GMP. 62 | # NOTE: The latest version, 9.2, defaults to Python 3.8 but works with 63 | # Python 3.7 if we specify it. 64 | override SAGE_CONFIGURE_FLAGS:=--with-mp=system --with-python=python3.7 $(SAGE_CONFIGURE_FLAGS) 65 | 66 | # NOTE: Be very careful about quoting here; we need literal 67 | # quotes or else they will be stripped when exec'ing bash 68 | # NOTE: FFLAS_FFPACK_CONFIGURE is needed to work around a regression introduced 69 | # in Sage 8.9: https://trac.sagemath.org/ticket/27444#comment:34 70 | SAGE_ENVVARS:=\ 71 | SAGE_NUM_THREADS=$(N_CPUS) \ 72 | SAGE_INSTALL_CCACHE=yes \ 73 | CCACHE_DIR=\"$(HOME)/.ccache\" \ 74 | SAGE_FAT_BINARY=yes \ 75 | FFLAS_FFPACK_CONFIGURE=--disable-openmp \ 76 | MAKE=\"make -j$(N_CPUS)\" 77 | 78 | SAGE_OPTIONAL_PACKAGES=bliss coxeter3 mcqd primecount tdlib 79 | 80 | # Outputs representing success in the Sage build process 81 | SAGE_CONFIGURE=$(SAGE_ROOT_BUILD)/configure 82 | SAGE_MAKEFILE=$(SAGE_ROOT_BUILD)/build/make/Makefile 83 | SAGE_STARTED=$(SAGE_ROOT_BUILD)/local/etc/sage-started.txt 84 | 85 | # Files used as input to ISCC 86 | SAGEMATH_ISS=SageMath.iss 87 | SOURCES:=$(SAGEMATH_ISS) $(DOT_SAGE) $(ICONS) 88 | 89 | # URL to download the Cygwin setup.exe 90 | CYGWIN_SETUP_NAME=setup-$(ARCH).exe 91 | CYGWIN_SETUP=$(DOWNLOAD)/$(CYGWIN_SETUP_NAME) 92 | CYGWIN_SETUP_URL=https://www.cygwin.com/$(CYGWIN_SETUP_NAME) 93 | CYGWIN_MIRROR=http://mirrors.kernel.org/sourceware/cygwin/ 94 | CYGWIN_LOCAL_MIRROR=cygwin_mirror/ 95 | ifeq (,$(wildcard $(CYGWIN_LOCAL_MIRROR))) 96 | CYGWIN_LOCAL_INSTALL_FLAGS= 97 | else 98 | CYGWIN_MIRROR=$(CYGWIN_LOCAL_MIRROR) 99 | CYGWIN_LOCAL_INSTALL_FLAGS=--local-install --local-package-dir "$$(cygpath -w -a .)" 100 | endif 101 | 102 | SAGE_INSTALLER=$(DIST)/SageMath-$(SAGE_VERSION)-v$(INSTALLER_VERSION).exe 103 | 104 | TOOLS=tools 105 | SUBCYG=$(TOOLS)/subcyg 106 | 107 | DIRS=$(DIST) $(DOWNLOAD) $(ENVS) $(STAMPS) 108 | 109 | 110 | ################################################################################ 111 | 112 | all: $(SAGE_INSTALLER) 113 | 114 | $(SAGE_INSTALLER): $(SOURCES) $(env-runtime) | $(DIST) 115 | cd $(CUDIR) 116 | $(ISCC) /DSageVersion=$(SAGE_VERSION) /DSageArch=$(ARCH) \ 117 | /DInstallerVersion=$(INSTALLER_VERSION) \ 118 | /DSageTestInstaller=$(SAGE_TEST_INSTALLER) \ 119 | /DEnvsDir="$(ENVS)" /DOutputDir="$(DIST)" $(SAGEMATH_ISS) 120 | 121 | clean-installer: 122 | rm -f $(SAGE_INSTALLER) 123 | 124 | 125 | $(foreach target,$(TARGETS),$(eval $(target): $$($(target)))) 126 | 127 | 128 | $(env-runtime): $(env-build) $(cygwin-runtime) $(sage-runtime) $(cygwin-runtime-extras) 129 | $(TOOLS)/fixup-symlinks $(ENV_RUNTIME_DIR) > $(ENV_RUNTIME_DIR)/etc/symlinks.lst 130 | @touch $@ 131 | 132 | clean-env-runtime: clean-cygwin-runtime 133 | rm -f $(env-runtime) 134 | 135 | 136 | $(sage-runtime): $(SAGE_ROOT_RUNTIME) 137 | @touch $@ 138 | 139 | clean-sage-runtime: 140 | rm -rf $(SAGE_ROOT_RUNTIME) 141 | rm -f $(sage-runtime) 142 | 143 | 144 | $(SAGE_ROOT_RUNTIME): $(cygwin-runtime) $(sage-build) 145 | [ -d $(dir $@) ] || mkdir $(dir $@) 146 | cp -rp $(SAGE_ROOT_BUILD) $(dir $@) 147 | # Prepare / compactify runtime environment 148 | $(TOOLS)/sage-prep-runtime "$(SAGE_ROOT_RUNTIME)" 149 | # Re-rebase everything 150 | SHELL=/bin/dash $(SUBCYG) "$(ENV_RUNTIME_DIR)" \ 151 | "cd $(SAGE_ROOT) && local/bin/sage-rebaseall.sh local" 152 | tools/sage-fixup-doc-symlinks "$(SAGE_ROOT_RUNTIME)/local/share/doc/sage/html" 153 | 154 | 155 | $(env-build): $(cygwin-build) $(sage-build) 156 | @touch $@ 157 | 158 | clean-env-build: clean-sage-build clean-cygwin-build clean-installer 159 | rm -f $(env-build) 160 | 161 | 162 | 163 | $(sage-build): $(cygwin-build) $(SAGE_STARTED) 164 | SHELL=/bin/dash $(SUBCYG) "$(ENV_BUILD_DIR)" \ 165 | "cd $(SAGE_ROOT) && local/bin/sage-rebaseall.sh local" 166 | $(SUBCYG) "$(ENV_BUILD_DIR)" \ 167 | "cd $(SAGE_ROOT) && $(SAGE_ENVVARS) make doc" 168 | @touch $@ 169 | 170 | clean-sage-build: 171 | rm -rf $(SAGE_ROOT_BUILD) 172 | rm -f $(sage-build) 173 | 174 | 175 | $(cygwin-runtime-extras): $(cygwin-runtime) 176 | $(TOOLS)/sage-prep-runtime-extras "$(ENV_RUNTIME_DIR)" "$(CYGWIN_EXTRAS)" \ 177 | "$(SAGE_VERSION)" 178 | # Set apt-cyg to use a non-local mirror in the runtime env 179 | $(SUBCYG) "$(ENV_RUNTIME_DIR)" "apt-cyg mirror $(CYGWIN_MIRROR)" 180 | @touch $@ 181 | 182 | # Right now the only effective way to roll back cygwin-runtime-extras 183 | # is to clean the entire runtime cygwin environment 184 | clean-cygwin-runtime-extras: clean-cygwin-runtime 185 | 186 | 187 | $(STAMPS)/cygwin-%: | $(ENVS)/% $(STAMPS) 188 | @touch $@ 189 | 190 | clean-cygwin-build: 191 | rm -rf $(ENV_BUILD_DIR) 192 | rm -f $(cygwin-build) 193 | 194 | clean-cygwin-runtime: clean-sage-runtime 195 | rm -rf $(ENV_RUNTIME_DIR) 196 | rm -f $(cygwin-runtime) 197 | rm -f $(cygwin-runtime-extras) 198 | 199 | clean-envs: clean-env-runtime clean-env-build 200 | 201 | 202 | clean-all: clean-envs clean-installer 203 | 204 | 205 | .SECONDARY: $(ENV_BUILD_DIR) $(ENV_RUNTIME_DIR) 206 | $(ENVS)/%-$(SAGE_VERSION)-$(ARCH): cygwin-sage-%-$(ARCH).list $(CYGWIN_SETUP) 207 | $(eval ENV_TMP := $(shell mktemp -d)) 208 | "$(CYGWIN_SETUP)" --site $(CYGWIN_MIRROR) \ 209 | $(CYGWIN_LOCAL_INSTALL_FLAGS) \ 210 | --root "$$(cygpath -w -a $(ENV_TMP))" \ 211 | --arch $(ARCH) --no-admin --no-shortcuts --quiet-mode \ 212 | --packages $$($(TOOLS)/setup-package-list $<) \ 213 | $(CYGWIN_SETUP_FLAGS) 214 | 215 | # Move the tmpdir into the final environment location 216 | mkdir -p $(ENVS) 217 | mv $(ENV_TMP) $@ 218 | 219 | # Install symlinks for CCACHE 220 | if [ -x $@/usr/bin/ccache ]; then \ 221 | ln -s /usr/bin/ccache $@/usr/local/bin/gcc; \ 222 | ln -s /usr/bin/ccache $@/usr/local/bin/g++; \ 223 | fi 224 | # A bit of cleanup 225 | rm -f $@/Cygwin*.{bat,ico} 226 | 227 | # We should re-touch the relevant stamp file since the runtime 228 | # environment may be updated 229 | touch "$(STAMPS)/cygwin-$(subst $(ENVS)/,,$@)" 230 | 231 | 232 | $(SAGE_STARTED): $(SAGE_MAKEFILE) 233 | $(SUBCYG) "$(ENV_BUILD_DIR)" \ 234 | "cd $(SAGE_ROOT) && $(SAGE_ENVVARS) make start" 235 | # Install pre-installed optional packages and run make build again to 236 | # intall sagelib optional extensions that use those packages 237 | $(SUBCYG) "$(ENV_BUILD_DIR)" \ 238 | "cd $(SAGE_ROOT) && $(SAGE_ENVVARS) ./sage -i $(SAGE_OPTIONAL_PACKAGES) && make build" 239 | # Re-touch sage-started.txt since running `make build` again can cause 240 | # the Sage Makefile to be updated IIUC 241 | touch $@ 242 | 243 | 244 | $(SAGE_MAKEFILE): $(SAGE_CONFIGURE) 245 | $(SUBCYG) "$(ENV_BUILD_DIR)" "cd $(SAGE_ROOT) && ./configure $(SAGE_CONFIGURE_FLAGS)" 246 | 247 | 248 | $(SAGE_CONFIGURE): | $(SAGE_ROOT_BUILD) 249 | $(SUBCYG) "$(ENV_BUILD_DIR)" "cd $(SAGE_ROOT) && make configure" 250 | 251 | 252 | $(SAGE_ROOT_BUILD): $(cygwin-build) 253 | [ -d $(dir $(SAGE_ROOT_BUILD)) ] || mkdir $(dir $(SAGE_ROOT_BUILD)) 254 | $(SUBCYG) "$(ENV_BUILD_DIR)" "cd /opt && git clone --single-branch --branch $(SAGE_BRANCH) $(SAGE_GIT) $(SAGE_ROOT)" 255 | # Apply patches 256 | if [ -d $(PATCHES)/$(SAGE_BRANCH) ]; then \ 257 | for patch in $(PATCHES)/$(SAGE_BRANCH)/*.patch; do \ 258 | patch="$$(pwd)/$$patch"; \ 259 | (cd $(SAGE_ROOT_BUILD) && patch -p1 < $$patch); \ 260 | done; \ 261 | fi 262 | 263 | 264 | $(CYGWIN_SETUP): | $(DOWNLOAD) 265 | (cd $(DOWNLOAD) && wget "$(CYGWIN_SETUP_URL)") 266 | chmod +x $(CYGWIN_SETUP) 267 | 268 | 269 | $(DIRS): 270 | mkdir "$@" 271 | -------------------------------------------------------------------------------- /cygwin-sage-build.list: -------------------------------------------------------------------------------- 1 | base-cygwin 3.8-1 2 | base-files 4.2-3 3 | bash 4.3.42-4 4 | binutils 2.25-4 5 | bzip2 1.0.6-2 6 | ca-certificates 2.10-1 7 | ccache 3.1.9-2 8 | cddlib-devel 094j-1 9 | cddlib-tools 094j-1 10 | cmake 3.14.5-1 11 | coreutils 8.25-1 12 | csih 0.9.9-1 13 | curl 7.73.0-1 14 | cygrunsrv 1.62-1 15 | cygutils 1.4.15-2 16 | cygwin 2.6.0-1 17 | cygwin-devel 2.6.0-1 18 | dash 0.5.8-3 19 | dejavu-fonts 2.37-1 20 | desktop-file-utils 0.23-1 21 | dialog 1.3-2.20160828 22 | diffutils 3.5-2 23 | dri-drivers 12.0.4-1 24 | ed 1.13-1 25 | editrights 1.03-1 26 | file 5.25-1 27 | findutils 4.5.12-1 28 | flex 2.6.3-1 29 | gamin 0.1.10-15 30 | gawk 4.1.3-1 31 | gcc-core 5.3.0-5 32 | gcc-fortran 5.3.0-5 33 | gcc-g++ 5.3.0-5 34 | ghostscript 9.19-1 35 | ghostscript-fonts-other 6.0-1 36 | ghostscript-fonts-std 8.11-1 37 | git 2.8.2-1 38 | glpk 4.65-1 39 | gnupg 1.4.21-1 40 | grep 2.25-1 41 | gsettings-desktop-schemas 3.18.1-1 42 | gzip 1.7-2 43 | hostname 3.12-1 44 | less 481-1 45 | libatomic_ops-devel 7.6.10-1 46 | libatomic1 10.2.0-1 47 | libattr1 2.4.46-1 48 | libboost-devel 1.66.0-1 49 | libbz2-devel 1.0.6-3 50 | libbz2_1 1.0.6-3 51 | libcairo2 1.14.4-1 52 | libcom_err2 1.42.12-2 53 | libcrypt-devel 1.4-1 54 | libcrypt0 1.4-1 55 | libcurl-devel 7.73.0-1 56 | libcurl4 7.73.0-1 57 | libdb5.3 5.3.28-1 58 | libdialog13 1.3-2.20160828 59 | libedit0 20130712-1 60 | libEGL1 12.0.4-1 61 | libexpat1 2.2.0-0 62 | libfam0 0.1.10-15 63 | libffi-devel 3.2.1-2 64 | libffi6 3.2.1-2 65 | libfontconfig-common 2.12.1-1 66 | libfontconfig1 2.12.1-1 67 | libfreetype-devel 2.10.4-2 68 | libfreetype6 2.10.4-2 69 | libgc-devel 8.0.4-1 70 | libgcc1 5.4.0-1 71 | libgd-devel 2.2.5-2 72 | libgd3 2.2.3-1 73 | libgdbm4 1.12-1 74 | libgfortran3 5.4.0-1 75 | libGL1 12.0.4-1 76 | libglapi0 12.0.4-1 77 | libglib2.0_0 2.46.2-4 78 | libglpk-devel 4.65-1 79 | libgmp-devel 6.2.0-2 80 | libgmp10 6.2.0-2 81 | libgmpxx 6.2.0-2 82 | libgnutls28 3.3.17-1 83 | libgomp1 5.4.0-1 84 | libgraphite2_3 1.3.8-1 85 | libgs9 9.19-1 86 | libgssapi_krb5_2 1.14.4-1 87 | libguile17 1.8.8-1 88 | libharfbuzz-icu0 1.3.3-1 89 | libharfbuzz0 1.3.3-1 90 | libhogweed2 2.7.1-1 91 | libICE6 1.0.9-1 92 | libiconv-devel 1.16-2 93 | libiconv2 1.16-2 94 | libicu57 57.1-1 95 | libicu58 58.1-1 96 | libidn11 1.29-1 97 | libidn2_0 0.11-1 98 | libintl-devel 0.19.8.1-2 99 | libintl8 0.19.8.1-2 100 | libisl13 0.14.1-1 101 | libjbig2 2.0-14 102 | libjpeg8 1.5.0-1 103 | libk5crypto3 1.14.4-1 104 | libkpathsea6 20160520-4 105 | libkrb5_3 1.14.4-1 106 | libkrb5support0 1.14.4-1 107 | liblapack-devel 3.6.0r1730-2 108 | liblapack0 3.6.1-1 109 | liblcms2_2 2.6-1 110 | libllvm3.8 3.8.1-1 111 | libltdl7 2.4.6-4 112 | liblzma-devel 5.2.3-1 113 | liblzma5 5.2.2-1 114 | liblzo2_2 2.08-1 115 | libmpc-devel 1.1.0-1 116 | libmpc3 1.1.0-1 117 | libmpfr-devel 4.0.2-1 118 | libmpfr4 3.1.5-1 119 | libncurses-devel 6.1-1.20190727 120 | libncursesw10 6.1-1.20190727 121 | libnettle4 2.7.1-1 122 | libnghttp2_14 1.14.0-1 123 | libnspr4 4.13-1 124 | libnss3 3.27.1-1 125 | libopenjpeg1 1.5.2-3 126 | libopenldap2_4_2 2.4.42-1 127 | libopenssl100 1.0.2j-1 128 | libp11-kit0 0.22.1-1 129 | libpaper-common 1.1.24-2 130 | libpaper1 1.1.24-2 131 | libpcre-devel 8.43-1 132 | libpcre1 8.43-1 133 | libpixman1_0 0.34.0-1 134 | libpng16 1.6.24-1 135 | libpoppler62 0.45.0-2 136 | libpopt-common 1.16-2 137 | libpopt0 1.16-2 138 | libpsl5 0.14.0-2 139 | libptexenc1 20160520-4 140 | libquadmath0 5.4.0-1 141 | libreadline-devel 7.0.3-3 142 | libreadline7 7.0.3-3 143 | libsasl2_3 2.1.26-9 144 | libsigsegv2 2.10-2 145 | libSM6 1.2.2-1 146 | libsqlite3-devel 3.32.3-1 147 | libsqlite3_0 3.32.3-1 148 | libssh2_1 1.7.0-1 149 | libssl1.0 1.0.2t-1 150 | libssl1.1 1.1.1f-1 151 | libssp0 5.4.0-1 152 | libstdc++6 5.4.0-1 153 | libsynctex1 20160520-4 154 | libtasn1_6 4.9-1 155 | libtexlua52_5 20160520-4 156 | libtexluajit2 20160520-4 157 | libtiff6 4.0.6-1 158 | libtirpc-devel 1.1.4-1 159 | libtxc_dxtn 1.0-1.20151227gitf6ec862 160 | libunistring2 0.9.6-1 161 | libusb0 1.2.6.0-2 162 | libuuid-devel 2.25.2-2 163 | libuuid1 2.25.2-2 164 | libvtv0 5.4.0-1 165 | libwebp5 0.4.4-1 166 | libX11-xcb1 1.6.4-1 167 | libX11_6 1.6.4-1 168 | libXau6 1.0.8-1 169 | libXaw7 1.0.13-1 170 | libxcb-glx0 1.12-1 171 | libxcb-render0 1.12-1 172 | libxcb-shm0 1.12-1 173 | libxcb1 1.12-1 174 | libXdmcp6 1.1.2-1 175 | libXext6 1.3.3-1 176 | libXft2 2.3.2-1 177 | libXi6 1.7.8-1 178 | libxml2 2.9.4-1 179 | libXmu6 1.1.2-1 180 | libXpm4 3.5.11-1 181 | libXrender1 0.9.9-1 182 | libXss1 1.2.2-1 183 | libXt6 1.1.5-1 184 | libzmq-devel 4.2.3-1 185 | libzzip0.13 0.13.62-1 186 | m4 1.4.17-2 187 | make 4.1-1 188 | openssh 7.3p1-2 189 | openssl-devel 1.0.2j-1 190 | p11-kit 0.22.1-1 191 | p11-kit-trust 0.22.1-1 192 | patch 2.7.4-1 193 | perl 5.22.2-1 194 | perl-Carp 1.38-1 195 | perl-Digest-SHA 5.96-2 196 | perl-Encode-Locale 1.05-1 197 | perl-Error 0.17024-1 198 | perl-File-Listing 6.04-5 199 | perl-HTML-Parser 3.72-1 200 | perl-HTML-Tagset 3.20-5 201 | perl-HTTP-Cookies 6.01-5 202 | perl-HTTP-Daemon 6.01-5 203 | perl-HTTP-Date 6.02-5 204 | perl-HTTP-Message 6.11-1 205 | perl-HTTP-Negotiate 6.01-5 206 | perl-IO-HTML 1.001-2 207 | perl-IO-String 1.08-5 208 | perl-libwww-perl 6.15-1 209 | perl-LWP-MediaTypes 6.02-5 210 | perl-Net-HTTP 6.09-1 211 | perl-Pod-Simple 3.35-1 212 | perl-Socket 2.024-2 213 | perl-TermReadKey 2.37-1 214 | perl-Tk 804.033-1 215 | perl-Tk-Pod 0.9942-1 216 | perl-URI 1.71-1 217 | perl-WWW-RobotRules 6.02-5 218 | perl-XML-Parser 2.44-2 219 | perl_autorebase 5.22.2-1 220 | perl_base 5.22.2-1 221 | pkg-config 0.29.1-1 222 | poppler-data 0.4.7-1 223 | python37 3.7.7-1 224 | python37-devel 3.7.7-1 225 | python37-tkinter 3.7.7-1 226 | python37-urllib3 1.25.10-1 227 | rebase 4.4.2-1 228 | rsync 3.1.2-1 229 | sed 4.2.2-3 230 | shared-mime-info 1.7-1 231 | tar 1.29-1 232 | tcl 8.5.18-1 233 | tcl-tix 8.4.3-2 234 | tcl-tk 8.5.18-1 235 | terminfo 6.0-8.20160917 236 | texlive 20160520-4 237 | texlive-collection-basic 20160520-1 238 | tzdata 2016j-1 239 | w32api-headers 4.0.4-1 240 | w32api-runtime 4.0.4-1 241 | wget 1.17.1-2 242 | which 2.20-2 243 | windows-default-manifest 6.4-1 244 | xz 5.2.2-1 245 | yasm 1.3.0-2 246 | zlib-devel 1.2.11-1 247 | zlib0 1.2.8-3 248 | -------------------------------------------------------------------------------- /resources/sagemath.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 20 | 22 | 50 | 52 | 53 | 55 | image/svg+xml 56 | 58 | 59 | 60 | 61 | 62 | 66 | 69 | 73 | 80 | 81 | 85 | 91 | 92 | 93 | 94 | 95 | -------------------------------------------------------------------------------- /SageMath.iss: -------------------------------------------------------------------------------- 1 | #define MyAppName "SageMath" 2 | 3 | #ifndef SageVersion 4 | #error SageVersion must be defined--pass /DSageVersion= to InnoSetup with the correct version 5 | #endif 6 | 7 | #ifndef InstallerVersion 8 | #error InstallerVersion must be defined--pass /DInstallerVersion= to InnoSetup with the correct version 9 | #endif 10 | 11 | #ifndef SageArch 12 | #define SageArch "x86_64" 13 | #endif 14 | 15 | #if SageArch == "x86_64" 16 | #define MyArchitecturesAllowed "x64" 17 | #else 18 | #define MyArchitecturesAllowed "x86 x64" 19 | #endif 20 | 21 | #ifndef SageTestInstaller 22 | #define SageTestInstaller "0" 23 | #endif 24 | 25 | #if SageTestInstaller == "1" 26 | #define SageExcludes "\opt\*,\home\*" 27 | #else 28 | #define SageExcludes "\home\*" 29 | #endif 30 | 31 | #define MyAppVersion SageVersion 32 | #define MyAppPublisher "SageMath" 33 | #define MyAppURL "http://www.sagemath.org/" 34 | #define MyAppContact "http://www.sagemath.org/" 35 | 36 | #define SageGroupName MyAppName + " " + MyAppVersion 37 | 38 | #ifndef Compression 39 | #define Compression "lzma2" 40 | #endif 41 | 42 | #ifndef EnvsDir 43 | #define EnvsDir "envs" 44 | #endif 45 | 46 | #ifndef OutputDir 47 | #define OutputDir "dist" 48 | #endif 49 | 50 | #ifndef DiskSpanning 51 | #if Compression == "none" 52 | #define DiskSpanning="yes" 53 | #else 54 | #define DiskSpanning="no" 55 | #endif 56 | #endif 57 | 58 | #define Source EnvsDir + "\runtime-" + SageVersion + "-" + SageArch 59 | 60 | #define Runtime "{app}\runtime" 61 | #define Bin Runtime + "\bin" 62 | #define SageRoot "\opt\sagemath-" + MyAppVersion 63 | #define SageRootWin Runtime + SageRoot 64 | #define SageRootPosix "/opt/sagemath-" + MyAppVersion 65 | 66 | #define SageDoc SageRoot + "\local\share\doc\sage\html" 67 | 68 | [Setup] 69 | AppCopyright={#MyAppPublisher} 70 | AppId={#MyAppName}-{#MyAppVersion} 71 | AppContact={#MyAppContact} 72 | AppComments={#MyAppURL} 73 | AppName={#MyAppName} 74 | AppVersion={#MyAppVersion} 75 | AppPublisher={#MyAppPublisher} 76 | AppPublisherURL={#MyAppURL} 77 | AppSupportURL={#MyAppURL} 78 | AppUpdatesURL={#MyAppURL} 79 | ArchitecturesAllowed={#MyArchitecturesAllowed} 80 | ArchitecturesInstallIn64BitMode=x64 81 | DefaultDirName={commonpf}\{#SageGroupName} 82 | DefaultGroupName={#SageGroupName} 83 | DisableProgramGroupPage=yes 84 | DisableWelcomePage=no 85 | DiskSpanning={#DiskSpanning} 86 | OutputDir={#OutputDir} 87 | OutputBaseFilename={#MyAppName}-{#MyAppVersion}-Installer-v{#InstallerVersion} 88 | OutputManifestFile=SageMath-Manifest.txt 89 | PrivilegesRequired=lowest 90 | Compression={#Compression} 91 | SolidCompression=yes 92 | WizardImageFile=resources\sage-banner.bmp 93 | WizardSmallImageFile=resources\sage-sticker.bmp 94 | WizardImageStretch=yes 95 | UninstallDisplayIcon={app}\unins000.exe 96 | SetupIconFile=resources\sage-floppy-disk.ico 97 | ChangesEnvironment=true 98 | SetupLogging=yes 99 | LicenseFile="{#Source}\opt\sagemath-{#SageVersion}\COPYING.txt" 100 | 101 | [Languages] 102 | Name: "english"; MessagesFile: "compiler:Default.isl" 103 | 104 | [Types] 105 | Name: "full"; Description: "Full installation" 106 | Name: "custom"; Description: "Custom installation"; Flags: iscustom 107 | 108 | [Components] 109 | Name: "sage"; Description: "SageMath Core"; Types: full custom; Flags: fixed 110 | Name: "sagedoc"; Description: "SageMath HTML Documentation"; Types: full 111 | 112 | [Tasks] 113 | Name: startmenu; Description: "Create &start menu icons"; GroupDescription: "Additional icons" 114 | Name: desktop; Description: "Create &desktop icons"; GroupDescription: "Additional icons" 115 | 116 | [Files] 117 | Source: "dot_sage\*"; DestDir: "{#SageRootWin}\dot_sage"; Flags: recursesubdirs ignoreversion; Components: sage 118 | Source: "{#Source}\*"; DestDir: "{#Runtime}"; Excludes: "{#SageExcludes},{#SageDoc}"; Flags: recursesubdirs ignoreversion; Components: sage 119 | Source: "{#Source}{#SageDoc}\*"; DestDir: "{#Runtime}{#SageDoc}"; Flags: recursesubdirs ignoreversion solidbreak; Components: sagedoc 120 | Source: "resources\sagemath.ico"; DestDir: "{app}"; Flags: ignoreversion; AfterInstall: PostInstall; Components: sage 121 | 122 | ; InnoSetup will not create empty directories found when including files 123 | ; recursively in the [Files] section, so any directories that must exist 124 | ; (but start out empty) in the cygwin distribution must be created 125 | ; 126 | ; /etc/fstab.d is where user-specific mount tables go--this is used in 127 | ; sage for windows by /etc/sagerc to set up the /dot_sage mount point for 128 | ; each user's DOT_SAGE directory, since the actual path name might contain 129 | ; spaces and other special characters not handled well by some software that 130 | ; uses DOT_SAGE 131 | ; 132 | ; /dev/shm and /dev/mqueue are used by the system for POSIX semaphores, shared 133 | ; memory, and message queues and must be created world-writeable 134 | [Dirs] 135 | Name: "{#Runtime}\etc\fstab.d"; Permissions: users-modify 136 | Name: "{#Runtime}\dev\shm"; Permissions: users-modify 137 | Name: "{#Runtime}\dev\mqueue"; Permissions: users-modify 138 | Name: "{#Runtime}\home\sage"; Permissions: users-modify 139 | 140 | [UninstallDelete] 141 | Type: filesandordirs; Name: "{app}" 142 | 143 | #define RunSage "/bin/bash --login -c '" + SageRootPosix + "/sage'" 144 | #define RunSageName "SageMath " + SageVersion 145 | #define RunSageTitle "SageMath " + SageVersion + " Console" 146 | #define RunSageDoc "The SageMath console interface" 147 | 148 | #define RunSageSh "/bin/bash --login -c '" + SageRootPosix + "/sage -sh'" 149 | #define RunSageShName "SageMath " + SageVersion + " Shell" 150 | #define RunSageShTitle RunSageShName 151 | #define RunSageShDoc "Command prompt in the SageMath shell environment" 152 | 153 | #define RunSageNb "/bin/bash --login -c '" + SageRootPosix + "/sage --notebook jupyter'" 154 | #define RunSageNbName "SageMath " + SageVersion + " Notebook" 155 | #define RunSageNbTitle "SageMath " + SageVersion + " Notebook Server" 156 | #define RunSageNbDoc "Start SageMath notebook server" 157 | 158 | [Icons] 159 | Name: "{app}\{#RunSageName}"; Filename: "{#Bin}\mintty.exe"; Parameters: "-t '{#RunSageTitle}' -i sagemath.ico {#RunSage}"; WorkingDir: "{app}"; Comment: "{#RunSageDoc}"; IconFilename: "{app}\sagemath.ico" 160 | Name: "{group}\{#RunSageName}"; Filename: "{#Bin}\mintty.exe"; Parameters: "-t '{#RunSageTitle}' -i sagemath.ico {#RunSage}"; WorkingDir: "{app}"; Comment: "{#RunSageDoc}"; IconFilename: "{app}\sagemath.ico"; Tasks: startmenu 161 | Name: "{code:GetDesktopPath}\{#RunSageName}"; Filename: "{#Bin}\mintty.exe"; Parameters: "-t '{#RunSageTitle}' -i sagemath.ico {#RunSage}"; WorkingDir: "{app}"; Comment: "{#RunSageDoc}"; IconFilename: "{app}\sagemath.ico"; Tasks: desktop 162 | 163 | Name: "{app}\{#RunSageShName}"; Filename: "{#Bin}\mintty.exe"; Parameters: "-t '{#RunSageShTitle}' -i sagemath.ico {#RunSageSh}"; WorkingDir: "{app}"; Comment: "{#RunSageShDoc}"; IconFilename: "{app}\sagemath.ico" 164 | Name: "{group}\{#RunSageShName}"; Filename: "{#Bin}\mintty.exe"; Parameters: "-t '{#RunSageShTitle}' -i sagemath.ico {#RunSageSh}"; WorkingDir: "{app}"; Comment: "{#RunSageShDoc}"; IconFilename: "{app}\sagemath.ico"; Tasks: startmenu 165 | Name: "{code:GetDesktopPath}\{#RunSageShName}"; Filename: "{#Bin}\mintty.exe"; Parameters: "-t '{#RunSageShTitle}' -i sagemath.ico {#RunSageSh}"; WorkingDir: "{app}"; Comment: "{#RunSageShDoc}"; IconFilename: "{app}\sagemath.ico"; Tasks: desktop 166 | 167 | Name: "{app}\{#RunSageNbName}"; Filename: "{#Bin}\mintty.exe"; Parameters: "-t '{#RunSageNbTitle}' -i sagemath.ico {#RunSageNb}"; WorkingDir: "{app}"; Comment: "{#RunSageNbDoc}"; IconFilename: "{app}\sagemath.ico" 168 | Name: "{group}\{#RunSageNbName}"; Filename: "{#Bin}\mintty.exe"; Parameters: "-t '{#RunSageNbTitle}' -i sagemath.ico {#RunSageNb}"; WorkingDir: "{app}"; Comment: "{#RunSageNbDoc}"; IconFilename: "{app}\sagemath.ico"; Tasks: startmenu 169 | Name: "{code:GetDesktopPath}\{#RunSageNbName}"; Filename: "{#Bin}\mintty.exe"; Parameters: "-t '{#RunSageNbTitle}' -i sagemath.ico {#RunSageNb}"; WorkingDir: "{app}"; Comment: "{#RunSageNbDoc}"; IconFilename: "{app}\sagemath.ico"; Tasks: desktop 170 | 171 | [Code] 172 | var 173 | UserInstall: Boolean; 174 | UserHomeDir: String; 175 | InstallModeSelectPageID: Integer; 176 | UserHomeDirSelectPageID: Integer; 177 | 178 | 179 | // This function is used above in the [Icons] section to get the correct 180 | // installation path for desktop icons depending on what installation mode 181 | // was selected 182 | function GetDesktopPath(Param: String): String; 183 | begin 184 | if UserInstall then 185 | begin 186 | Result := ExpandConstant('{userdesktop}'); 187 | end 188 | else begin 189 | Result := ExpandConstant('{commondesktop}'); 190 | end; 191 | end; 192 | 193 | 194 | // ******************* Custom Install Wizard Pages *************************** 195 | 196 | 197 | function ProcessInstallModeSelectPage(Page: TWizardPage): Boolean; 198 | begin 199 | if TInputOptionWizardPage(Page).CheckListBox.Checked[0] then 200 | begin 201 | WizardForm.DirEdit.Text := ExpandConstant('{localappdata}\{#SageGroupName}'); 202 | UserInstall := True; 203 | end 204 | else begin 205 | WizardForm.DirEdit.Text := ExpandConstant('{commonpf}\{#SageGroupName}'); 206 | UserInstall := False; 207 | end; 208 | 209 | Result := True; 210 | end; 211 | 212 | 213 | procedure CreateInstallModeSelectPage(); 214 | var 215 | Page: TInputOptionWizardPage; 216 | begin 217 | Page := CreateInputOptionPage(wpUserInfo, 'Install Mode Select', 218 | 'Install either for a single user or for all users on the system (requires Administrator privileges).', '', True, False); 219 | InstallModeSelectPageID := Page.ID; 220 | 221 | Page.Add('Install just for the current user'); 222 | Page.Add('Install for all users (installer must be run with Administrator privileges)'); 223 | 224 | UserInstall := Boolean( 225 | StrToInt( 226 | GetPreviousData('UserInstall', IntToStr(Integer(not IsAdminInstallMode()))))); 227 | 228 | with Page do 229 | begin 230 | CheckListBox.Checked[0] := UserInstall; 231 | CheckListBox.Checked[1] := (not UserInstall); 232 | CheckListBox.ItemEnabled[1] := IsAdminInstallMode(); 233 | OnNextButtonClick := @ProcessInstallModeSelectPage; 234 | end; 235 | end; 236 | 237 | 238 | function ProcessUserHomeDirSelectPage(Page: TWizardPage): Boolean; 239 | begin 240 | UserHomeDir := TInputDirWizardPage(Page).Values[0]; 241 | Result := True; 242 | end; 243 | 244 | 245 | procedure CreateUserHomeDirSelectPage(); 246 | var 247 | Page: TInputDirWizardPage; 248 | begin 249 | Page := CreateInputDirPage(InstallModeSelectPageID, 'Select Sage home directory', 250 | 'Select the default directory that Sage will start in', '', False, ''); 251 | Page.Add('Sage will start with this folder as your working directory by default; you can also change this after installation using the sage-sethome command:'); 252 | UserHomeDirSelectPageID := Page.ID; 253 | with Page do 254 | begin 255 | Values[0] := ExpandConstant('{%USERPROFILE}'); 256 | OnNextButtonClick := @ProcessUserHomeDirSelectPage; 257 | end; 258 | end; 259 | 260 | 261 | procedure RegisterPreviousData(PreviousDataKey: Integer); 262 | begin 263 | SetPreviousData(PreviousDataKey, 'UserInstall', IntToStr(Integer(UserInstall))); 264 | end; 265 | 266 | 267 | function ShouldSkipPage(PageID: Integer): Boolean; 268 | begin 269 | Result := False; 270 | if (PageID = UserHomeDirSelectPageID) and (not UserInstall) then 271 | Result := True; 272 | end; 273 | 274 | 275 | procedure InitializeWizard(); 276 | begin 277 | UserInstall := not IsAdminInstallMode(); 278 | CreateInstallModeSelectPage(); 279 | CreateUserHomeDirSelectPage(); 280 | end; 281 | 282 | 283 | // Symlinks from the Cygwin runtime are stored in the .lnk file format 284 | // which is one of the different ways of storing symlinks supported by Cygwin; 285 | // for this to work they must have the READ ONLY attribute set on them. 286 | // When the files are compressed by InnoSetup they lose this attribute, so 287 | // we must have a list of files that are supposed to by symlinks, which is 288 | // created by the Makefile as /etc/symlinks.lst and included in 289 | // the installer. This procedure loops over all the files in this list and 290 | // applies the READ ONLY attribute to them so they can once again be recognized 291 | // by Cygwin as symlinks. 292 | procedure FixupSymlinks(); 293 | var 294 | n: Integer; 295 | i: Integer; 296 | resultCode: Integer; 297 | filenames: TArrayOfString; 298 | filenam: String; 299 | begin 300 | LoadStringsFromFile(ExpandConstant('{#Runtime}\etc\symlinks.lst'), filenames); 301 | n := GetArrayLength(filenames); 302 | WizardForm.ProgressGauge.Min := 0; 303 | WizardForm.ProgressGauge.Max := n - 1; 304 | WizardForm.ProgressGauge.Position := 0; 305 | WizardForm.StatusLabel.Caption := 'Fixing up symlinks...'; 306 | for i := 0 to n - 1 do 307 | begin 308 | filenam := filenames[i] + '.lnk'; 309 | WizardForm.FilenameLabel.Caption := Copy(filenam, 2, Length(filenam)); 310 | WizardForm.ProgressGauge.Position := i; 311 | Exec(ExpandConstant('{sys}\attrib.exe'), '+R ' + filenam, 312 | ExpandConstant('{#Runtime}'), SW_HIDE, ewNoWait, resultCode); 313 | end; 314 | end; 315 | 316 | 317 | // In principle we should be able to run the sage-sethome script with the 318 | // just-installed bash.exe, but this seems to encounter insurmountable 319 | // problems with quoting or I'm not sure what else, so we essentially 320 | // reimplement that script here to write the appropriate /etc/fstab.d file. 321 | procedure SetHome(); 322 | var 323 | resultCode: Integer; 324 | userHome: String; 325 | fstabdFile: String; 326 | fstabLine: String; 327 | fstabLines: TArrayOfString; 328 | begin 329 | fstabdFile := ExpandConstant('{#Runtime}\etc\fstab.d\') + GetUserNameString(); 330 | userHome := Copy(UserHomeDir, 1, Length(UserHomeDir)); 331 | StringChangeEx(userHome, ' ', '\040', True) 332 | fstabLine := userHome + ' /home/sage ntfs binary,posix=1,user,acl 0 0'; 333 | SetArrayLength(fstabLines, 2); 334 | fstabLines[0] := fstabLine; 335 | fstabLines[1] := 'none /tmp usertemp binary,posix=0 0 0'; 336 | SaveStringsToUTF8File(fstabdFile, fstabLines, False); 337 | // The above nevertheless writes the file with a bunch of stupid 338 | // ideosyncracies (most notably, a useless UTF-8 BOM) which confuse 339 | // Cygwin; we run this final cleanup script to fix everything, ugh. 340 | Exec(ExpandConstant('{#Bin}\dash.exe'), 341 | '/usr/local/bin/_sage-complete-install.sh', 342 | ExpandConstant('{#Runtime}'), 343 | SW_HIDE, ewNoWait, resultCode); 344 | end; 345 | 346 | 347 | procedure PostInstall(); 348 | begin 349 | FixupSymlinks(); 350 | if UserInstall then 351 | SetHome(); 352 | end; 353 | -------------------------------------------------------------------------------- /cygwin_extras/usr/local/bin/apt-cyg: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # apt-cyg: install tool for Cygwin similar to debian apt-get 3 | # 4 | # The MIT License (MIT) 5 | # 6 | # Copyright (c) 2013 Trans-code Design 7 | # 8 | # Permission is hereby granted, free of charge, to any person obtaining a copy 9 | # of this software and associated documentation files (the "Software"), to deal 10 | # in the Software without restriction, including without limitation the rights 11 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | # copies of the Software, and to permit persons to whom the Software is 13 | # furnished to do so, subject to the following conditions: 14 | # 15 | # The above copyright notice and this permission notice shall be included in 16 | # all copies or substantial portions of the Software. 17 | # 18 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | # THE SOFTWARE. 25 | 26 | if [ ${BASH_VERSINFO}${BASH_VERSINFO[1]} -lt 42 ] 27 | then 28 | echo 'Bash version 4.2+ required' 29 | exit 30 | fi 31 | 32 | usage="\ 33 | NAME 34 | apt-cyg - package manager utility 35 | 36 | SYNOPSIS 37 | apt-cyg [operation] [options] [targets] 38 | 39 | DESCRIPTION 40 | apt-cyg is a package management utility that tracks installed packages on a 41 | Cygwin system. Invoking apt-cyg involves specifying an operation with any 42 | potential options and targets to operate on. A target is usually a package 43 | name, file name, URL, or a search string. Targets can be provided as command 44 | line arguments. 45 | 46 | OPERATIONS 47 | install 48 | Install package(s). 49 | 50 | remove 51 | Remove package(s) from the system. 52 | 53 | update 54 | Download a fresh copy of the master package list (setup.ini) from the 55 | server defined in setup.rc. 56 | 57 | download 58 | Retrieve package(s) from the server, but do not install/upgrade anything. 59 | 60 | show 61 | Display information on given package(s). 62 | 63 | depends 64 | Produce a dependency tree for a package. 65 | 66 | rdepends 67 | Produce a tree of packages that depend on the named package. 68 | 69 | list 70 | Search each locally-installed package for names that match regexp. If no 71 | package names are provided in the command line, all installed packages will 72 | be queried. 73 | 74 | listall 75 | This will search each package in the master package list (setup.ini) for 76 | names that match regexp. 77 | 78 | category 79 | Display all packages that are members of a named category. 80 | 81 | listfiles 82 | List all files owned by a given package. Multiple packages can be specified 83 | on the command line. 84 | 85 | search 86 | Search for downloaded packages that own the specified file(s). The path can 87 | be relative or absolute, and one or more files can be specified. 88 | 89 | searchall 90 | Search cygwin.com to retrieve file information about packages. The provided 91 | target is considered to be a filename and searchall will return the 92 | package(s) which contain this file. 93 | 94 | mirror 95 | Set the mirror; a full URL to a location where the database, packages, and 96 | signatures for this repository can be found. If no URL is provided, display 97 | current mirror. 98 | 99 | cache 100 | Set the package cache directory. If a file is not found in cache directory, 101 | it will be downloaded. Unix and Windows forms are accepted, as well as 102 | absolute or regular paths. If no directory is provided, display current 103 | cache. 104 | 105 | OPTIONS 106 | --nodeps 107 | Specify this option to skip all dependency checks. 108 | 109 | --version 110 | Display version and exit. 111 | " 112 | 113 | version="\ 114 | apt-cyg version 1 115 | 116 | The MIT License (MIT) 117 | 118 | Copyright (c) 2005-9 Stephen Jungels 119 | " 120 | 121 | function wget { 122 | if command wget -h &>/dev/null 123 | then 124 | command wget "$@" 125 | else 126 | warn wget is not installed, using lynx as fallback 127 | set "${*: -1}" 128 | lynx -source "$1" > "${1##*/}" 129 | fi 130 | } 131 | 132 | function find-workspace { 133 | # default working directory and mirror 134 | 135 | # work wherever setup worked last, if possible 136 | cache=$(awk ' 137 | BEGIN { 138 | RS = "\n\\<" 139 | FS = "\n\t" 140 | } 141 | $1 == "last-cache" { 142 | print $2 143 | } 144 | ' /etc/setup/setup.rc) 145 | 146 | mirror=$(awk ' 147 | /last-mirror/ { 148 | getline 149 | print $1 150 | } 151 | ' /etc/setup/setup.rc) 152 | mirrordir=$(sed ' 153 | s / %2f g 154 | s : %3a g 155 | ' <<< "$mirror") 156 | 157 | mkdir -p "$cache/$mirrordir/$arch" 158 | cd "$cache/$mirrordir/$arch" 159 | if [ -e setup.ini ] 160 | then 161 | return 0 162 | else 163 | get-setup 164 | return 1 165 | fi 166 | } 167 | 168 | function get-setup { 169 | touch setup.ini 170 | mv setup.ini setup.ini-save 171 | wget -N $mirror/$arch/setup.bz2 172 | if [ -e setup.bz2 ] 173 | then 174 | bunzip2 setup.bz2 175 | mv setup setup.ini 176 | echo Updated setup.ini 177 | else 178 | echo Error updating setup.ini, reverting 179 | mv setup.ini-save setup.ini 180 | fi 181 | } 182 | 183 | function check-packages { 184 | if [[ $pks ]] 185 | then 186 | return 0 187 | else 188 | echo No packages found. 189 | return 1 190 | fi 191 | } 192 | 193 | function warn { 194 | printf '\e[1;31m%s\e[m\n' "$*" >&2 195 | } 196 | 197 | function apt-update { 198 | if find-workspace 199 | then 200 | get-setup 201 | fi 202 | } 203 | 204 | function apt-category { 205 | check-packages 206 | find-workspace 207 | for pkg in "${pks[@]}" 208 | do 209 | awk ' 210 | $1 == "@" { 211 | pck = $2 212 | } 213 | $1 == "category:" && $0 ~ query { 214 | print pck 215 | } 216 | ' query="$pks" setup.ini 217 | done 218 | } 219 | 220 | function apt-list { 221 | local sbq 222 | for pkg in "${pks[@]}" 223 | do 224 | let sbq++ && echo 225 | awk 'NR>1 && $1~pkg && $0=$1' pkg="$pkg" /etc/setup/installed.db 226 | done 227 | let sbq && return 228 | awk 'NR>1 && $0=$1' /etc/setup/installed.db 229 | } 230 | 231 | function apt-listall { 232 | check-packages 233 | find-workspace 234 | local sbq 235 | for pkg in "${pks[@]}" 236 | do 237 | let sbq++ && echo 238 | awk '$1~pkg && $0=$1' RS='\n\n@ ' FS='\n' pkg="$pkg" setup.ini 239 | done 240 | } 241 | 242 | function apt-listfiles { 243 | check-packages 244 | find-workspace 245 | local pkg sbq 246 | for pkg in "${pks[@]}" 247 | do 248 | (( sbq++ )) && echo 249 | if [ ! -e /etc/setup/"$pkg".lst.gz ] 250 | then 251 | download "$pkg" 252 | fi 253 | gzip -cd /etc/setup/"$pkg".lst.gz 254 | done 255 | } 256 | 257 | function apt-show { 258 | find-workspace 259 | check-packages 260 | for pkg in "${pks[@]}" 261 | do 262 | (( notfirst++ )) && echo 263 | awk ' 264 | $1 == query { 265 | print 266 | fd++ 267 | } 268 | END { 269 | if (! fd) 270 | print "Unable to locate package " query 271 | } 272 | ' RS='\n\n@ ' FS='\n' query="$pkg" setup.ini 273 | done 274 | } 275 | 276 | function apt-depends { 277 | find-workspace 278 | check-packages 279 | for pkg in "${pks[@]}" 280 | do 281 | awk ' 282 | @include "join" 283 | $1 == "@" { 284 | apg = $2 285 | } 286 | $1 == "requires:" { 287 | for (z=2; z<=NF; z++) 288 | reqs[apg][z-1] = $z 289 | } 290 | END { 291 | prpg(ENVIRON["pkg"]) 292 | } 293 | function smartmatch(small, large, values) { 294 | for (each in large) 295 | values[large[each]] 296 | return small in values 297 | } 298 | function prpg(fpg) { 299 | if (smartmatch(fpg, spath)) return 300 | spath[length(spath)+1] = fpg 301 | print join(spath, 1, length(spath), " > ") 302 | if (isarray(reqs[fpg])) 303 | for (each in reqs[fpg]) 304 | prpg(reqs[fpg][each]) 305 | delete spath[length(spath)] 306 | } 307 | ' setup.ini 308 | done 309 | } 310 | 311 | function apt-rdepends { 312 | find-workspace 313 | for pkg in "${pks[@]}" 314 | do 315 | awk ' 316 | @include "join" 317 | $1 == "@" { 318 | apg = $2 319 | } 320 | $1 == "requires:" { 321 | for (z=2; z<=NF; z++) 322 | reqs[$z][length(reqs[$z])+1] = apg 323 | } 324 | END { 325 | prpg(ENVIRON["pkg"]) 326 | } 327 | function smartmatch(small, large, values) { 328 | for (each in large) 329 | values[large[each]] 330 | return small in values 331 | } 332 | function prpg(fpg) { 333 | if (smartmatch(fpg, spath)) return 334 | spath[length(spath)+1] = fpg 335 | print join(spath, 1, length(spath), " < ") 336 | if (isarray(reqs[fpg])) 337 | for (each in reqs[fpg]) 338 | prpg(reqs[fpg][each]) 339 | delete spath[length(spath)] 340 | } 341 | ' setup.ini 342 | done 343 | } 344 | 345 | function apt-download { 346 | check-packages 347 | find-workspace 348 | local pkg sbq 349 | for pkg in "${pks[@]}" 350 | do 351 | (( sbq++ )) && echo 352 | download "$pkg" 353 | done 354 | } 355 | 356 | function download { 357 | local pkg digest digactual 358 | pkg=$1 359 | # look for package and save desc file 360 | 361 | awk '$1 == pc' RS='\n\n@ ' FS='\n' pc=$pkg setup.ini > desc 362 | if [ ! -s desc ] 363 | then 364 | echo Unable to locate package $pkg 365 | exit 1 366 | fi 367 | 368 | # download and unpack the bz2 or xz file 369 | 370 | # pick the latest version, which comes first 371 | set -- $(awk '$1 == "install:"' desc) 372 | if (( ! $# )) 373 | then 374 | echo 'Could not find "install" in package description: obsolete package?' 375 | exit 1 376 | fi 377 | 378 | dn=$(dirname $2) 379 | bn=$(basename $2) 380 | 381 | # check the md5 382 | digest=$4 383 | case ${#digest} in 384 | 32) hash=md5sum ;; 385 | 128) hash=sha512sum ;; 386 | esac 387 | mkdir -p "$cache/$mirrordir/$dn" 388 | cd "$cache/$mirrordir/$dn" 389 | if ! test -e $bn || ! $hash -c <<< "$digest $bn" 390 | then 391 | wget -O $bn $mirror/$dn/$bn 392 | $hash -c <<< "$digest $bn" || exit 393 | fi 394 | 395 | tar tf $bn | gzip > /etc/setup/"$pkg".lst.gz 396 | cd ~- 397 | mv desc "$cache/$mirrordir/$dn" 398 | echo $dn $bn > /tmp/dwn 399 | } 400 | 401 | function apt-search { 402 | check-packages 403 | echo Searching downloaded packages... 404 | for pkg in "${pks[@]}" 405 | do 406 | key=$(type -P "$pkg" | sed s./..) 407 | [[ $key ]] || key=$pkg 408 | for manifest in /etc/setup/*.lst.gz 409 | do 410 | if gzip -cd $manifest | grep -q "$key" 411 | then 412 | package=$(sed ' 413 | s,/etc/setup/,, 414 | s,.lst.gz,, 415 | ' <<< $manifest) 416 | echo $package 417 | fi 418 | done 419 | done 420 | } 421 | 422 | function apt-searchall { 423 | cd /tmp 424 | for pkg in "${pks[@]}" 425 | do 426 | printf -v qs 'text=1&arch=%s&grep=%s' $arch "$pkg" 427 | wget -O matches cygwin.com/cgi-bin2/package-grep.cgi?"$qs" 428 | awk ' 429 | NR == 1 {next} 430 | mc[$1]++ {next} 431 | /-debuginfo-/ {next} 432 | /^cygwin32-/ {next} 433 | {print $1} 434 | ' FS=-[[:digit:]] matches 435 | done 436 | } 437 | 438 | function apt-install { 439 | check-packages 440 | find-workspace 441 | local pkg dn bn requires wr package sbq script 442 | for pkg in "${pks[@]}" 443 | do 444 | 445 | if grep -q "^$pkg " /etc/setup/installed.db 446 | then 447 | echo Package $pkg is already installed, skipping 448 | continue 449 | fi 450 | (( sbq++ )) && echo 451 | echo Installing $pkg 452 | 453 | download $pkg 454 | read dn bn /tmp/awk.$$ 471 | mv /etc/setup/installed.db /etc/setup/installed.db-save 472 | mv /tmp/awk.$$ /etc/setup/installed.db 473 | 474 | [ -v nodeps ] && continue 475 | # recursively install required packages 476 | 477 | requires=$(awk '$1=="requires", $0=$2' FS=': ' desc) 478 | cd ~- 479 | wr=0 480 | if [[ $requires ]] 481 | then 482 | echo Package $pkg requires the following packages, installing: 483 | echo $requires 484 | for package in $requires 485 | do 486 | if grep -q "^$package " /etc/setup/installed.db 487 | then 488 | echo Package $package is already installed, skipping 489 | continue 490 | fi 491 | apt-cyg install --noscripts $package || (( wr++ )) 492 | done 493 | fi 494 | if (( wr )) 495 | then 496 | echo some required packages did not install, continuing 497 | fi 498 | 499 | # run all postinstall scripts 500 | 501 | [ -v noscripts ] && continue 502 | find /etc/postinstall -name '*.sh' | while read script 503 | do 504 | echo Running $script 505 | $script 506 | mv $script $script.done 507 | done 508 | echo Package $pkg installed 509 | 510 | done 511 | } 512 | 513 | function apt-remove { 514 | check-packages 515 | cd /etc 516 | cygcheck awk bash bunzip2 grep gzip mv sed tar xz > setup/essential.lst 517 | for pkg in "${pks[@]}" 518 | do 519 | 520 | if ! grep -q "^$pkg " setup/installed.db 521 | then 522 | echo Package $pkg is not installed, skipping 523 | continue 524 | fi 525 | 526 | if [ ! -e setup/"$pkg".lst.gz ] 527 | then 528 | warn Package manifest missing, cannot remove $pkg. Exiting 529 | exit 1 530 | fi 531 | gzip -dk setup/"$pkg".lst.gz 532 | awk ' 533 | NR == FNR { 534 | if ($NF) ess[$NF] 535 | next 536 | } 537 | $NF in ess { 538 | exit 1 539 | } 540 | ' FS='[/\\\\]' setup/{essential,$pkg}.lst 541 | esn=$? 542 | if [ $esn = 0 ] 543 | then 544 | echo Removing $pkg 545 | if [ -e preremove/"$pkg".sh ] 546 | then 547 | preremove/"$pkg".sh 548 | rm preremove/"$pkg".sh 549 | fi 550 | mapfile dt < setup/"$pkg".lst 551 | for each in ${dt[*]} 552 | do 553 | [ -f /$each ] && rm /$each 554 | done 555 | for each in ${dt[*]} 556 | do 557 | [ -d /$each ] && rmdir --i /$each 558 | done 559 | rm -f setup/"$pkg".lst.gz postinstall/"$pkg".sh.done 560 | awk -i inplace '$1 != ENVIRON["pkg"]' setup/installed.db 561 | echo Package $pkg removed 562 | fi 563 | rm setup/"$pkg".lst 564 | if [ $esn = 1 ] 565 | then 566 | warn apt-cyg cannot remove package $pkg, exiting 567 | exit 1 568 | fi 569 | 570 | done 571 | } 572 | 573 | function apt-mirror { 574 | if [ "$pks" ] 575 | then 576 | awk -i inplace ' 577 | 1 578 | /last-mirror/ { 579 | getline 580 | print "\t" pks 581 | } 582 | ' pks="$pks" /etc/setup/setup.rc 583 | echo Mirror set to "$pks". 584 | else 585 | awk ' 586 | /last-mirror/ { 587 | getline 588 | print $1 589 | } 590 | ' /etc/setup/setup.rc 591 | fi 592 | } 593 | 594 | function apt-cache { 595 | if [ "$pks" ] 596 | then 597 | vas=$(cygpath -aw "$pks") 598 | awk -i inplace ' 599 | 1 600 | /last-cache/ { 601 | getline 602 | print "\t" vas 603 | } 604 | ' vas="${vas//\\/\\\\}" /etc/setup/setup.rc 605 | echo Cache set to "$vas". 606 | else 607 | awk ' 608 | /last-cache/ { 609 | getline 610 | print $1 611 | } 612 | ' /etc/setup/setup.rc 613 | fi 614 | } 615 | 616 | if [ -p /dev/stdin ] 617 | then 618 | mapfile -t pks 619 | fi 620 | 621 | # process options 622 | until [ $# = 0 ] 623 | do 624 | case "$1" in 625 | 626 | --nodeps) 627 | nodeps=1 628 | shift 629 | ;; 630 | 631 | --noscripts) 632 | noscripts=1 633 | shift 634 | ;; 635 | 636 | --version) 637 | printf "$version" 638 | exit 639 | ;; 640 | 641 | update) 642 | command=$1 643 | shift 644 | ;; 645 | 646 | list | cache | remove | depends | listall | download | listfiles |\ 647 | show | mirror | search | install | category | rdepends | searchall ) 648 | if [[ $command ]] 649 | then 650 | pks+=("$1") 651 | else 652 | command=$1 653 | fi 654 | shift 655 | ;; 656 | 657 | *) 658 | pks+=("$1") 659 | shift 660 | ;; 661 | 662 | esac 663 | done 664 | 665 | set -a 666 | 667 | if type -t apt-$command | grep -q function 668 | then 669 | readonly arch=${HOSTTYPE/i6/x} 670 | apt-$command 671 | else 672 | printf "$usage" 673 | fi 674 | -------------------------------------------------------------------------------- /resources/sage-floppy-disk.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | image/svg+xml -------------------------------------------------------------------------------- /resources/sage-banner.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 24 | 26 | 28 | 32 | 36 | 37 | 39 | 43 | 47 | 48 | 50 | 54 | 58 | 59 | 66 | 73 | 80 | 87 | 89 | 93 | 97 | 98 | 105 | 115 | 117 | 121 | 125 | 126 | 133 | 135 | 139 | 143 | 144 | 151 | 161 | 163 | 167 | 171 | 172 | 179 | 181 | 185 | 189 | 190 | 192 | 196 | 200 | 201 | 208 | 218 | 220 | 224 | 228 | 229 | 236 | 243 | 245 | 249 | 253 | 254 | 264 | 274 | 284 | 294 | 301 | 311 | 315 | 321 | 326 | 332 | 338 | 346 | 351 | 352 | 358 | 368 | 373 | 377 | 378 | 385 | 391 | 396 | 401 | 406 | 407 | 414 | 415 | 446 | 450 | 451 | 453 | 454 | 456 | image/svg+xml 457 | 459 | 460 | 461 | 462 | 463 | 468 | 480 | 483 | 490 | 497 | 504 | 511 | 518 | 525 | 532 | 539 | 546 | 553 | 560 | 567 | 574 | 581 | 588 | 593 | 598 | 603 | 608 | 613 | 618 | 623 | 628 | 633 | 638 | 643 | 648 | 653 | 658 | 663 | 668 | 673 | 678 | 683 | 688 | 693 | 698 | 703 | 708 | 713 | 720 | 727 | 732 | 737 | 742 | 747 | 748 | 755 | 759 | 765 | 771 | 777 | 778 | 782 | 789 | 795 | 801 | 802 | 803 | 804 | --------------------------------------------------------------------------------