Skip to content

Commit

Permalink
Updates for building things.
Browse files Browse the repository at this point in the history
  • Loading branch information
gdey committed Sep 19, 2018
1 parent 56085ca commit f91275e
Show file tree
Hide file tree
Showing 9 changed files with 213 additions and 163 deletions.
42 changes: 32 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,25 @@
FROM golang:latest
FROM ubuntu:18.04

RUN apt-get update
RUN apt-get install -y curl git build-essential zlib1g-dev automake \
libtool xutils-dev make cmake pkg-config python-pip \
libcurl4-openssl-dev libpng-dev libsqlite3-dev \
libllvm3.9
RUN apt-get update; \
apt-get install software-properties-common; \
add-apt-repository --yes ppa:ubuntu-toolchain-r/test; \
apt-get update;


# Go
RUN apt-get install -y golang-1.10 git build-essential; \
ln -s /usr/lib/go-1.10/bin/go /bin/go; \
ln -s /usr/lib/go-1.10/bin/gofmt /bin/gofmt

# gcc

RUN apt-get install -y gcc g++

RUN apt-get install -y curl zlib1g-dev automake \
libtool xutils-dev make pkg-config python-pip \
libcurl4-openssl-dev \
libllvm3.9


RUN apt-get install -y cmake cmake-data
RUN apt-get install -y ccache
Expand All @@ -14,12 +29,19 @@ RUN apt-get install -y libxi-dev libglu1-mesa-dev x11proto-randr-dev \
x11proto-xf86vidmode-dev libxxf86vm-dev \
libxcursor-dev libxinerama-dev


RUN curl -sL https://deb.nodesource.com/setup_8.x | bash -
RUN apt-get install -y nodejs

RUN go get gihub.com/go-spatial/go-mbgl
# Tools for Development
RUN apt-get install -y vim tree

ENV GOPATH=/go
RUN go get github.com/arolek/p github.com/go-spatial/geom
#RUN go get -d github.com/go-spatial/go-mbgl


# RUN mkdir -p /go/src/github.com/go-spatial/go-mbgl
WORKDIR /go/src/github.com/go-spatial/go-mbgl
#RUN mkdir -p /go/src/github.com/go-spatial/go-mbgl
#WORKDIR /go/src/github.com/go-spatial/go-mbgl

ENTRYPOINT bash
ENTRYPOINT bash
109 changes: 0 additions & 109 deletions install.sh

This file was deleted.

30 changes: 0 additions & 30 deletions mason-versions.ini

This file was deleted.

4 changes: 0 additions & 4 deletions mason-versions.ini.corrupt

This file was deleted.

File renamed without changes.
148 changes: 148 additions & 0 deletions mbgl/c/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
#!/usr/bin/env bash


# copy includes will use find and xargs to copy includes from the mason_packages/headers folder
# to the $PKG_ROOT/include directory
# find "mapbox-gl-native/mason_packages/headers/geometry" -iname include | xargs -n 1 -I {} echo "DIR id {} stuff"
function copy_includes {
subdir=$1
shift
for libraryName in $@; do
srcdir="${PKG_ROOT}/mapbox-gl-native/${subdir}/${libName}"
echo "copying includes for ${PKG_ROOT}/mapbox-gl-native/${subdir}/${libraryName}"
find "${PKG_ROOT}/mapbox-gl-native/${subdir}/${libraryName}" -iname include | xargs -n 1 -I{} cp -R {}/ ${PKG_ROOT}/
done
}

function copy_libs {
subdir=$1
shift
for libName in $@; do
srcdir="${PKG_ROOT}/mapbox-gl-native/${subdir}/${osdir}/${libName}"
for afile in $( find "${srcdir}" -iname "*.a" ); do
cp -R ${afile} ${LIBDIR}/
done
done
}

unamestr=`uname`
echo "running on $(uname)"

# check mbgl dependencies
check="which"
if [[ $unamestr == "Linux" ]]; then
check="dpkg -l"
echo "running linux, checking deps with $check"
osdir="linux-x86_64"
fi

function check_dep {
arg=$1
$check $arg #> /dev/null
err=$?
if [[ ! err -eq 0 ]]; then
echo "missing dependency $arg ($err)"
exit
fi
}

if [[ $unamestr == "Darwin" ]]; then
deps="node cmake ccache xcpretty jazzy"
for dep in $deps; do
echo "checking if $dep is installed"
check_dep $dep
done
else
deps="curl git build-essential zlib1g-dev automake
libtool xutils-dev make cmake pkg-config python-pip
libcurl4-openssl-dev
libllvm3.9
libxi-dev libglu1-mesa-dev x11proto-randr-dev
x11proto-xext-dev libxrandr-dev
x11proto-xf86vidmode-dev libxxf86vm-dev
libxcursor-dev libxinerama-dev nodejs"

