Skip to content
This repository was archived by the owner on Nov 10, 2022. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Make sure shell scripts have linux line endings
*.sh binary
43 changes: 40 additions & 3 deletions NewWindows/Readme.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,43 @@
This directory contains scripts which automatically build GAP on Cygwin.

Scripts:
Producing an installer requires Inno Setup 6 ( https://jrsoftware.org/isdl.php#stable ) is installed in it's standard location.

cygwin_install.bat: Install a local cygwin to build GAP
get_gap_head.bat: Build the head of GAP into the cygwin installed by cygwin_install.bat

Short version: Run 'build_gap_release.bat', and eventually an installer will appear in a directory called 'Output'.


Description of scripts
----------------------

This script runs a series of smaller scripts:

cygwin_install.bat: Install two copies of cygwin
- cygwin_build_gap : For building GAP (includes compilers and dev versions of packages)
- cygwin_release_gap : A smaller Cygwin which only includes files needed for running GAP.


run_script_in_cygwin.bat : Take a shell script as an argument and runs it inside cygwin_build_gap. The scripts available are:

- get_gap_head.sh : Get GAP master branch
- get_gap_head_minima.sh : Get GAP master branch with minimal packages (smallest)
- get_gap_release.sh : Get GAP release (current hard-wired to 4.11)
- build_gap_and_packages.sh : Build whatever GAP we previously grabbed.

step_move_gap_to_release.bat : Move GAP from the cygwin_build_gap to cygwin_release_gap, doing some cleanup and adding extra files (these extra files are described below)


Cygwin changes / customisations
-------------------------------

Some files inside the Cygwin install are changed/customised. These are described below:


gap.bat - Run GAP in the standard windows terminal. This is not put on the start menu, and is provided for non-interactive use.

gap-mintty.bat - Run GAP in the 'mintty' terminal. This tries to provide the best user experience, including keeping the window open if GAP exits with an error.

run-gap.sh - Run by gap.bat
run-mintty-gap.sh - Run by gap-mintty.bat

etc/nsswitch.conf - Sets the 'home' directory to the User's Windows home directory.
etc/fstab - Set the /tmp directory to the User's Windows temp directory
20 changes: 20 additions & 0 deletions NewWindows/build_gap_release.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
SETLOCAL

REM -- Change to the directory of the executing batch file
CD %~dp0

IF EXIST "c:\Program Files (x86)\Inno Setup 6\Compil32.exe" (
ECHO Inno Setup 6 Found
) ELSE (
ECHO "c:\Program Files (x86)\Inno Setup 6\Compil32.exe" not Found
EXIT /B 0
)

call cygwin_install.bat
call run_script_in_cygwin.bat shell_scripts\get_gap_release.sh
call run_script_in_cygwin.bat shell_scripts\apply_gap_patches_for_cygwin.sh
call run_script_in_cygwin.bat shell_scripts\build_gap_and_packages.sh
call move_gap_to_release.bat
call build_installer.bat

ENDLOCAL
10 changes: 10 additions & 0 deletions NewWindows/build_installer.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
SETLOCAL

REM -- Change to the directory of the executing batch file
CD %~dp0

"c:\Program Files (x86)\Inno Setup 6\Compil32.exe" /cc gap.iss

ENDLOCAL

EXIT /B 0
26 changes: 12 additions & 14 deletions NewWindows/cygwin_install.bat
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,28 @@ REM -- Change to the directory of the executing batch file
CD %~dp0

REM -- Get cygwin
curl https://cygwin.com/setup-x86_64.exe --output setup.exe
curl https://cygwin.com/setup-x86_64.exe --output setup-x86_64.exe

REM -- Configure paths
SET SITE=http://cygwin.mirrors.pair.com/
SET LOCALDIR=%CD%
SET ROOTDIR=%~dp0\gap_cygwin
SET BUILDROOTDIR=%~dp0\cygwin_build_gap
SET RUNROOTDIR=%~dp0\cygwin_release_gap
ECHO %ROOTDIR%

REM -- These are the packages we will install (in addition to the default packages)
SET PACKAGES=wget,git,gcc,gcc-g++,gcc-core,m4,libgmp-devel,make,automake
REM -- These are necessary for apt-cyg install, do not change. Any duplicates will be ignored.
REM -- SET PACKAGES=%PACKAGES%,wget,tar,gawk,bzip2,subversion

SET BUILDPACKAGES=wget,git,gcc,gcc-g++,gcc-core,zlib-devel,m4,make,automake,,libtool,libgmp-devel,libreadline-devel,libncurses-devel,libpopt-devel,libcurl-devel,libidn2-devel,libssl-devel,libssh-devel,openldap-devel,libiconv-devel,libsasl2-devel,libzmq-devel,singular,libboost-devel
SET RUNPACKAGES=libgmp10,libreadline7,zlib0,libncursesw10,libpopt0,libcurl4,libidn2,libssl1.1,libzmq5,singular

REM -- Do it!
ECHO.
ECHO *** INSTALLING PACKAGES
setup -W --quiet-mode --no-desktop --no-admin --no-startmenu --no-shortcuts -s %SITE% -l "%LOCALDIR%" -R "%ROOTDIR%" -P %PACKAGES%
ECHO *** SETTING UP BUILD CYGWIN
setup-x86_64 -W --quiet-mode --no-desktop --no-admin --no-startmenu --no-shortcuts -s %SITE% -l "%LOCALDIR%" -R "%BUILDROOTDIR%" -P %BUILDPACKAGES%

ECHO *** SETTING UP RUNTIME CYGWIN
setup-x86_64 -W --quiet-mode --no-desktop --no-admin --no-startmenu --no-shortcuts -s %SITE% -l "%LOCALDIR%" -R "%RUNROOTDIR%" -P %RUNPACKAGES%

REM -- Show what we did
ECHO.
ECHO.
ECHO cygwin installation updated
ECHO - %PACKAGES%
ECHO.
ECHO *** SETUP CYGWINS


ENDLOCAL
Expand Down
11 changes: 11 additions & 0 deletions NewWindows/extra_cygwin_files/etc/fstab
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# /etc/fstab
#
# This file is read once by the first process in a Cygwin process tree.
# To pick up changes, restart all Cygwin processes. For a description
# see https://cygwin.com/cygwin-ug-net/using.html#mount-table

# This is default anyway:
none /cygdrive cygdrive binary,posix=0,user 0 0

# GAP customisation: Point cygwin's temp directory to Windows's temp directory
none /tmp usertemp binary,posix=0 0 0
2 changes: 2 additions & 0 deletions NewWindows/extra_cygwin_files/etc/nsswitch.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# /etc/nsswitch.conf
db_home: /%H
4 changes: 4 additions & 0 deletions NewWindows/extra_cygwin_files/gap-mintty.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@echo off
setlocal enableextensions
set TERM=
cd /d "%~dp0bin" && mintty.exe -s 120,40 .\bash --login /run-gap-mintty.sh
4 changes: 4 additions & 0 deletions NewWindows/extra_cygwin_files/gap.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@echo off
setlocal enableextensions
set TERM=
cd /d "%~dp0bin" && .\bash --login /run-gap.sh
10 changes: 10 additions & 0 deletions NewWindows/extra_cygwin_files/run-gap-mintty.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env bash

cd ~

/opt/gap/gap


if [ $? -ne 0 ]; then
read -p "GAP exited with an error. Press Enter to close window"
fi
5 changes: 5 additions & 0 deletions NewWindows/extra_cygwin_files/run-gap.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash

cd ~

/opt/gap/gap
50 changes: 50 additions & 0 deletions NewWindows/gap.iss
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

#define MyAppName "GAP"
#define MyAppVersion "4.11"
#define MyAppPublisher "Gap Group"
#define MyAppURL "https://www.gap-system.org"
#define MyAppExeName "Gap-mintty.bat"

[Setup]
; NOTE: The value of AppId uniquely identifies this application. Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{AF1BC6F6-32FA-4E72-8F41-8862190D2F8F}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={autopf}\{#MyAppName}
DisableProgramGroupPage=yes
; Uncomment the following line to run in non administrative install mode (install for current user only.)
;PrivilegesRequired=lowest
PrivilegesRequiredOverridesAllowed=dialog
OutputBaseFilename=gap-setup
Compression=lzma
LZMANumBlockThreads=6
SolidCompression=yes
WizardStyle=modern

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

[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked

[Files]
Source: "cygwin_release_gap\Gap.bat"; DestDir: "{app}"; Flags: ignoreversion
Source: "cygwin_release_gap\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
; NOTE: Don't use "Flags: ignoreversion" on any shared system files

[Icons]
Name: "{autoprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon


[Run]
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: shellexec postinstall skipifsilent

27 changes: 27 additions & 0 deletions NewWindows/move_gap_to_release.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
SETLOCAL

REM -- Change to the directory of the executing batch file
CD %~dp0


rmdir /S /Q cygwin_release_gap\opt\gap
xcopy /E /Y /Q /C cygwin_build_gap\opt\gap cygwin_release_gap\opt\gap\

REM -- copy custom cygwin files
xcopy /E /Y /Q /C extra_cygwin_files\* cygwin_release_gap

REM -- copy cygstart to start, as various GAP packages use 'start'
REM -- to start external programs (as this is the command used to start commands
REM -- in the windows shell).
copy /Y cygwin_release_gap\bin\cygstart.exe cygwin_release_gap\bin\start.exe

REM - Clean up git repository (if present)
rmdir /S /Q cygwin_release_gap\opt\gap\.git

REM - Clean up package archive (if downloaded)
del /Q cygwin_release_gap\opt\gap\*.tar.gz

REM - Clean up any build script left lying around
del /S /Q cygwin_release_gap\script.sh

ENDLOCAL
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
SETLOCAL

REM -- Change to the directory of the executing batch file
CD %~dp0

copy /Y scripts\get_gap_head.sh gap_cygwin\
set arg1=%1
shift

copy /Y %arg1% cygwin_build_gap\script.sh

REM -- Jump into cygwin
REM -- Based on Cygwin.bat
setlocal enableextensions
set TERM=
cd /d gap_cygwin/bin && .\bash --login /get_gap_head.sh
cd /d cygwin_build_gap\bin && .\bash --login /script.sh



Expand Down
10 changes: 10 additions & 0 deletions NewWindows/shell_scripts/apply_gap_patches_for_cygwin.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env bash
cd /opt/gap

# This applies some small fixes to GAP

# Remove ExternalFilename from Packages
(cd pkg && find anupq-* grape-* -type f -print0 | xargs -0 sed -i '' -e 's/ExternalFilename/Filename/')

# Fix semigroups
(cd pkg && find semigroups-* -type f -print0 | xargs -0 sed -i '' -e 's/cygsemigroups-0.dll/cygsemigroups-1.dll/' )
8 changes: 8 additions & 0 deletions NewWindows/shell_scripts/build_gap_and_packages.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash
set -eux

cd /opt/gap

./configure
make -j4
(cd pkg && ../bin/BuildPackages.sh)
16 changes: 7 additions & 9 deletions NewWindows/shell_scripts/get_gap_head.sh
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
#!/usr/bin/env bash
set -eux
mkdir --parents /opt/gap
cd /opt/gap
if [ -d gap-master ]; then
(cd gap-master; git pull)
mkdir --parents /opt/
cd /opt/
if [ -d gap ]; then
(cd gap; git pull)
else
git clone https://www.github.com/gap-system/gap gap-master --depth=1
git clone https://www.github.com/gap-system/gap gap --depth=1
fi;
cd gap-master
cd gap
./autogen.sh
# Have to run configure so bootstrap-pkg-full works
./configure
make -j4
# Clean out old package directory, if it exists
rm -rf pkg
make bootstrap-pkg-full
cd pkg
../bin/BuildPackages.sh
16 changes: 16 additions & 0 deletions NewWindows/shell_scripts/get_gap_head_minimal.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env bash
set -eux
mkdir --parents /opt/
cd /opt/
if [ -d gap ]; then
(cd gap; git pull)
else
git clone https://www.github.com/gap-system/gap gap --depth=1
fi;
cd gap
./autogen.sh
# Have to run configure so bootstrap-pkg-full works
./configure
# Clean out old package directory, if it exists
rm -rf pkg
make bootstrap-pkg-minimal
9 changes: 9 additions & 0 deletions NewWindows/shell_scripts/get_gap_release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env bash
set -eux
mkdir --parents /opt/
cd /opt
wget https://www.gap-system.org/pub/gap/gap-4.11/tar.gz/gap-4.11.0.tar.gz
tar -xf gap-4.11.0.tar.gz
rm gap-4.11.0.tar.gz
# Have standard directory name
mv gap-* gap