Skip to content

Commit

Permalink
Merge pull request #191 from yallop/appveyor-setup
Browse files Browse the repository at this point in the history
AppVeyor configuration (CI for Windows)
  • Loading branch information
yallop committed Oct 20, 2014
2 parents 3404c85 + 83e124a commit 3b6e9a7
Show file tree
Hide file tree
Showing 4 changed files with 134 additions and 1 deletion.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@ The documentation and source distribution contain more complex examples, involvi
* [Mailing list][mailing-list]
* [FAQ][faq]

[![Build Status](https://travis-ci.org/ocamllabs/ocaml-ctypes.svg?branch=master)](https://travis-ci.org/ocamllabs/ocaml-ctypes)
#### Build status:

AppVeyor: [![AppVeyor build status](https://ci.appveyor.com/api/projects/status/g6wg82jvn14hjy58/branch/master?svg=true)](https://ci.appveyor.com/project/yallop/ocaml-ctypes-982/branch/master)
Travis: [![Travis build Status](https://travis-ci.org/ocamllabs/ocaml-ctypes.svg?branch=master)](https://travis-ci.org/ocamllabs/ocaml-ctypes)

[rwo-19]: https://realworldocaml.org/v1/en/html/foreign-function-interface.html
[rwo]: http://realworldocaml.org/
Expand Down
34 changes: 34 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
platform:
- x64

environment:
global:
CYG_MIRROR: http://cygwin.uib.no
CYG_CACHE: C:/cygwin/var/cache/setup
matrix:
- CYG_ARCH: x86
CYG_ROOT: C:/cygwin
WODI_ARCH: 32
MINGW_ARCH: i686
- CYG_ARCH: x86_64
CYG_ROOT: C:/cygwin64
WODI_ARCH: 64
MINGW_ARCH: x86_64

init:
- 'echo System architecture: %PLATFORM%'

install:
- 'appveyor DownloadFile http://cygwin.com/setup-%CYG_ARCH%.exe -FileName setup.exe'
- 'setup.exe -qnNdO -R "%CYG_ROOT%" -s "%CYG_MIRROR%" -l "%CYG_CACHE%" -P wget -P dos2unix -P diffutils -P cpio -P make -P patch -P mingw64-%MINGW_ARCH%-gcc-core -P mingw64-%MINGW_ARCH%-gcc-g++ >NUL'
- '%CYG_ROOT%/bin/bash -lc "cygcheck -dc cygwin"'
- '%CYG_ROOT%/bin/bash -lc "wget -q http://ml.ignorelist.com/wodi/8/wodi%WODI_ARCH%.tar.xz -O /tmp/wodi%WODI_ARCH%.tar.xz"'
- '%CYG_ROOT%/bin/bash -lc "cd /tmp && rm -rf wodi%WODI_ARCH% && tar -xf wodi%WODI_ARCH%.tar.xz && bash wodi%WODI_ARCH%/install.sh"'
- '%CYG_ROOT%/bin/bash -lc "godi_add godi-ounit"'

build_script:
- '%CYG_ROOT%/bin/bash -lc "cd \"$OLDPWD\" && ./appveyor/build.sh"'

artifacts:
- path: test.log
name: test-logs
68 changes: 68 additions & 0 deletions appveyor/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
#!/usr/bin/env bash
set -ex

type -p ocamlc
ocamlc -version

x="$(uname -m)"
case "$x" in
x86_64)
build=x86_64-pc-cygwin
host=x86_64-w64-mingw32
MINGW_TOOL_PREFIX=x86_64-w64-mingw32-
;;
*)
build=i686-pc-cygwin
host=i686-w64-mingw32
MINGW_TOOL_PREFIX=i686-w64-mingw32-
;;
esac

export AR=${MINGW_TOOL_PREFIX}ar.exe
export AS=${MINGW_TOOL_PREFIX}as.exe
export CC=${MINGW_TOOL_PREFIX}gcc.exe
export CPP=${MINGW_TOOL_PREFIX}cpp.exe
export CPPFILT=${MINGW_TOOL_PREFIX}c++filt.exe
export CXX=${MINGW_TOOL_PREFIX}g++.exe
export DLLTOOL=${MINGW_TOOL_PREFIX}dlltool.exe
export DLLWRAP=${MINGW_TOOL_PREFIX}dllwrap.exe
export GCOV=${MINGW_TOOL_PREFIX}gcov.exe
export LD=${MINGW_TOOL_PREFIX}ld.exe
export NM=${MINGW_TOOL_PREFIX}nm.exe
export OBJCOPY=${MINGW_TOOL_PREFIX}objcopy.exe
export OBJDUMP=${MINGW_TOOL_PREFIX}objdump.exe
export RANLIB=${MINGW_TOOL_PREFIX}ranlib.exe
export RC=${MINGW_TOOL_PREFIX}windres.exe
export READELF=${MINGW_TOOL_PREFIX}readelf.exe
export SIZE=${MINGW_TOOL_PREFIX}size.exe
export STRINGS=${MINGW_TOOL_PREFIX}strip.exe
export STRIP=${MINGW_TOOL_PREFIX}strip.exe
export WINDMC=${MINGW_TOOL_PREFIX}windmc.exe
export WINDRES=${MINGW_TOOL_PREFIX}windres.exe

# findlib is already installed

# libffi: we need a static version and only a static version
(
rm -rf /usr/local
mkdir -p /usr/local/include
wget ftp://sourceware.org/pub/libffi/libffi-3.1.tar.gz
rm -rf libffi-3.1
tar xfvz libffi-3.1.tar.gz
cd libffi-3.1
(./configure --build="$build" --host="$host" --prefix /usr/local --disable-shared --enable-static </dev/null && make </dev/null && make install </dev/null) || cat config.log
mkdir -p /usr/local/include/
ln -s -t /usr/local/include/ /usr/local/lib/libffi-3.1/include/*
)

export LIBFFI_CFLAGS="-I/usr/local/include"
export LIBFFI_LIBS="-L/usr/local/lib -lffi"

touch setup.data
make distclean || true
rm -f setup.data
make all
if ! make -k test &>test.log ; then
echo "test case failure" >&2
exit 1
fi
28 changes: 28 additions & 0 deletions appveyor/findlib-patch-create-process.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
diff --git a/findlib-1.5.3/src/findlib/frontend.ml b/findlib-1.5.3/src/findlib/frontend.ml
index 1fdb117..bf09ce9 100644
--- a/findlib-1.5.3/src/findlib/frontend.ml
+++ b/findlib-1.5.3/src/findlib/frontend.ml
@@ -384,13 +384,8 @@ let run_command ?filter verbose cmd args =
let () = prerr_endline ("Findlib_config.system : " ^ Findlib_config.system) in
let () = prerr_endline ("fixed_cmd : " ^ fixed_cmd) in

- let pid =
- Unix.create_process
- fixed_cmd
- (Array.of_list (cmd :: args))
- Unix.stdin
- cmd_output
- Unix.stderr
+ let status =
+ Unix.system (Printf.sprintf "%s %s" fixed_cmd (String.concat " " args))
in

begin match filter with
@@ -414,7 +409,6 @@ let run_command ?filter verbose cmd args =
| None -> ()
end;

- let (_,status) = Unix.waitpid [] pid in
Sys.set_signal Sys.sigint old_sigint;
begin
match status with

0 comments on commit 3b6e9a7

Please sign in to comment.