Skip to content

Commit

Permalink
Merge pull request #178 from wilfwilson/fix-for-cygwin
Browse files Browse the repository at this point in the history
Fix Digraphs for cygwin
  • Loading branch information
james-d-mitchell authored Mar 18, 2019
2 parents e9f7e5b + 3c2c631 commit 6fce536
Show file tree
Hide file tree
Showing 7 changed files with 89 additions and 20 deletions.
51 changes: 51 additions & 0 deletions .appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# set clone depth
clone_depth: 1 # clone entire repository history if not defined

environment:
TEST_SUITE: test
PACKAGES: "latest"
SUITE: "test"
GAP: "master"
DIGRAPHS_LIB: "digraphs-lib-0.5"
SETUP: "appveyor"

# To test building GAP both using the bundled libraries (zlib and GMP), as
# well as using the versions distributed with cygwin, we do the former in
# the 32 bit build and the latter in the 64 bit build. But building zlib
# does not see to work if '--coverage' is used, so we only use that flag in
# the 64 bit build.
matrix:
#- CYG_ARCH: x86
# ABI: 32
# CYG_ROOT: C:\cygwin
# PKGS: "-P python27,python27-pip"
# PKG_FLAGS: "CFLAGS=-m32 CXXFLAGS=-m32 LDFLAGS=-m32 LOPTS=-m32"
- CYG_ARCH: x86_64
ABI: 64
CYG_ROOT: C:\cygwin64
PKGS: "-P libgmp-devel,zlib-devel,python27,python27-pip"

## change to packages-stable-X.Y.tar.gz in the stable branch
#cache:
# - packages-master.tar.gz

install:
- '%CYG_ROOT%\setup-%CYG_ARCH%.exe -qnNdO -R %CYG_ROOT% -s http://cygwin.mirror.constant.com -l %CYG_ROOT%/var/cache/setup %PKGS%'

