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

GMT #5199

Merged
merged 42 commits into from
Mar 15, 2023
Merged

GMT #5199

Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
85abb34
first attempt to compile GMT. Appears to work on mac & linux, bnut no…
boriskaus Jul 21, 2022
5d4eb33
don't think we need this
boriskaus Jul 21, 2022
c61e973
more general NetCDF version (still doesn't like windows, though)
boriskaus Jul 21, 2022
a51eb5d
undo
boriskaus Jul 21, 2022
5211057
Update G/GMT/build_tarballs.jl
boriskaus Jul 23, 2022
04e4d24
Update G/GMT/build_tarballs.jl
boriskaus Jul 23, 2022
641d94c
some progress with the windows install (still incomplete, though)
boriskaus Jul 23, 2022
198c720
Update G/GMT/build_tarballs.jl
boriskaus Jul 24, 2022
bf360b1
update version
boriskaus Jul 24, 2022
bdfde9d
updated to use latest version (attempt to see if this compiles)
boriskaus Mar 3, 2023
5ad90af
Merge branch 'master' into GMT
boriskaus Mar 3, 2023
93d3f76
uses more recent version of gmt
boriskaus Mar 3, 2023
592a36e
Merge branch 'master' into GMT
boriskaus Mar 3, 2023
660b221
progress (it seems)
boriskaus Mar 3, 2023
958bdd1
Merge remote-tracking branch 'origin/GMT' into GMT
boriskaus Mar 3, 2023
9cade5a
libraries
boriskaus Mar 3, 2023
d36193d
explicitly add libraries
boriskaus Mar 3, 2023
6d515de
windows wants a separate treatment
boriskaus Mar 3, 2023
79df42e
requested additions
boriskaus Mar 3, 2023
524302d
updates
boriskaus Mar 3, 2023
a3b9e2d
Update build_tarballs.jl
boriskaus Mar 4, 2023
45bf155
remove patch (no longer required); add support for openMP on mac & at…
boriskaus Mar 4, 2023
c852eef
belongs to previous
boriskaus Mar 4, 2023
20a522b
adds GSSH & DCW to the compilation
boriskaus Mar 4, 2023
72df1f8
typo
boriskaus Mar 4, 2023
17ea5ca
next attempt
boriskaus Mar 4, 2023
fa1dddc
next attempt
boriskaus Mar 5, 2023
fb2d8e3
fix for *ix
boriskaus Mar 5, 2023
7f3627c
bugfix
boriskaus Mar 5, 2023
b648a45
how difficult can this be
boriskaus Mar 5, 2023
6b526be
removing installation block & simpler way to take version numbers int…
boriskaus Mar 5, 2023
9a2d0d3
it doesn't work if we indicate supplements as FileProduct or as Libra…
boriskaus Mar 5, 2023
1d232bc
Update G/GMT/build_tarballs.jl
boriskaus Mar 5, 2023
e778f16
Update G/GMT/build_tarballs.jl
boriskaus Mar 5, 2023
201a32c
add license & additional name for postscript library
boriskaus Mar 6, 2023
30c58c7
Merge branch 'master' into GMT
boriskaus Mar 6, 2023
20fac0a
adding version # for GDAL & update the one of NetCDF
boriskaus Mar 7, 2023
9bd8147
Merge branch 'master' into GMT
boriskaus Mar 10, 2023
7642321
add PROJ_jll dependency
boriskaus Mar 11, 2023
7355ba2
Update build_tarballs.jl
boriskaus Mar 14, 2023
2b38c54
update git hash
boriskaus Mar 15, 2023
4c4171e
Apply suggestions from code review
giordano Mar 15, 2023
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
91 changes: 91 additions & 0 deletions G/GMT/build_tarballs.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
# Note that this script can accept some limited command-line arguments, run
# `julia build_tarballs.jl --help` to see a usage message.
using BinaryBuilder, Pkg

name = "GMT"
version = v"6.4.0"


# Collection of sources required to complete build
sources = [
GitSource("https://github.com/GenericMappingTools/gmt",
"19413d486888ebdc3c01aeed3707bcc88eb727df")
]

# Bash recipe for building across all platforms
script = raw"""
GSHHG_VERSION="2.3.7"
DCW_VERSION="2.1.1"
GSHHG="gshhg-gmt-${GSHHG_VERSION}"
DCW="dcw-gmt-${DCW_VERSION}"
EXT="tar.gz"
boriskaus marked this conversation as resolved.
Show resolved Hide resolved

cd $WORKSPACE/srcdir
cd gmt
mkdir build
cd build/

cmake -DCMAKE_INSTALL_PREFIX=${prefix} \
-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TARGET_TOOLCHAIN} \
-DCMAKE_BUILD_TYPE=Release \
-DHAVE_QSORT_R_GLIBC=False \
-DHAVE___BUILTIN_BSWAP16=False \
-DHAVE___BUILTIN_BSWAP32=False \
-DHAVE___BUILTIN_BSWAP64=False \
-DGMT_ENABLE_OPENMP=True \
giordano marked this conversation as resolved.
Show resolved Hide resolved
..
make -j${nproc}
make install

if [[ "${target}" == *-mingw* ]]; then
install -Dvm 755 /workspace/destdir/bin/gmt.${dlext} "${libdir}/libgmt.${dlext}"
giordano marked this conversation as resolved.
Show resolved Hide resolved
install -Dvm 755 /workspace/destdir/bin/postscriptlight.${dlext} "${libdir}/libpostscriptlight.${dlext}"
fi


# Download GSHHG and DCW from GitHub, which should be shipped as well
curl -SLO https://github.com/GenericMappingTools/gshhg-gmt/releases/download/${GSHHG_VERSION}/${GSHHG}.${EXT}
giordano marked this conversation as resolved.
Show resolved Hide resolved
curl -SLO https://github.com/GenericMappingTools/dcw-gmt/releases/download/${DCW_VERSION}/${DCW}.${EXT}

tar -xvf ${GSHHG}.${EXT}
tar -xvf ${DCW}.${EXT}

mv ${GSHHG} ${prefix}/share/gshhg-gmt
mv ${DCW} ${prefix}/share/dcw-gmt

"""

# These are the platforms we will build for by default, unless further
# platforms are passed in on the command line
platforms = [
Platform("x86_64", "linux"; libc = "glibc"),
Platform("aarch64", "linux"; libc = "glibc"),
Platform("x86_64", "macos"; ),
Platform("aarch64", "macos"; ),
Platform("x86_64", "windows"; ),
Platform("i686", "windows"; ),
]


# The products that we will ensure are always built
products = [
LibraryProduct("libpostscriptlight", :libpostscriptlight),
boriskaus marked this conversation as resolved.
Show resolved Hide resolved
LibraryProduct("libgmt", :libgmt),
boriskaus marked this conversation as resolved.
Show resolved Hide resolved
ExecutableProduct("gmt", :gmt)
]

# Dependencies that must be installed before this package can be built
dependencies = [
Dependency(PackageSpec(name="LibCURL_jll", uuid="deac9b47-8bc7-5906-a0fe-35ac56dc84c0"); compat="7.73.0")
Dependency("NetCDF_jll", compat="400.702.402")
Dependency(PackageSpec(name="GDAL_jll", uuid="a7073274-a066-55f0-b90d-d619367d196c"))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As per #5199 (comment), it's probably a good idea to add compat bounds for this package.

Dependency(PackageSpec(name="FFTW_jll", uuid="f5851436-0d7a-5f13-b9de-f02708fd171a"))
Dependency(PackageSpec(name="PCRE_jll", uuid="2f80f16e-611a-54ab-bc61-aa92de5b98fc"))
Dependency(PackageSpec(name="LAPACK32_jll", uuid="17f450c3-bd24-55df-bb84-8c51b4b939e3"))
Dependency(PackageSpec(name="OpenBLAS32_jll", uuid="656ef2d0-ae68-5445-9ca0-591084a874a2"))
Dependency(PackageSpec(name="FFMPEG_jll", uuid="b22a6f82-2f65-5046-a5b2-351ab43fb4e5"))
Dependency(PackageSpec(name="Glib_jll", uuid="7746bdde-850d-59dc-9ae8-88ece973131d"))
]

# Build the tarballs, and possibly a `build.jl` as well.
build_tarballs(ARGS, name, version, sources, script, platforms, products, dependencies; julia_compat="1.6", preferred_gcc_version = v"7.1.0")
66 changes: 66 additions & 0 deletions G/GMT/bundled/patches/win_mingw.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
diff --git before/gmt-6.2.0/src/gmt_api.c after/gmt-6.2.0/src/gmt_api.c
giordano marked this conversation as resolved.
Show resolved Hide resolved
index 8b317b3..dcf7a07 100644
--- before/gmt-6.2.0/src/gmt_api.c
+++ after/gmt-6.2.0/src/gmt_api.c
@@ -901,7 +901,7 @@ free_and_return:

/* Function to get PPID under Windows is a bit different */
#ifdef _WIN32
-#include <TlHelp32.h>
+#include <tlhelp32.h>
GMT_LOCAL int gmtapi_winppid (int pidin) {
/* If pidin == 0 get the PPID of current process
otherwise, get the PPID of pidin process
diff --git before/gmt-6.2.0/src/gmt_init.c after/gmt-6.2.0/src/gmt_init.c
index b8772bd..a5fcdc6 100644
--- before/gmt-6.2.0/src/gmt_init.c
+++ after/gmt-6.2.0/src/gmt_init.c
@@ -405,7 +405,7 @@ static struct GMT_HASH keys_hashnode[GMT_N_KEYS];
/* Local functions */

#if defined (WIN32) /* Use Windows API */
-#include <Windows.h>
+#include <windows.h>

/*! . */
bool gmtlib_file_lock (struct GMT_CTRL *GMT, int fd) {
diff --git before/gmt-6.2.0/src/gmt_support.c after/gmt-6.2.0/src/gmt_support.c
index d96ecc4..4a48102 100644
--- before/gmt-6.2.0/src/gmt_support.c
+++ after/gmt-6.2.0/src/gmt_support.c
@@ -86,7 +86,7 @@
#ifndef WIN32
#include <glob.h>
#else
-#include <Windows.h>
+#include <windows.h>
#include <tchar.h>
#endif

@@ -5984,7 +5984,7 @@ GMT_LOCAL int gmtsupport_globerr (const char *path, int eerrno) {
return 0; /* let glob() keep going */
}
#else
-/* Build our own glob for Windows, using tips and code from
+/* Build our own glob for windows, using tips and code from
http://www.thecodingforums.com/threads/globing-on-windows-in-c-c-language.739310/

match a character.
@@ -11364,7 +11364,7 @@ void gmt_sprintf_float (struct GMT_CTRL *GMT, char *string, char *format, double
#ifndef WIN32
sprintf (string, format, x);
#else
- { /* Windows doesn't support %' format */
+ { /* windows doesn't support %' format */
if (use_locale) {
char *new_format = gmt_strrep(format, "%'", "%");
sprintf (string, new_format, x);
@@ -17498,7 +17498,7 @@ bool gmt_check_executable (struct GMT_CTRL *GMT, char *program, char *arg, char
bool answer = false;

/* Turn off any stderr messages coming to the terminal */
- if (strchr (program, ' ')) { /* Command has spaces [most likely under Windows] */
+ if (strchr (program, ' ')) { /* Command has spaces [most likely under windows] */
if (!(program[0] == '\'' || program[0] == '\"')) /* Not in quotes, place double quotes */
boriskaus marked this conversation as resolved.
Show resolved Hide resolved
snprintf (cmd, PATH_MAX, "\"%s\"", program);
else /* Already has quotes, but these might be double or single */