Skip to content

Quickly getting a working copy of Semigroups

James Mitchell edited this page Jun 16, 2021 · 33 revisions

The following script should clone and fully compile GAP, the master branch of the Semigroups package and all of its dependencies. It's verified working on Debian Testing, as of 2016-05-29, and Mac OS 11.3.1, as of 2021-06-16. It will clone the master branch (change master to your preferred branch if you want a different one), which contains an interface to the C++ library libsemigroups.

Some software is required on the target computer for everything to work. This includes: git, autoconf, curl, GMP, a C/C++ compiler, graphviz, LaTeX, libtool, and make.

If you're using a Linux distribution with APT (e.g. Debian/Ubuntu/Mint) then the following command should automatically install all the software you need (texlive-full might take a while):

sudo apt-get install autoconf build-essential curl git graphviz libtool libgmp-dev texlive-full

If you're using a Mac, and have brew installed, then this command should install a lot of what you need (though maybe not everything):

brew install git autoconf automake curl GMP graphviz libtool

Once you have all the right software installed, run this script or copy and paste the following lines into your terminal:

#!/bin/bash
set -e

GAP_BRANCH=master
LIBSEMIGROUPS_BRANCH=v1.3.7
GAPDOC=1.6.4
GITHUB=https://github.com

CURL="curl --connect-timeout 5 --max-time 10 --retry 5 --retry-delay 0 --retry-max-time 40 -L"

bold() {
    printf "\033[1m%s\033[0m\n" "$*"
}

start_dim() {
    printf "\033[2m";
}

stop_dim() {
    printf "\033[0m";
}

# Download GAP
URL=$GITHUB/gap-system/gap.git
bold "Cloning GAP from: $URL" 
start_dim
git clone --depth=1 -b "$GAP_BRANCH" "$URL"
cd gap
mkdir pkg
cd pkg
stop_dim

# Clone Semigroups
URL=$GITHUB/semigroups/Semigroups.git
bold "Cloning Semigroups package repo from: $URL" 
start_dim
git clone --depth=1 --branch=master "$URL" semigroups
stop_dim

# Clone libsemigroups
URL="$GITHUB/libsemigroups/libsemigroups.git"
bold "Cloning libsemigroups package repo from: $URL" 
start_dim
cd semigroups
git clone --depth=1 -b "$LIBSEMIGROUPS_BRANCH" "$URL"
cd ..
stop_dim

# Download GAPDoc
URL="https://github.com/frankluebeck/GAPDoc/archive/relv$GAPDOC.tar.gz"
bold "Downloading GAPDOC from: $URL"
start_dim
$CURL $URL -o "relv$GAPDOC.tar.gz" 
tar xzf "relv$GAPDOC.tar.gz"
rm "relv$GAPDOC.tar.gz"
stop_dim

# Clone primgrp
URL="$GITHUB/gap-packages/primgrp.git"
bold "Cloning primgrp from: $URL"
start_dim
git clone --depth=1 "$URL"
stop_dim

# Clone smallgrp
URL="$GITHUB/gap-packages/smallgrp.git"
bold "Cloning smallgrp from: $URL"
start_dim
git clone --depth=1 "$URL"
stop_dim

# Clone smallgrp
URL="$GITHUB/hulpke/transgrp.git"
bold "Cloning transgrp from: $URL"
start_dim
git clone --depth=1 "$URL"
stop_dim
 
# Clone packageman
URL="$GITHUB/gap-packages/packagemanager.git"
bold "Cloning packagemanager from: $URL"
start_dim
git clone --depth=1 "$URL"
cd .. # out of pkg dir
stop_dim

# Compile GAP
bold "Compiling GAP . . ." 
start_dim
./autogen.sh
./configure
make
stop_dim

# Compile Semigroups
bold "Compiling Semigroups . . ." 
start_dim
cd pkg/semigroups
./autogen.sh
./configure
make -j8
cd ../..
stop_dim

# Install Semigroups dependencies using PackageMan!
INSTALL_PKGS="if not InstallPackage(\"digraphs\", false) then QuitGap(1); fi;"
INSTALL_PKGS+="if not InstallPackage(\"io\", false) then QuitGap(1); fi;"
INSTALL_PKGS+="if not InstallPackage(\"orb\", false) then QuitGap(1); fi;"
INSTALL_PKGS+="if not CompilePackage(\"orb\") then QuitGap(1); fi;"
INSTALL_PKGS+="if not InstallPackage(\"genss\", false) then QuitGap(1); fi;"
INSTALL_PKGS+="if not InstallPackage(\"images\", false) then QuitGap(1); fi;"

echo "LoadPackage(\"PackageManager\"); InstallPackage(\"PackageManager\", false); \
      $INSTALL_PKGS QUIT;" | bin/gap.sh -A -T || exit 1

# Make manuals
make manuals

echo "LoadPackage(\"digraphs\", false); DigraphsMakeDoc(); \
      LoadPackage(\"semigroups\", false); SemigroupsMakeDoc(); \
      quit; quit;" | bin/gap.sh -A - T || exit 1
Clone this wiki locally