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: spatialite GUI #62

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
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
30 changes: 30 additions & 0 deletions runtime/install/charls.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash
set -euxo pipefail

# configure runtime environment
RUNTIME=${RUNTIME:='/opt/spatial'}
mkdir -p "${RUNTIME}"

# working directory
cd /tmp

# clean up
rm -rf charls && mkdir -p charls

# download release and decompress it
curl -L 'https://github.com/team-charls/charls/archive/2.1.0.tar.gz' \
| tar -xz --strip-components=1 -C charls

# working directory
cd charls

# configure build
mkdir -p release && cd release
cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=On -DCMAKE_INSTALL_PREFIX="${RUNTIME}" ..

# compile and install in runtime directory
make -j8
make install

# clean up
rm -rf /tmp/charls
31 changes: 31 additions & 0 deletions runtime/install/liblzma.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash
set -euxo pipefail

# configure runtime environment
RUNTIME=${RUNTIME:='/opt/spatial'}
mkdir -p "${RUNTIME}"

# working directory
cd /tmp

# clean up
rm -rf liblzma && mkdir -p liblzma

# download release and decompress it
curl -L 'https://tukaani.org/xz/xz-5.2.5.tar.bz2' \
| tar -xz --strip-components=1 -C liblzma

# working directory
cd liblzma

# configure build
./configure \
--prefix="${RUNTIME}" \
--enable-static=no

# compile and install in runtime directory
make -j8
make install

# clean up
rm -rf /tmp/liblzma
77 changes: 77 additions & 0 deletions runtime/install/librasterlite2.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
#!/bin/bash
set -euxo pipefail

# import utils script
. ./_utils.sh

# configure runtime environment
RUNTIME=${RUNTIME:='/opt/spatial'}
mkdir -p "${RUNTIME}"

# working directory
cd /tmp

# clone latest 'librasterlite2' from fossil
gaia_clone 'librasterlite2'
cd 'librasterlite2'

# build flags (link dependencies)
export CPPFLAGS="-I${RUNTIME}/include"
export LDFLAGS="-L${RUNTIME}/lib"
export LIBS="-ldl"


# link spatialite
export LIBSPATIALITE_CFLAGS="-I${RUNTIME}/include"
export LIBSPATIALITE_LIBS='-lspatialite'

# link readosm
export LIBREADOSM_CFLAGS="-I${RUNTIME}/include"
export LIBREADOSM_LIBS="-L${RUNTIME}/lib -lreadosm"

# link rttopo
export RTTOPO_CFLAGS="-I${RUNTIME}/include"
export RTTOPO_LIBS='-lrttopo'

# link libxml2
export LIBXML2_CFLAGS="-I${RUNTIME}/include/libxml2"
export LIBXML2_LIBS="-L${RUNTIME}/lib -lxml2"

# link lz4
export LIBLZ4_CFLAGS="-I${RUNTIME}/include"
export LIBLZ4_LIBS="-L${RUNTIME}/lib -llz4"

# link lzstd
export LIBZSTD_CFLAGS="-I${RUNTIME}/include"
export LIBZSTD_LIBS="-L${RUNTIME}/lib -llzstd"

# link openjpeg
export LIBOPENJP2_CFLAGS="-I${RUNTIME}/include"
export LIBOPENJP2_LIBS="-L${RUNTIME}/lib -lopenjp2"

# link libwebp
export LIBWEBP_CFLAGS="-I${RUNTIME}/include"
export LIBWEBP_LIBS="-L${RUNTIME}/lib -lwebp"

# link liblzma
export LIBLZMA_CFLAGS="-I${RUNTIME}/include"
export LIBLZMA_LIBS="-L${RUNTIME}/lib -llzma"

# link librasterlite2
export LIBRASTERLITE2_CFLAGS="-I${RUNTIME}/include"
export LIBRASTERLITE2_LIBS="-L${RUNTIME}/lib -lrasterlite2"

./configure --help

# configure build
./configure \
--prefix="${RUNTIME}" \
--disable-dependency-tracking \
--enable-static=no

# compile and install in runtime directory
make -j8
make install-strip

# clean up
rm -rf /tmp/librasterlite2
31 changes: 31 additions & 0 deletions runtime/install/libwebp.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash
set -euxo pipefail

# configure runtime environment
RUNTIME=${RUNTIME:='/opt/spatial'}
mkdir -p "${RUNTIME}"

# working directory
cd /tmp

# clean up
rm -rf libwebp && mkdir -p libwebp

# download release and decompress it
curl -L 'https://github.com/webmproject/libwebp/archive/v1.1.0.tar.gz' \
| tar -xz --strip-components=1 -C libwebp

# working directory
cd libwebp

# configure build
./autogen.sh
./configure \
--prefix="${RUNTIME}"

# compile and install in runtime directory
make -j8
make install

# clean up
rm -rf /tmp/libwebp
31 changes: 31 additions & 0 deletions runtime/install/lz4.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash
set -euxo pipefail

# configure runtime environment
RUNTIME=${RUNTIME:='/opt/spatial'}
mkdir -p "${RUNTIME}"

# working directory
cd /tmp

# clean up
rm -rf lz4 && mkdir -p lz4

# download release and decompress it
curl -L 'https://github.com/lz4/lz4/archive/v1.9.2.tar.gz' \
| tar -xz --strip-components=1 -C lz4

