From 7681165c7e7e704d044847dfddaf0a9a749f982e Mon Sep 17 00:00:00 2001 From: Chris Jefferson Date: Thu, 26 Mar 2020 09:31:40 +0000 Subject: [PATCH 1/2] Continue working on windows build script --- NewWindows/Readme.md | 43 ++++++++++++++-- NewWindows/build_gap_release.bat | 20 ++++++++ NewWindows/build_installer.bat | 10 ++++ NewWindows/cygwin_install.bat | 26 +++++----- NewWindows/extra_cygwin_files/etc/fstab | 11 ++++ .../extra_cygwin_files/etc/nsswitch.conf | 2 + NewWindows/extra_cygwin_files/gap-mintty.bat | 4 ++ NewWindows/extra_cygwin_files/gap.bat | 4 ++ .../extra_cygwin_files/run-gap-mintty.sh | 10 ++++ NewWindows/extra_cygwin_files/run-gap.sh | 5 ++ NewWindows/gap.iss | 50 +++++++++++++++++++ NewWindows/move_gap_to_release.bat | 27 ++++++++++ ..._gap_head.bat => run_script_in_cygwin.bat} | 9 ++-- .../apply_gap_patches_for_cygwin.sh | 10 ++++ .../shell_scripts/build_gap_and_packages.sh | 8 +++ NewWindows/shell_scripts/get_gap_head.sh | 16 +++--- .../shell_scripts/get_gap_head_minimal.sh | 16 ++++++ NewWindows/shell_scripts/get_gap_release.sh | 9 ++++ 18 files changed, 251 insertions(+), 29 deletions(-) create mode 100644 NewWindows/build_gap_release.bat create mode 100644 NewWindows/build_installer.bat create mode 100644 NewWindows/extra_cygwin_files/etc/fstab create mode 100644 NewWindows/extra_cygwin_files/etc/nsswitch.conf create mode 100644 NewWindows/extra_cygwin_files/gap-mintty.bat create mode 100644 NewWindows/extra_cygwin_files/gap.bat create mode 100644 NewWindows/extra_cygwin_files/run-gap-mintty.sh create mode 100644 NewWindows/extra_cygwin_files/run-gap.sh create mode 100644 NewWindows/gap.iss create mode 100644 NewWindows/move_gap_to_release.bat rename NewWindows/{get_gap_head.bat => run_script_in_cygwin.bat} (57%) create mode 100644 NewWindows/shell_scripts/apply_gap_patches_for_cygwin.sh create mode 100644 NewWindows/shell_scripts/build_gap_and_packages.sh create mode 100644 NewWindows/shell_scripts/get_gap_head_minimal.sh create mode 100644 NewWindows/shell_scripts/get_gap_release.sh diff --git a/NewWindows/Readme.md b/NewWindows/Readme.md index 17ed716..df60997 100644 --- a/NewWindows/Readme.md +++ b/NewWindows/Readme.md @@ -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 diff --git a/NewWindows/build_gap_release.bat b/NewWindows/build_gap_release.bat new file mode 100644 index 0000000..c12a876 --- /dev/null +++ b/NewWindows/build_gap_release.bat @@ -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 \ No newline at end of file diff --git a/NewWindows/build_installer.bat b/NewWindows/build_installer.bat new file mode 100644 index 0000000..0bc8ab7 --- /dev/null +++ b/NewWindows/build_installer.bat @@ -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 diff --git a/NewWindows/cygwin_install.bat b/NewWindows/cygwin_install.bat index 6675a59..0d9df3d 100644 --- a/NewWindows/cygwin_install.bat +++ b/NewWindows/cygwin_install.bat @@ -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 diff --git a/NewWindows/extra_cygwin_files/etc/fstab b/NewWindows/extra_cygwin_files/etc/fstab new file mode 100644 index 0000000..da8f03c --- /dev/null +++ b/NewWindows/extra_cygwin_files/etc/fstab @@ -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 \ No newline at end of file diff --git a/NewWindows/extra_cygwin_files/etc/nsswitch.conf b/NewWindows/extra_cygwin_files/etc/nsswitch.conf new file mode 100644 index 0000000..32ec124 --- /dev/null +++ b/NewWindows/extra_cygwin_files/etc/nsswitch.conf @@ -0,0 +1,2 @@ +# /etc/nsswitch.conf +db_home: /%H diff --git a/NewWindows/extra_cygwin_files/gap-mintty.bat b/NewWindows/extra_cygwin_files/gap-mintty.bat new file mode 100644 index 0000000..149d994 --- /dev/null +++ b/NewWindows/extra_cygwin_files/gap-mintty.bat @@ -0,0 +1,4 @@ +@echo off +setlocal enableextensions +set TERM= +cd /d "%~dp0bin" && mintty.exe -s 120,40 .\bash --login /run-gap-mintty.sh diff --git a/NewWindows/extra_cygwin_files/gap.bat b/NewWindows/extra_cygwin_files/gap.bat new file mode 100644 index 0000000..bfc4130 --- /dev/null +++ b/NewWindows/extra_cygwin_files/gap.bat @@ -0,0 +1,4 @@ +@echo off +setlocal enableextensions +set TERM= +cd /d "%~dp0bin" && .\bash --login /run-gap.sh diff --git a/NewWindows/extra_cygwin_files/run-gap-mintty.sh b/NewWindows/extra_cygwin_files/run-gap-mintty.sh new file mode 100644 index 0000000..384b1e6 --- /dev/null +++ b/NewWindows/extra_cygwin_files/run-gap-mintty.sh @@ -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 \ No newline at end of file diff --git a/NewWindows/extra_cygwin_files/run-gap.sh b/NewWindows/extra_cygwin_files/run-gap.sh new file mode 100644 index 0000000..c605314 --- /dev/null +++ b/NewWindows/extra_cygwin_files/run-gap.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +cd ~ + +/opt/gap/gap diff --git a/NewWindows/gap.iss b/NewWindows/gap.iss new file mode 100644 index 0000000..26daea8 --- /dev/null +++ b/NewWindows/gap.iss @@ -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 + diff --git a/NewWindows/move_gap_to_release.bat b/NewWindows/move_gap_to_release.bat new file mode 100644 index 0000000..d85e16c --- /dev/null +++ b/NewWindows/move_gap_to_release.bat @@ -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 diff --git a/NewWindows/get_gap_head.bat b/NewWindows/run_script_in_cygwin.bat similarity index 57% rename from NewWindows/get_gap_head.bat rename to NewWindows/run_script_in_cygwin.bat index 7dd1803..63e4fca 100644 --- a/NewWindows/get_gap_head.bat +++ b/NewWindows/run_script_in_cygwin.bat @@ -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 diff --git a/NewWindows/shell_scripts/apply_gap_patches_for_cygwin.sh b/NewWindows/shell_scripts/apply_gap_patches_for_cygwin.sh new file mode 100644 index 0000000..5f51e53 --- /dev/null +++ b/NewWindows/shell_scripts/apply_gap_patches_for_cygwin.sh @@ -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/' ) \ No newline at end of file diff --git a/NewWindows/shell_scripts/build_gap_and_packages.sh b/NewWindows/shell_scripts/build_gap_and_packages.sh new file mode 100644 index 0000000..8633a07 --- /dev/null +++ b/NewWindows/shell_scripts/build_gap_and_packages.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash +set -eux + +cd /opt/gap + +./configure +make -j4 +(cd pkg && ../bin/BuildPackages.sh) \ No newline at end of file diff --git a/NewWindows/shell_scripts/get_gap_head.sh b/NewWindows/shell_scripts/get_gap_head.sh index 817b8f4..ee5d56b 100644 --- a/NewWindows/shell_scripts/get_gap_head.sh +++ b/NewWindows/shell_scripts/get_gap_head.sh @@ -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 \ No newline at end of file diff --git a/NewWindows/shell_scripts/get_gap_head_minimal.sh b/NewWindows/shell_scripts/get_gap_head_minimal.sh new file mode 100644 index 0000000..6351af2 --- /dev/null +++ b/NewWindows/shell_scripts/get_gap_head_minimal.sh @@ -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 diff --git a/NewWindows/shell_scripts/get_gap_release.sh b/NewWindows/shell_scripts/get_gap_release.sh new file mode 100644 index 0000000..4ac424d --- /dev/null +++ b/NewWindows/shell_scripts/get_gap_release.sh @@ -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 \ No newline at end of file From fa76cf0a92490c4092c75d1622594350a2e7bca9 Mon Sep 17 00:00:00 2001 From: Chris Jefferson Date: Tue, 16 Feb 2021 11:01:21 +0000 Subject: [PATCH 2/2] Set shell scripts to have linux line endings --- .gitattributes | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..8a70181 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +# Make sure shell scripts have linux line endings +*.sh binary \ No newline at end of file