# scripts that run after cloning repository
build_script:
# If there's a newer build queued for the same PR, cancel this one
- ps: if ($env:APPVEYOR_PULL_REQUEST_NUMBER -and $env:APPVEYOR_BUILD_NUMBER -ne ((Invoke-RestMethod `
https://ci.appveyor.com/api/projects/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG/history?recordsNumber=50).builds | `
Where-Object pullRequestId -eq $env:APPVEYOR_PULL_REQUEST_NUMBER)[0].buildNumber) { `
throw "There are newer queued builds for this pull request, failing early." }
- SET "PATH=%CYG_ROOT%\bin;%PATH%"
# $HOME=pwd=/home/appveyor
# $APPVEYOR_BUILD_FOLDER=C:\projects\digraphs
# $APPVEYOR_BUILD_FOLDER=/cygdrive/c/projects/digraphs
#- bash -lc "cd $APPVEYOR_BUILD_FOLDER && cd .. && export HOME=`pwd`"
- bash -lc "cd $APPVEYOR_BUILD_FOLDER && ./scripts/travis-build-dependencies.sh"
- bash -lc "cd $APPVEYOR_BUILD_FOLDER && ./scripts/travis-build-digraphs.sh"

test_script:
- bash -lc "cd $APPVEYOR_BUILD_FOLDER && ./scripts/travis-test.sh"
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ compiler:
env:
global:
- DIGRAPHS_LIB=digraphs-lib-0.5
- SETUP=travis

# GAP version: | master | stable-4.10 | stable-4.9 | required |
# ---------------+--------------+-------------+------------+--------------+
Expand Down
7 changes: 4 additions & 3 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ PLANAR_INCLUDE = -I$(top_srcdir)/@PLANARITY_SUITE_DIR@/
DIGRAPHS_INCLUDE = -I$(top_srcdir)/extern/

BINARCHDIR = bin/$(GAPARCH)
GAPINSTALLLIB = $(abs_top_srcdir)/$(BINARCHDIR)/
GAPINSTALLLIB = $(abs_top_srcdir)/$(BINARCHDIR)

lib_LTLIBRARIES = digraphs.la

Expand Down Expand Up @@ -80,9 +80,10 @@ all-local: digraphs.la
$(mkdir_p) $(top_srcdir)/$(BINARCHDIR) $(top_srcdir)/bin/lib
cp -RL @PLANARITY_SUITE_DIR@/.libs/* $(top_srcdir)/bin/lib/
if SYS_IS_CYGWIN
cp .libs/digraphs.dll $(GAPINSTALLLIB)
cp .libs/digraphs.dll $(GAPINSTALLLIB)/digraphs.so
cp bin/lib/cygplanarity-0.dll $(GAPROOT)/.libs
else
cp .libs/digraphs.so $(GAPINSTALLLIB)
cp .libs/digraphs.so $(GAPINSTALLLIB)/
endif
if KERNEL_DEBUG
@echo "SUCCESS (debug mode enabled)!"
Expand Down
7 changes: 3 additions & 4 deletions init.g
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,12 @@ if not IsBound(UserHomeExpand) then
fi;

# load kernel function if it is installed:
if (not IsBound(DIGRAPHS_C)) and ("digraphs" in SHOW_STAT()) then
if not IsBound(DIGRAPH_OUT_NBS) and "digraphs" in SHOW_STAT() then
# try static module
LoadStaticModule("digraphs");
fi;
if (not IsBound(DIGRAPHS_C)) and
(Filename(DirectoriesPackagePrograms("digraphs"), "digraphs.so") <> fail)
then
if not IsBound(DIGRAPH_OUT_NBS) and
Filename(DirectoriesPackagePrograms("digraphs"), "digraphs.so") <> fail then
LoadDynamicModule(Filename(DirectoriesPackagePrograms("digraphs"),
"digraphs.so"));
fi;
Expand Down
34 changes: 22 additions & 12 deletions scripts/travis-build-dependencies.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
#!/usr/bin/env bash

# If a command fails, exit this script with an error code
set -e

if ["$SUITE" != "test"] && ["$SUITE" != "coverage"] && ["$SUITE" != "lint"]; then
if [ "$SUITE" != "test" ] && [ "$SUITE" != "coverage" ] && [ "$SUITE" != "lint" ]; then
echo -e "\nError, unrecognised Travis suite: $SUITE"
exit 1
fi

mv ../Digraphs $HOME/digraphs
if [ "$SETUP" == "travis" ]; then
mv ../Digraphs $HOME/digraphs
fi

################################################################################
# Install software necessary for linting: cpplint and gaplint
Expand Down Expand Up @@ -35,6 +39,7 @@ echo -e "\nInstalling GAP..."
if [ "$GAP" == "required" ]; then
GAP=v`grep "GAPVERS" $HOME/digraphs/PackageInfo.g | awk -F'"' '{print $2}'`
fi
GAPROOT="$HOME/gap"
echo -e "\nInstalling GAP $GAP into $GAPROOT..."
git clone -b $GAP --depth=1 https://github.com/gap-system/gap.git $GAPROOT
cd $GAPROOT
Expand All @@ -44,8 +49,12 @@ make -j4
mkdir pkg

################################################################################
# Move Digraphs into its proper location
mv $HOME/digraphs $GAPROOT/pkg/digraphs
# Copy Digraphs to its proper location
if [ "$SETUP" == "appveyor" ]; then
cp -r /cygdrive/c/projects/digraphs $GAPROOT/pkg/digraphs
elif [ "$SETUP" == "travis" ]; then
mv $HOME/digraphs $GAPROOT/pkg/digraphs
fi

################################################################################
# Install grape, io, orb, and profiling
Expand All @@ -70,8 +79,8 @@ for PKG in "${PKGS[@]}"; do
tar xf $PKG-$VERSION.tar.gz && rm $PKG-$VERSION.tar.gz

if [ -f $PKG-$VERSION/configure ]; then
if [ "$PKG" == "orb" ]; then
cd $PKG-$VERSION && ./configure && make # orb doesn't accept package flags
if [ "$PKG" == "orb" ] || [ "$PKG" == "grape" ]; then
cd $PKG-$VERSION && ./configure && make # orb/grape don't accept flags
else
cd $PKG-$VERSION && ./configure $PKG_FLAGS && make
fi
Expand All @@ -87,9 +96,10 @@ tar xf packages-required-master.tar.gz
rm packages-required-master.tar.gz

################################################################################
# Install NautyTracesInterface
echo -e "\nGetting master version of NautyTracesInterface"
git clone -b master --depth=1 https://github.com/sebasguts/NautyTracesInterface.git $GAPROOT/pkg/nautytraces
cd $GAPROOT/pkg/nautytraces/nauty2*r* && ./configure $PKG_FLAGS && make
cd $GAPROOT/pkg/nautytraces && ./autogen.sh && ./configure $PKG_FLAGS && make

## Install NautyTracesInterface in Travis
if [ "$SETUP" == "travis" ]; then
echo -e "\nGetting master version of NautyTracesInterface"
git clone -b master --depth=1 https://github.com/sebasguts/NautyTracesInterface.git $GAPROOT/pkg/nautytraces
cd $GAPROOT/pkg/nautytraces/nauty2*r* && ./configure $PKG_FLAGS && make
cd $GAPROOT/pkg/nautytraces && ./autogen.sh && ./configure $PKG_FLAGS && make
fi
4 changes: 3 additions & 1 deletion scripts/travis-build-digraphs.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
#!/usr/bin/env bash

# If a command fails, exit this script with an error code
set -e

################################################################################
# Compile Digraphs and install Digraphs lib
if [ "$SUITE" != "lint" ]; then
echo -e "\nCompiling the Digraphs package..."
cd $GAPROOT/pkg/digraphs
cd $HOME/gap/pkg/digraphs
./autogen.sh
./configure $PKG_FLAGS
make
Expand Down
5 changes: 5 additions & 0 deletions scripts/travis-test.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
#!/usr/bin/env bash

# If a command fails, exit this script with an error code
set -e
set -o pipefail

GAPROOT=$HOME/gap
touch $GAPROOT/testlog.txt
TESTLOG="$GAPROOT/testlog.txt"
GAPSH="$GAPROOT/bin/gap.sh"
Expand Down Expand Up @@ -42,4 +45,6 @@ elif [ "$SUITE" == "test" ]; then
$GAPSH -A -x 80 -r -m 1g -T 2>&1 | tee -a $TESTLOG
fi

echo -e "\nSuite complete." # AppVeyor needs some extra command here (like this)

( ! grep -E "Diff|brk>|#E|Error|Errors detected|# WARNING|Syntax warning|Couldn't open saved workspace|insufficient|WARNING in|FAILED|Total errors found:" $TESTLOG )

0 comments on commit 6fce536

Please sign in to comment.