# working directory
cd lz4

# configure build
# @todo dynamic only?
export PREFIX="${RUNTIME}"

# compile and install in runtime directory
make -j8
make uninstall
make install

# clean up
rm -rf /tmp/lz4
30 changes: 30 additions & 0 deletions runtime/install/lzstd.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash
set -euxo pipefail

# configure runtime environment
RUNTIME=${RUNTIME:='/opt/spatial'}
mkdir -p "${RUNTIME}"

# working directory
cd /tmp

# clean up
rm -rf zstd && mkdir -p zstd

# download release and decompress it
curl -L 'https://github.com/facebook/zstd/releases/download/v1.4.5/zstd-1.4.5.tar.gz' \
| tar -xz --strip-components=1 -C zstd

# working directory
cd zstd

# configure build
# @todo dynamic only?
export PREFIX="${RUNTIME}"

# compile and install in runtime directory
make -j8
make install

# clean up
rm -rf /tmp/zstd
30 changes: 30 additions & 0 deletions runtime/install/openjpeg.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash
set -euxo pipefail

# configure runtime environment
RUNTIME=${RUNTIME:='/opt/spatial'}
mkdir -p "${RUNTIME}"

# working directory
cd /tmp

# clean up
rm -rf openjpeg && mkdir -p openjpeg

# download release and decompress it
curl -L 'https://github.com/uclouvain/openjpeg/archive/v2.3.1.tar.gz' \
| tar -xz --strip-components=1 -C openjpeg

# working directory
cd openjpeg

# configure build
mkdir -p build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="${RUNTIME}"

# compile and install in runtime directory
make -j8
make install

# clean up
rm -rf /tmp/openjpeg
92 changes: 92 additions & 0 deletions runtime/install/spatialite-gui.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
#!/bin/bash
set -euxo pipefail

# import utils script
. ./_utils.sh

# configure runtime environment
RUNTIME=${RUNTIME:='/opt/spatial'}
mkdir -p "${RUNTIME}"

# working directory
cd /tmp

# clone latest 'spatialite_gui' from fossil
gaia_clone 'spatialite_gui'
cd 'spatialite_gui'

# build flags (link dependencies)
export CPPFLAGS="-I${RUNTIME}/include"
export LDFLAGS="-L${RUNTIME}/lib"
export LDFLAGS="${LDFLAGS} -Wl,-rpath,${RUNTIME}/lib" # set 'rpath'
export PKG_CONFIG_PATH="${RUNTIME}/lib/pkgconfig"
export LIBS='-ldl ' # note: requires trailing space!

# link spatialite
export LIBSPATIALITE_CFLAGS="-I${RUNTIME}/include"
export LIBSPATIALITE_LIBS='-lspatialite'

# link readosm
export LIBREADOSM_CFLAGS="-I${RUNTIME}/include"
export LIBREADOSM_LIBS="-L${RUNTIME}/lib -lreadosm"

# link rttopo
export RTTOPO_CFLAGS="-I${RUNTIME}/include"
export RTTOPO_LIBS='-lrttopo'

# link libxml2
export LIBXML2_CFLAGS="-I${RUNTIME}/include/libxml2"
export LIBXML2_LIBS="-L${RUNTIME}/lib -lxml2"

# link lz4
export LIBLZ4_CFLAGS="-I${RUNTIME}/include"
export LIBLZ4_LIBS="-L${RUNTIME}/lib -llz4"

# link lzstd
export LIBZSTD_CFLAGS="-I${RUNTIME}/include"
export LIBZSTD_LIBS="-L${RUNTIME}/lib -llzstd"

# link openjpeg
export LIBOPENJP2_CFLAGS="-I${RUNTIME}/include"
export LIBOPENJP2_LIBS="-L${RUNTIME}/lib -lopenjp2"

# link libwebp
export LIBWEBP_CFLAGS="-I${RUNTIME}/include"
export LIBWEBP_LIBS="-L${RUNTIME}/lib -lwebp"

# link liblzma
export LIBLZMA_CFLAGS="-I${RUNTIME}/include"
export LIBLZMA_LIBS="-L${RUNTIME}/lib -llzma"

# link librasterlite2
export LIBRASTERLITE2_CFLAGS="-I${RUNTIME}/include"
export LIBRASTERLITE2_LIBS="-L${RUNTIME}/lib -lrasterlite2"

# fix for expat install!?
if [ -x "$(command -v gsed)" ]; then
gsed -i 's:LIBS="-lexpat $LIBS":LIBS="-L/opt/spatial/lib -lexpat":g' configure
else
sed -i 's:LIBS="-lexpat $LIBS":LIBS="-L/opt/spatial/lib -lexpat":g' configure
fi

./configure --help

# configure build
./configure \
--prefix="${RUNTIME}" \
--disable-dependency-tracking \
--enable-rttopo \
--enable-libxml2 \
--disable-freexl \
--with-geosconfig="${RUNTIME}/bin/geos-config" \
--enable-static=no

# compile and install in runtime directory
make -j8
make install-strip

## test binary correctly linked in empty env
env -i "${RUNTIME}/bin/spatialite" :memory: 'SELECT spatialite_version()'

# clean up
rm -rf /tmp/spatialite_gui