# libpng-dev libsqlite3-dev

for dep in $deps; do
echo "checking if $dep is installed"
check_dep $dep
done
fi

if [[ ! $GOPATH ]]; then
echo "GOPATH must be set"
exit
fi

PKG_ROOT=$GOPATH/src/github.com/go-spatial/go-mbgl/mbgl/c


# download and install sdk
if [[ ! -d mapbox-gl-native ]]; then
git clone https://github.com/mapbox/mapbox-gl-native
fi

git fetch --all --tags --prune

if [[ ! -d $PKG_ROOT/lib ]]; then
mkdir $PKG_ROOT/lib
fi

cd $PKG_ROOT/mapbox-gl-native

if [[ uname == "Darwin" ]]; then
echo "installing for $(uname)"
LIBDIR=$PKG_ROOT/lib/darwin

git checkout tags/macos-v0.9.0
git submodule foreach --recursive git --reset --hard

make xpackage
err=$?
if [[ ! err -eq 0 ]]; then
echo "error $err"
exit
fi

if [[ -d ${LIBDIR} ]]; then
rm -rf ${LIBDIR}
fi

mkdir -p ${LIBDIR}

mv $PKG_ROOT/mapbox-gl-native/build/macos/Debug/* ${LIBDIR}
sudo mv $PKG_ROOT/lib/darwin/Mapbox.framework /Library/Frameworks/
else
LIBDIR=$PKG_ROOT/lib/linux
INCLUDEDIR=$PKG_ROOT/include
git checkout master
git reset --hard --recurse-submodules
make WITH_OSMESA=ON linux-core

if [[ -d ${LIBDIR} ]]; then
rm -rf ${LIBDIR}
rm -rf ${INCLUDEDIR}
fi

mkdir -p ${LIBDIR}
mkdir -p ${INCLUDEDIR}

copy_libs "build" "Debug"
copy_libs "mason_packages" "libuv" "libjpeg-turbo" "libpng"
#cp $PKG_ROOT/mapbox-gl-native/build/linux-x86_64/Debug/*.a ${LIBDIR}
cp -R $PKG_ROOT/mapbox-gl-native/include/* ${INCLUDEDIR}
copy_includes "vendor" "expected"
copy_includes "mason_packages/headers" "geometry" "variant"
fi

# install mason-js (mapbox package manager)
#cd $PKG_ROOT
#git clone https://github.com/mapbox/mason-js
#cd $PKG_ROOT/mason-js
#npm i -g

# install deps
#cd $PKG_ROOT
#mason-js install
#mason-js link
21 changes: 15 additions & 6 deletions mbgl/mbgl.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,22 @@ package mbgl
#cgo CFLAGS: -D_GLIBCXX_USE_CXX11_ABI=1
#cgo CXXFLAGS: -std=c++14 -std=gnu++14
#cgo CXXFLAGS: -g
#cgo CXXFLAGS: -I${SRCDIR}/../mason_packages/.link/include
#cgo CXXFLAGS: -I${SRCDIR}/../mapbox-gl-native/vendor/expected/include
#cgo CXXFLAGS: -I${SRCDIR}/../mapbox-gl-native/include
#cgo CXXFLAGS: -I${SRCDIR}/../mapbox-gl-native/platform/default
#cgo LDFLAGS: -L${SRCDIR}/../mason_packages/.link/lib
#cgo CXXFLAGS: -I${SRCDIR}/c/include
#cgo CXXFLAGS: -I${SRCDIR}/c/mapbox-gl-native/platform/default
#cgo CXXFLAGS: -I${SRCDIR}/c/mapbox-gl-native/include
#cgo LDFLAGS: -lmbgl-filesource
#cgo LDFLAGS: -lmbgl-core
#cgo LDFLAGS: -lsqlite3 -lz
#cgo LDFLAGS: -lmbgl-filesource -lmbgl-core
*/
import "C"

// @cgo CXXFLAGS: -I${SRCDIR}/../mason_packages/.link/include
// @cgo CXXFLAGS: -I${SRCDIR}/../mapbox-gl-native/vendor/expected/include
// @cgo CXXFLAGS: -I${SRCDIR}/../mapbox-gl-native/include
// @cgo CXXFLAGS: -I${SRCDIR}/../mapbox-gl-native/platform/default
// @cgo LDFLAGS: -L${SRCDIR}/../mason_packages/.link/lib
// @cgo LDFLAGS: -lsqlite3 -lz
// @cgo LDFLAGS: -lmbgl-filesource -lmbgl-core
Loading

0 comments on commit f91275e

Please sign in to comment.