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

WIP: Setup travis build on OSX #146

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
13 changes: 9 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ branches:

os:
- linux
#- osx
- osx

env:
global:
Expand All @@ -25,8 +25,8 @@ env:
fi

before_install:
# Install GMT dependencies
- bash ci/travis-setup.sh
# Linux: Install GMT dependencies
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then bash ci/travis-setup.sh; fi
# Install GMT documentation dependencies
- if [ "$TRAVIS_EVENT_TYPE" == "cron" ]; then
git clone https://github.com/fatiando/continuous-integration.git;
Expand All @@ -35,7 +35,12 @@ before_install:

install:
# Build and install GMT
- bash ci/travis-build.sh;
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then
bash ci/travis-build.sh;
elif [ "$TRAVIS_OS_NAME" == "osx" ]; then
brew install gcc;
brew install --HEAD ci/gmt.rb;
fi

script:
- gmt defaults -Vd
Expand Down
60 changes: 60 additions & 0 deletions ci/gmt.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
class Gmt < Formula
desc "Tools for processing and displaying xy and xyz datasets"
homepage "https://gmt.soest.hawaii.edu/"
head "https://github.com/GenericMappingTools/gmt.git"

depends_on "cmake" => :build
depends_on "fftw"
depends_on "gdal"
depends_on "netcdf"
depends_on "pcre"

resource "gshhg" do
url "ftp:https://ftp.soest.hawaii.edu/gmt/gshhg-gmt-2.3.7.tar.gz"
mirror "https://mirrors.ustc.edu.cn/gmt/gshhg-gmt-2.3.7.tar.gz"
mirror "https://fossies.org/linux/misc/GMT/gshhg-gmt-2.3.7.tar.gz"
sha256 "9bb1a956fca0718c083bef842e625797535a00ce81f175df08b042c2a92cfe7f"
end

resource "dcw" do
url "ftp:https://ftp.soest.hawaii.edu/gmt/dcw-gmt-1.1.4.tar.gz"
mirror "https://mirrors.ustc.edu.cn/gmt/dcw-gmt-1.1.4.tar.gz"
mirror "https://fossies.org/linux/misc/GMT/dcw-gmt-1.1.4.tar.gz"
sha256 "8d47402abcd7f54a0f711365cd022e4eaea7da324edac83611ca035ea443aad3"
end

def install
(buildpath/"gshhg").install resource("gshhg")
(buildpath/"dcw").install resource("dcw")

args = std_cmake_args.concat %W[
-DCMAKE_INSTALL_PREFIX=#{prefix}
-DGMT_DOCDIR=#{share}/doc/gmt
-DGMT_MANDIR=#{man}
-DGSHHG_ROOT=#{buildpath}/gshhg
-DCOPY_GSHHG:BOOL=TRUE
-DDCW_ROOT=#{buildpath}/dcw
-DCOPY_DCW:BOOL=TRUE
-DFFTW3_ROOT=#{Formula["fftw"].opt_prefix}
-DGDAL_ROOT=#{Formula["gdal"].opt_prefix}
-DNETCDF_ROOT=#{Formula["netcdf"].opt_prefix}
-DPCRE_ROOT=#{Formula["pcre"].opt_prefix}
-DFLOCK:BOOL=TRUE
-DGMT_INSTALL_MODULE_LINKS:BOOL=TRUE
-DGMT_INSTALL_TRADITIONAL_FOLDERNAMES:BOOL=FALSE
-DLICENSE_RESTRICTED:BOOL=FALSE
]

mkdir "build" do
system "cmake", "..", *args
system "make", "install"
end
end

test do
system "#{bin}/pscoast -R0/360/-70/70 -Jm1.2e-2i -Ba60f30/a30f15 -Dc -G240 -W1/0 -P > test.ps"
assert_predicate testpath/"test.ps", :exist?
end

conflicts_with "gmt", :because => "GMT 5 and GMT 6 both have the gmt command"
end