Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[For discussion] Automated Travis CI (OS X) and Docker (Linux) builds #14

Closed
wants to merge 48 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
754ee9a
Fix the CURL download lines
Mar 17, 2015
19cbfc7
First attempt at a Docker base image configuration
Mar 17, 2015
db69e63
Fix reference to install script in Dockerfile
Mar 17, 2015
154fc44
Add project dir to path in Dockerfile
Mar 17, 2015
beb2994
Nope, do it the way the README does it
Mar 17, 2015
9c12755
Fix which clang+llvm version is used on Docker
Mar 17, 2015
f8692c4
Install curl before script runs on docker
Mar 17, 2015
6c5321a
Extract platform-specific LLVM install to Dockerfile
Mar 17, 2015
bd06d9a
First attempt at a Travis CI configuration
Mar 17, 2015
fc07030
Install cabal before running script on Travis
Mar 17, 2015
6e294b6
Add working dir to PATH on travis ci, just as readme says
Mar 17, 2015
4e1e831
Define $TARGET_LD variable in the i386 ld script to avoid exec errors
Mar 19, 2015
8381025
Merge branch 'refs/heads/master' into docker-builds
Mar 19, 2015
42edf59
Print where g++/gcc are coming from, maybe we could remove them
Mar 24, 2015
da256a3
Check homebrew status of gcc in travis environment
Mar 24, 2015
11b9698
Uninstall brew’s gcc to stop make scripts using it
Mar 24, 2015
eae4f41
Print more info about gcc on travis
Mar 24, 2015
d64c15c
Remove offending jobs: bit like readme says
Mar 26, 2015
5b26c67
Try to remove the ncpus line more precisely on travis
Mar 26, 2015
8f0bfac
Try supplying a cabal config that *we* control on travis
Mar 29, 2015
3c08bce
Create ~/.cabal/config before trying to edit it on travis
Mar 29, 2015
4923c0e
See if we can access the cabal config on travis before changing it
Mar 29, 2015
f287ee2
Try to stop YAML processing of the sed command on travis
Mar 29, 2015
b7b459a
Quote the whole sed command on travis
Mar 29, 2015
a436212
Try rolling back ghc to 7.8.2 as in bug reports
Mar 29, 2015
2b46e97
Revert "Try rolling back ghc to 7.8.2 as in bug reports"
Mar 29, 2015
e2cd155
Print ghc and cabal versions for debug on travis
Mar 29, 2015
5defa8c
Readme never mentions installing ghc beforehand…
Apr 6, 2015
adbdd65
Log OSX version on Travis
Apr 6, 2015
997597e
Try compiling anything with the regular brew GHC on travis
Apr 6, 2015
995520f
Try pinning min OS X version in CFLAGS for travis
Apr 6, 2015
3873c8d
Revert "Try pinning min OS X version in CFLAGS for travis"
Apr 6, 2015
dd94e20
Update brew in travis to pick up newer GHC package(?)
Apr 6, 2015
9ec2ac6
See if baseline GHC is using the LLVM back end
Apr 6, 2015
00e0af4
Find out if we already have an acceptable LLVM on Travis
Apr 6, 2015
265403c
Stop invoking LLVM backend of baseline GHC on Travis
Apr 6, 2015
f2c352a
Use more generic check for LLVM compiler in shell script
Apr 6, 2015
ae317c2
Fix the LLVM check again
Apr 6, 2015
d66ae1f
Try clang+llvm from home-brew
Apr 6, 2015
8e09df8
Revert "Try clang+llvm from home-brew"
Apr 6, 2015
c8b3d62
Don’t alias opt and llc to non existent places
Apr 6, 2015
7bb9b82
Merge branch 'master' of https://github.com/ghc-ios/ghc-ios-scripts
May 15, 2015
f223e21
Get i386-apple-darwin11-ld closer to upstream master
May 15, 2015
8f8b14e
Merge branch 'master' into docker-builds
May 15, 2015
b3a39ec
Another go with CFLAGS
May 15, 2015
515ccc1
GHC ./configure looks for CPPFLAGS not CXXFLAGS
May 15, 2015
c1573f4
Try using vanilla GHC with custom ./configure args
May 15, 2015
130ce9d
Enable + tweat build.mk file in vanilla GHC build
May 15, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
language: objective-c

