-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #214 from r-wasm/gdal
Preliminary support for geospatial stack
- Loading branch information
Showing
20 changed files
with
168 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
GDAL_VERSION = 3.6.4 | ||
GDAL_TARBALL = $(DOWNLOAD)/gdal-$(GDAL_VERSION).tar.gz | ||
GDAL_URL = https://github.com/OSGeo/gdal/releases/download/v$(GDAL_VERSION)/gdal-$(GDAL_VERSION).tar.gz | ||
|
||
.PHONY: gdal | ||
gdal: $(GDAL_WASM_LIB) | ||
|
||
$(GDAL_TARBALL): | ||
mkdir -p $(DOWNLOAD) | ||
wget $(GDAL_URL) -O $@ | ||
|
||
# https://gdal.org/development/building_from_source.html | ||
|
||
# There is one configure helper that makes an erroneous conclusion | ||
# about the signature of an iconv function because building the test | ||
# file fails with an unrelated Emscripten error about a missing symbol. | ||
# To work around, we just fix the setting directly in `cpl_config.h`. | ||
|
||
# The `CONFIG_DEP_LIBS` field in `gdal-config` needs two edits. First | ||
# remove `-lproj` to avoid duplicates in build command that include | ||
# both `gdal-config --dep-libs` and `pkg-config proj --libs`. | ||
# Emscripten expands those flags to the `libproj.a` archive file, | ||
# which causes duplicate symbols errors. | ||
# | ||
# Second, remove the `-L/path/to/emscripten/sysroot/wasm32-emscripten` | ||
# flag. This directory contains non-fPIC libraries. Not sure why the | ||
# `pic` subfolder isn't selected. | ||
|
||
$(GDAL_WASM_LIB): $(GDAL_TARBALL) $(PROJ_WASM_LIB) | ||
mkdir -p $(BUILD)/gdal-$(GDAL_VERSION)/build | ||
tar -C $(BUILD) -xf $(GDAL_TARBALL) | ||
cd $(BUILD)/gdal-$(GDAL_VERSION)/build && \ | ||
emcmake cmake --debug-find \ | ||
-DCMAKE_FIND_ROOT_PATH=$(WASM) \ | ||
-DCMAKE_INSTALL_PREFIX:PATH=$(WASM) \ | ||
-DBUILD_TESTING=OFF \ | ||
-DBUILD_APPS=OFF \ | ||
-DGDAL_ENABLE_DRIVER_HDF5=OFF \ | ||
-DGDAL_USE_HDF4=OFF \ | ||
-DGDAL_USE_HDF5=OFF \ | ||
.. && \ | ||
sed -i.bak 's/#define ICONV_CPP_CONST const/#define ICONV_CPP_CONST/' port/cpl_config.h && \ | ||
emmake make install && \ | ||
sed -i.bak 's/\(^CONFIG_DEP_LIBS=.*\) -lproj\(.*\)/\1\2/' $(WASM)/bin/gdal-config && \ | ||
sed -i.bak 's/\(^CONFIG_DEP_LIBS=.*\)-L.*wasm32-emscripten\(.*\)/\1 \2/' $(WASM)/bin/gdal-config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
GDAL_WASM_LIB = $(WASM)/lib/libgdal.a | ||
OPTIONAL_WASM_LIBS += $(GDAL_WASM_LIB) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
OPENSSL_WASM_LIB = $(WASM)/lib/libssl.a | ||
OPTIONAL_WASM_LIBS += $(OPENSSL_WASM_LIB) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
PROJ_VERSION = 9.2.0 | ||
PROJ_TARBALL = $(DOWNLOAD)/proj-$(PROJ_VERSION).tar.gz | ||
PROJ_URL = https://github.com/OSGeo/PROJ/releases/download/$(PROJ_VERSION)/proj-$(PROJ_VERSION).tar.gz | ||
|
||
.PHONY: proj | ||
proj: $(PROJ_WASM_LIB) | ||
|
||
$(PROJ_TARBALL): | ||
mkdir -p $(DOWNLOAD) | ||
wget -q -O $@ $(PROJ_URL) | ||
|
||
# https://github.com/OSGeo/PROJ/blob/master/docs/source/install.rst | ||
|
||
# Somehow `-DBUILD_APPS` doesn't work and we need to turn off each app | ||
# individually. TIFF support is disabled but we probably should enable | ||
# it once we have built libtiff as a wasm lib. | ||
$(PROJ_WASM_LIB): $(PROJ_TARBALL) $(SQLITE3_WASM_LIB) | ||
mkdir -p $(BUILD)/proj-$(PROJ_VERSION)/build | ||
tar -C $(BUILD) -xf $(PROJ_TARBALL) | ||
cd $(BUILD)/proj-$(PROJ_VERSION)/build && \ | ||
emcmake cmake \ | ||
-DCMAKE_INSTALL_PREFIX:PATH="$(WASM)" \ | ||
-DSQLITE3_INCLUDE_DIR="$(WASM)/include" \ | ||
-DSQLITE3_LIBRARY="$(SQLITE3_WASM_LIB)" \ | ||
-DENABLE_TIFF=OFF \ | ||
-DENABLE_CURL=OFF \ | ||
-DBUILD_APPS=OFF \ | ||
-DBUILD_CCT=OFF \ | ||
-DBUILD_CS2CS=OFF \ | ||
-DBUILD_GEOD=OFF \ | ||
-DBUILD_GIE=OFF \ | ||
-DBUILD_PROJ=OFF \ | ||
-DBUILD_PROJINFO=OFF \ | ||
-DBUILD_PROJSYNC=OFF \ | ||
-DBUILD_TESTING=OFF \ | ||
.. && \ | ||
emmake make install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
PROJ_WASM_LIB = $(WASM)/lib/libproj.a | ||
OPTIONAL_WASM_LIBS += $(PROJ_WASM_LIB) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
SQLITE3_VERSION = 3.41.2 | ||
SQLITE3_VERSION2 = 3410200 | ||
SQLITE3_FILE_NAME = sqlite-autoconf-$(SQLITE3_VERSION2) | ||
SQLITE3_TARBALL = $(DOWNLOAD)/$(SQLITE3_FILE_NAME).tar.gz | ||
SQLITE3_URL = https://sqlite.org/2023/$(SQLITE3_FILE_NAME).tar.gz | ||
|
||
.PHONY: sqlite3 | ||
sqlite3: $(SQLITE3_WASM_LIB) | ||
|
||
$(SQLITE3_TARBALL): | ||
mkdir -p $(DOWNLOAD) | ||
wget $(SQLITE3_URL) -O $@ | ||
|
||
$(SQLITE3_WASM_LIB): $(SQLITE3_TARBALL) | ||
mkdir -p $(BUILD)/$(SQLITE3_FILE_NAME)/build | ||
tar -C $(BUILD) -xf $(SQLITE3_TARBALL) | ||
cd $(BUILD)/$(SQLITE3_FILE_NAME)/build && \ | ||
emconfigure ../configure \ | ||
--enable-shared=no \ | ||
--enable-static=yes \ | ||
--prefix=$(WASM) && \ | ||
emmake make install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
SQLITE3_WASM_LIB = $(WASM)/lib/libsqlite3.a | ||
OPTIONAL_WASM_LIBS += $(SQLITE3_WASM_LIB) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters