-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Always copy proj data dir from the same pkg-config datadir it used …
…during installation
- Loading branch information
1 parent
ec88ed3
commit 282f98e
Showing
4 changed files
with
100 additions
and
13 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,16 @@ | ||
OLD_PROJ <- Sys.getenv("PROJ_LIB") | ||
|
||
.onUnload <- function(libpath) { | ||
library.dynam.unload("gdalBindings", libpath) | ||
Sys.setenv("PROJ_LIB" = OLD_PROJ) | ||
invisible() | ||
} | ||
|
||
#' @useDynLib gdalBindings, .registration=TRUE | ||
.onLoad <- function(libname, pkgname) { | ||
Rcpp::loadModule("gdal_module", TRUE, TRUE) | ||
InitializeGDAL() | ||
} | ||
|
||
.onAttach <- function(libname, pkgname) { | ||
if (Sys.getenv("PROJ_LIB") == "") { | ||
if (system.file("proj", package = pkgname)[1] != "") { | ||
Sys.setenv("PROJ_LIB" = system.file("proj", package = pkgname)[1]) | ||
} | ||
if (Sys.getenv("GDAL_DATA") == "") { | ||
Sys.setenv("GDAL_DATA" = system.file("gdal", package = pkgname)[1]) | ||
} | ||
} | ||
Rcpp::loadModule("gdal_module", TRUE, TRUE) | ||
InitializeGDAL() | ||
} |
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 |
---|---|---|
@@ -1,2 +1,15 @@ | ||
PKG_CPPFLAGS = @GDAL_CFLAGS@ @PROJ_CFLAGS@ | ||
PKG_LIBS = @GDAL_LIBS@ @GDAL_DEP_LIBS@ @PROJ_LIBS@ | ||
|
||
# Copy PROJ data directory to inst/proj | ||
PROJ_DATADIR = @PROJ_DATADIR@ | ||
|
||
copy_proj_data: | ||
if [ -n "$(PROJ_DATADIR)" ]; then \ | ||
cp -r $PROJ_DATADIR ./inst/proj/; | ||
else \ | ||
echo "PROJ_DATADIR is empty. Skipping file copy."; \ | ||
fi | ||
|
||
# Override the default build rule to include the custom file copying rule | ||
all: copy_proj_data |