# Log build system information (illegal instruction errors are fickle)
# Get Cabal
# Trigger creation of ~/.cabal/config by running a cabal command
# Remove the cabal config containing $ncpus a la readme
# Get LLVM 3.0
# Add to the PATH
# Try compiling the hello world example with the baseline x64-class GHC
# (and check that it has the LLVM back end, GCC back end is no good
# for cross compiling to ARM)
before_install:
- pwd
- sw_vers
- brew update
- brew install ghc cabal-install
- cabal update
- cat ~/.cabal/config
- "sed -i '' '/jobs: $ncpus/d' ~/.cabal/config"
- cat ~/.cabal/config
- echo -e "\nPATH=`pwd`:"'$PATH' >> ~/.profile
- cat ~/.profile
- PATH=`pwd`:$PATH
- echo $PATH
- ghc --version
- cabal -V
- llvm-gcc --version
- ghc -v .travis/helloworld.hs

# Due to PATH alterations the preceding ./ is in theory unnecessary.
install: installGHCiOS.sh

# Try compiling a hello world Haskell file
# to see if ghc-ios is working.
script: ghc-ios -v .travis/helloworld.hs
78 changes: 78 additions & 0 deletions .travis/cabal-config
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
-- This is the configuration file for the 'cabal' command line tool.

-- The available configuration options are listed below.
-- Some of them have default values listed.

-- Lines (like this one) beginning with '--' are comments.
-- Be careful with spaces and indentation because they are
-- used to indicate layout for nested sections.

-- Cabal library version: 1.22.1.0
-- cabal-install version: 1.22.0.1


-- require-sandbox: False
-- ignore-sandbox: False
remote-repo: hackage.haskell.org:http://hackage.haskell.org/packages/archive
-- remote-repo-cache: /Users/travis/.cabal/packages
-- local-repo:
-- logs-dir:
-- world-file: /Users/travis/.cabal/world
-- verbose: 1
-- compiler: ghc
-- with-compiler:
-- with-hc-pkg:
-- program-prefix:
-- program-suffix:
-- library-vanilla: True
-- library-profiling:
-- shared:
-- executable-dynamic: False
-- profiling:
-- executable-profiling:
-- optimization: True
-- debug-info: False
-- library-for-ghci:
-- split-objs: False
-- executable-stripping: True
-- library-stripping: True
-- configure-option:
-- user-install: True
-- package-db:
-- flags:
-- extra-include-dirs:
-- extra-lib-dirs:
-- extra-prog-path: /Users/travis/.cabal/bin
-- instantiate-with:
-- tests: False
-- coverage: False
-- library-coverage:
-- exact-configuration: False
-- benchmarks: False
-- relocatable: False
-- cabal-lib-version:
-- constraint:
-- preference:
-- solver: choose
-- allow-newer: False
-- documentation: False
-- doc-index-file: $datadir/doc/$arch-$os-$compiler/index.html
-- max-backjumps: 2000
-- reorder-goals: False
-- shadow-installed-packages: False
-- strong-flags: False
-- reinstall: False
-- avoid-reinstalls: False
-- force-reinstalls: False
-- upgrade-dependencies: False
-- root-cmd:
-- symlink-bindir:
-- build-summary: /Users/travis/.cabal/logs/build.log
-- build-log:
remote-build-reporting: anonymous
-- report-planning-failure: False
-- one-shot: False
-- run-tests:
-- username:
-- password:

4 changes: 4 additions & 0 deletions .travis/helloworld.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module Main
where

main=putStrLn "Hello, World!"
39 changes: 39 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
###
# This compiles a Docker base image of the ghc-ios compiler.
# This would be useful for downstream projects that want a Haskell platform Docker base
# image which supports iOS cross-compilation, to avoid having to install ghc-ios in their
# own project-specific Docker images.
###

# Preinstall regular Haskell platform
FROM haskell:7.8

MAINTAINER Chris Kilding <[email protected]>

# Add current repo contents
# Mirror the workdir structure suggested from the README,
# but we cannot use relative paths in a Dockerfile ADD command,
# so must use the absolute /usr top level directory.
ADD . /usr/bin/ghc-ios-scripts
WORKDIR /usr/bin/ghc-ios-scripts

# Add the project directory to the path
RUN echo -e "\nPATH=/usr/bin/ghc-ios-scripts:"'$PATH' >> ~/.profile
RUN PATH=/usr/bin/ghc-ios-scripts:$PATH

# Need CURL on the system for the script to work
RUN apt-get update
RUN apt-get -y install curl

# Get LLVM 3.0 for the target platform
# On the Haskell Docker base image (which is Debian Wheezy based)
# we need the Debian version of clang+llvm
RUN curl -O http://llvm.org/releases/3.0/clang+llvm-3.0-x86_64-linux-debian.tar.gz
RUN tar xvf clang+llvm-3.0-x86_64-linux-debian.tar.gz
RUN mv clang+llvm-3.0-x86_64-linux-debian /usr/local/clang-3.0
RUN rm clang+llvm-3.0-x86_64-linux-debian.tar.gz

