Skip to content

Commit 6fce536

Browse files
Merge pull request #178 from wilfwilson/fix-for-cygwin
Fix Digraphs for cygwin
2 parents e9f7e5b + 3c2c631 commit 6fce536

File tree

7 files changed

+89
-20
lines changed

7 files changed

+89
-20
lines changed

.appveyor.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# set clone depth
2+
clone_depth: 1 # clone entire repository history if not defined
3+
4+
environment:
5+
TEST_SUITE: test
6+
PACKAGES: "latest"
7+
SUITE: "test"
8+
GAP: "master"
9+
DIGRAPHS_LIB: "digraphs-lib-0.5"
10+
SETUP: "appveyor"
11+
12+
# To test building GAP both using the bundled libraries (zlib and GMP), as
13+
# well as using the versions distributed with cygwin, we do the former in
14+
# the 32 bit build and the latter in the 64 bit build. But building zlib
15+
# does not see to work if '--coverage' is used, so we only use that flag in
16+
# the 64 bit build.
17+
matrix:
18+
#- CYG_ARCH: x86
19+
# ABI: 32
20+
# CYG_ROOT: C:\cygwin
21+
# PKGS: "-P python27,python27-pip"
22+
# PKG_FLAGS: "CFLAGS=-m32 CXXFLAGS=-m32 LDFLAGS=-m32 LOPTS=-m32"
23+
- CYG_ARCH: x86_64
24+
ABI: 64
25+
CYG_ROOT: C:\cygwin64
26+
PKGS: "-P libgmp-devel,zlib-devel,python27,python27-pip"
27+
28+
## change to packages-stable-X.Y.tar.gz in the stable branch
29+
#cache:
30+
# - packages-master.tar.gz
31+
32+
install:
33+
- '%CYG_ROOT%\setup-%CYG_ARCH%.exe -qnNdO -R %CYG_ROOT% -s http://cygwin.mirror.constant.com -l %CYG_ROOT%/var/cache/setup %PKGS%'
34+
35+
# scripts that run after cloning repository
36+
build_script:
37+
# If there's a newer build queued for the same PR, cancel this one
38+
- ps: if ($env:APPVEYOR_PULL_REQUEST_NUMBER -and $env:APPVEYOR_BUILD_NUMBER -ne ((Invoke-RestMethod `
39+
https://ci.appveyor.com/api/projects/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG/history?recordsNumber=50).builds | `
40+
Where-Object pullRequestId -eq $env:APPVEYOR_PULL_REQUEST_NUMBER)[0].buildNumber) { `
41+
throw "There are newer queued builds for this pull request, failing early." }
42+
- SET "PATH=%CYG_ROOT%\bin;%PATH%"
43+
# $HOME=pwd=/home/appveyor
44+
# $APPVEYOR_BUILD_FOLDER=C:\projects\digraphs
45+
# $APPVEYOR_BUILD_FOLDER=/cygdrive/c/projects/digraphs
46+
#- bash -lc "cd $APPVEYOR_BUILD_FOLDER && cd .. && export HOME=`pwd`"
47+
- bash -lc "cd $APPVEYOR_BUILD_FOLDER && ./scripts/travis-build-dependencies.sh"
48+
- bash -lc "cd $APPVEYOR_BUILD_FOLDER && ./scripts/travis-build-digraphs.sh"
49+
50+
test_script:
51+
- bash -lc "cd $APPVEYOR_BUILD_FOLDER && ./scripts/travis-test.sh"

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ compiler:
1010
env:
1111
global:
1212
- DIGRAPHS_LIB=digraphs-lib-0.5
13+
- SETUP=travis
1314

1415
# GAP version: | master | stable-4.10 | stable-4.9 | required |
1516
# ---------------+--------------+-------------+------------+--------------+

Makefile.am

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ PLANAR_INCLUDE = -I$(top_srcdir)/@PLANARITY_SUITE_DIR@/
1313
DIGRAPHS_INCLUDE = -I$(top_srcdir)/extern/
1414

1515
BINARCHDIR = bin/$(GAPARCH)
16-
GAPINSTALLLIB = $(abs_top_srcdir)/$(BINARCHDIR)/
16+
GAPINSTALLLIB = $(abs_top_srcdir)/$(BINARCHDIR)
1717

1818
lib_LTLIBRARIES = digraphs.la
1919

@@ -80,9 +80,10 @@ all-local: digraphs.la
8080
$(mkdir_p) $(top_srcdir)/$(BINARCHDIR) $(top_srcdir)/bin/lib
8181
cp -RL @PLANARITY_SUITE_DIR@/.libs/* $(top_srcdir)/bin/lib/
8282
if SYS_IS_CYGWIN
83-
cp .libs/digraphs.dll $(GAPINSTALLLIB)
83+
cp .libs/digraphs.dll $(GAPINSTALLLIB)/digraphs.so
84+
cp bin/lib/cygplanarity-0.dll $(GAPROOT)/.libs
8485
else
85-
cp .libs/digraphs.so $(GAPINSTALLLIB)
86+
cp .libs/digraphs.so $(GAPINSTALLLIB)/
8687
endif
8788
if KERNEL_DEBUG
8889
@echo "SUCCESS (debug mode enabled)!"

init.g

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,12 @@ if not IsBound(UserHomeExpand) then
1414
fi;
1515

1616
# load kernel function if it is installed:
17-
if (not IsBound(DIGRAPHS_C)) and ("digraphs" in SHOW_STAT()) then
17+
if not IsBound(DIGRAPH_OUT_NBS) and "digraphs" in SHOW_STAT() then
1818
# try static module
1919
LoadStaticModule("digraphs");
2020
fi;
21-
if (not IsBound(DIGRAPHS_C)) and
22-
(Filename(DirectoriesPackagePrograms("digraphs"), "digraphs.so") <> fail)
23-
then
21+
if not IsBound(DIGRAPH_OUT_NBS) and
22+
Filename(DirectoriesPackagePrograms("digraphs"), "digraphs.so") <> fail then
2423
LoadDynamicModule(Filename(DirectoriesPackagePrograms("digraphs"),
2524
"digraphs.so"));
2625
fi;

scripts/travis-build-dependencies.sh

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
1+
#!/usr/bin/env bash
2+
13
# If a command fails, exit this script with an error code
24
set -e
35

4-
if ["$SUITE" != "test"] && ["$SUITE" != "coverage"] && ["$SUITE" != "lint"]; then
6+
if [ "$SUITE" != "test" ] && [ "$SUITE" != "coverage" ] && [ "$SUITE" != "lint" ]; then
57
echo -e "\nError, unrecognised Travis suite: $SUITE"
68
exit 1
79
fi
810

9-
mv ../Digraphs $HOME/digraphs
11+
if [ "$SETUP" == "travis" ]; then
12+
mv ../Digraphs $HOME/digraphs
13+
fi
1014

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

4651
################################################################################
47-
# Move Digraphs into its proper location
48-
mv $HOME/digraphs $GAPROOT/pkg/digraphs
52+
# Copy Digraphs to its proper location
53+
if [ "$SETUP" == "appveyor" ]; then
54+
cp -r /cygdrive/c/projects/digraphs $GAPROOT/pkg/digraphs
55+
elif [ "$SETUP" == "travis" ]; then
56+
mv $HOME/digraphs $GAPROOT/pkg/digraphs
57+
fi
4958

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

7281
if [ -f $PKG-$VERSION/configure ]; then
73-
if [ "$PKG" == "orb" ]; then
74-
cd $PKG-$VERSION && ./configure && make # orb doesn't accept package flags
82+
if [ "$PKG" == "orb" ] || [ "$PKG" == "grape" ]; then
83+
cd $PKG-$VERSION && ./configure && make # orb/grape don't accept flags
7584
else
7685
cd $PKG-$VERSION && ./configure $PKG_FLAGS && make
7786
fi
@@ -87,9 +96,10 @@ tar xf packages-required-master.tar.gz
8796
rm packages-required-master.tar.gz
8897

8998
################################################################################
90-
# Install NautyTracesInterface
91-
echo -e "\nGetting master version of NautyTracesInterface"
92-
git clone -b master --depth=1 https://github.com/sebasguts/NautyTracesInterface.git $GAPROOT/pkg/nautytraces
93-
cd $GAPROOT/pkg/nautytraces/nauty2*r* && ./configure $PKG_FLAGS && make
94-
cd $GAPROOT/pkg/nautytraces && ./autogen.sh && ./configure $PKG_FLAGS && make
95-
99+
## Install NautyTracesInterface in Travis
100+
if [ "$SETUP" == "travis" ]; then
101+
echo -e "\nGetting master version of NautyTracesInterface"
102+
git clone -b master --depth=1 https://github.com/sebasguts/NautyTracesInterface.git $GAPROOT/pkg/nautytraces
103+
cd $GAPROOT/pkg/nautytraces/nauty2*r* && ./configure $PKG_FLAGS && make
104+
cd $GAPROOT/pkg/nautytraces && ./autogen.sh && ./configure $PKG_FLAGS && make
105+
fi

scripts/travis-build-digraphs.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1+
#!/usr/bin/env bash
2+
13
# If a command fails, exit this script with an error code
24
set -e
35

46
################################################################################
57
# Compile Digraphs and install Digraphs lib
68
if [ "$SUITE" != "lint" ]; then
79
echo -e "\nCompiling the Digraphs package..."
8-
cd $GAPROOT/pkg/digraphs
10+
cd $HOME/gap/pkg/digraphs
911
./autogen.sh
1012
./configure $PKG_FLAGS
1113
make

scripts/travis-test.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1+
#!/usr/bin/env bash
2+
13
# If a command fails, exit this script with an error code
24
set -e
35
set -o pipefail
46

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

48+
echo -e "\nSuite complete." # AppVeyor needs some extra command here (like this)
49+
4550
( ! 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 commit comments

Comments
 (0)