Skip to content

Commit

Permalink
Merge pull request #634 from collinsr/dev/patch-gdal-for-mac
Browse files Browse the repository at this point in the history
Patch GDAL to build on OSX (fixes missing strdup() prototype).
  • Loading branch information
dstoup authored Mar 4, 2021
2 parents 3f0719a + ee3c075 commit 102206d
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Patches/GDAL/2.3.2/Patch.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,6 @@
message("Copying ${GDAL_patch}/data/nitf_spec.xml to ${GDAL_source}/data/nitf_spec.xml")
file(COPY ${GDAL_patch}/data/nitf_spec.xml DESTINATION ${GDAL_source}/data/)

message("Copying ${GDAL_patch}/ogr/ogrsf_frmts/geojson/libjson/GNUmakefile to ${GDAL_source}/ogr/ogrsf_frmts/geojson/libjson/GNUmakefile")
file(COPY ${GDAL_patch}/ogr/ogrsf_frmts/geojson/libjson/GNUmakefile DESTINATION ${GDAL_source}/ogr/ogrsf_frmts/geojson/libjson/)

38 changes: 38 additions & 0 deletions Patches/GDAL/2.3.2/ogr/ogrsf_frmts/geojson/libjson/GNUmakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# $Id$
#
# Makefile building json-c library (http://oss.metaparadigm.com/json-c/)
#
include ../../../../GDALmake.opt

OBJ = \
arraylist.o \
debug.o \
json_object.o \
json_tokener.o \
json_util.o \
linkhash.o \
printbuf.o \
json_object_iterator.o \
json_c_version.o

O_OBJ = $(foreach file,$(OBJ),../../o/$(file))

CPPFLAGS := $(CPPFLAGS)

default: $(O_OBJ:.o=.$(OBJ_EXT))

#ifdef __APPLE__
# ...actually, needs to be -->600<-- to get strdup;
# per https://bugs.launchpad.net/libvterm/+bug/1638205
CPPFLAGS := -D_XOPEN_SOURCE=600 $(CPPFLAGS)
#else
# -D_XOPEN_SOURCE=500 to enable strdup() definition in C11 mode
CPPFLAGS := -D_XOPEN_SOURCE=500 $(CPPFLAGS)
#endif

../../o/%.$(OBJ_EXT): %.c
$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<

clean:
rm -f *.o $(O_OBJ)
rm -f *~

0 comments on commit 102206d

Please sign in to comment.