# Run the installer
RUN ./installGHCiOS.sh

CMD ["ghc-ios"]
60 changes: 22 additions & 38 deletions installGHCiOS.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,55 +2,39 @@

cd /tmp

if [[ ! -f /usr/local/clang-3.0/bin/llc ]]; then
echo "Downloading LLVM 3.0..."
curl -O http://llvm.org/releases/3.0/clang+llvm-3.0-x86_64-apple-darwin11.tar.gz
tar xvf clang+llvm-3.0-x86_64-apple-darwin11.tar.gz
mv clang+llvm-3.0-x86_64-apple-darwin11 /usr/local/clang-3.0
rm clang+llvm-3.0-x86_64-apple-darwin11.tar.gz
fi


echo "Downloading GHC for iOS devices..."

curl -L -O https://www.haskell.org/ghc/dist/7.8.3/ghc-7.8.3-arm-apple-ios.tar.xz
tar xvf ghc-7.8.3-arm-apple-ios.tar.xz && mv ghc-7.8.3 ghc-7.8.3-arm
rm ghc-7.8.3-arm-apple-ios.tar.xz
cd ghc-7.8.3-arm
curl -L -O https://downloads.haskell.org/~ghc/7.10.1/ghc-7.10.1-src.tar.xz
tar xvf ghc-7.10.1-src.tar.xz && mv ghc-7.10.1 ghc-7.10.1-arm
rm ghc-7.10.1-src.tar.xz
cd ghc-7.10.1-arm

# Remove befuddling inclusion of my local paths
LC_CTYPE=C
LANG=C
CFLAGS="-mmacosx-version-min=10.9"
CXXFLAGS="-mmacosx-version-min=10.9"
CPPFLAGS="-mmacosx-version-min=10.9"

find . -type f -not -name .DS_Store -not -name "*.a" -print0 | xargs -0 sed -i '' 's|/Users/lukexi/Code/ghc-ios-scripts/||g'

./configure
# Fix the settings file to point to the right scripts and clang versions
sed -i '' 's|/usr/bin/gcc|arm-apple-darwin10-clang|g' settings
sed -i '' 's|/usr/bin/ld|arm-apple-darwin10-ld|g' settings
sed -i '' 's|"opt"|"/usr/local/clang-3.0/bin/opt"|g' settings
sed -i '' 's|"llc"|"/usr/local/clang-3.0/bin/llc"|g' settings
make install
cd ..
rm -r ghc-7.8.3-arm
# Enable the build.mk file (essential for telling vanilla GHC to target iOS)
mv mk/build.mk.sample mk/build.mk
# Select a cross-compiling build flavour
sed -i '' 's/#BuildFlavour = quick-cross/BuildFlavour = quick-cross/g' mk/build.mk
# TODO should we force LLVM backend on GHC stage1 too?
# sed -i '' 's/GhcStage1HcOpts = -O/GhcStage1HcOpts = -O -fllvm/g' mk/build.mk

echo "Downloading GHC for the iOS simulator..."
cd /tmp
curl -L -O https://www.haskell.org/ghc/dist/7.8.3/ghc-7.8.3-i386-apple-ios.tar.xz
tar xvf ghc-7.8.3-i386-apple-ios.tar.xz && mv ghc-7.8.3 ghc-7.8.3-i386
rm ghc-7.8.3-i386-apple-ios.tar.xz
cd ghc-7.8.3-i386
echo "Contents of mk/build.mk:"
cat mk/build.mk

# ditto above
LC_CTYPE=C
LANG=C
find . -type f -not -name .DS_Store -not -name "*.a" -print0 | xargs -0 sed -i '' 's|/Users/lukexi/Code/ghc-ios-scripts/||g'
echo "Arguments for the configure script are:"
./configure --help

./configure
./configure --target=arm-apple-darwin10 --with-gcc=arm-apple-darwin10-clang
# Fix the settings file to point to the right scripts and clang versions
sed -i '' 's|/usr/bin/gcc|i386-apple-darwin11-clang|g' settings
sed -i '' 's|/usr/bin/ld|i386-apple-darwin11-ld|g' settings
sed -i '' 's|"opt"|"/usr/local/clang-3.0/bin/opt"|g' settings
sed -i '' 's|"llc"|"/usr/local/clang-3.0/bin/llc"|g' settings
sed -i '' 's|/usr/bin/gcc|arm-apple-darwin10-clang|g' settings
sed -i '' 's|/usr/bin/ld|arm-apple-darwin10-ld|g' settings
make install
cd ..
rm -r ghc-7.8.3-i386
rm -r ghc-7.10.1-arm