# cross build go from debian buster:
mkdir -p /usr/src/tmp/
cd /usr/src/tmp
wget 'https://dl.google.com/go/go1.4.linux-amd64.tar.gz'
tar xfvz go1.4.linux-amd64.tar.gz
mkdir -p /usr/src/git/github/4ad
cd /usr/src/git/github/4ad
git clone git@github.com:4ad/go.git
cd go/src
GOROOT_BOOTSTRAP=/usr/src/tmp/go GOOS=solaris GOARCH=sparc64 ./make.bash
file ../bin/solaris_sparc64/go
../bin/solaris_sparc64/go: ELF 64-bit MSB executable, SPARC V9, total store ordering, version 1 (Solaris), dynamically linked, interpreter /usr/lib/sparcv9/ld.so.1, Go BuildID=3e56fb7f97effd2a01c748122904434c1f5befdf, not stripped
# https://docs.oracle.com/cd/E36784_01/html/E49624/gnwql.html
# Download your personal key and certificate files, called
# pkg.oracle.com.key.pem and pkg.oracle.com.certificate.pem from the
# certificate page
# https://pkg-register.oracle.com/register/certificate/
# sudo pkg set-publisher \
# -k ~/Desktop/pkg.oracle.com.key.pem \
# -c ~/Desktop/pkg.oracle.com.certificate.pem \
# -G "*" -g https://pkg.oracle.com/solarisstudio/release solarisstudio
# pkg list -a pkg://solarisstudio/*
# pkg install solarisstudio-124
CFLAGS="-m64" # if you're using GCC
CPPFLAGS="-I/opt/csw/include"
LDFLAGS="-L/opt/csw/lib/64 -R/opt/csw/lib/64"
PKG_CONFIG_PATH="/opt/csw/lib/64/pkgconfig"
export CFLAGS CPPFLAGS LDFLAGS PKG_CONFIG_PATH
# host=x86_64-pc-solaris2.12
#
MVN_VERSION=3.6.3
#MVN_VERSION=2.2.1
cd /tmp
wget "http://apache.claz.org/maven/maven-3/${MVN_VERSION}/binaries/apache-maven-${MVN_VERSION}-bin.tar.gz"
#wget "http://archive.apache.org/dist/maven/binaries/apache-maven-${MVN_VERSION}-bin.tar.gz"
cd /opt
tar xfvz /tmp/apache-maven-${MVN_VERSION}-bin.tar.gz
export M2_HOME=/opt/apache-maven-${MVN_VERSION}
export PATH="${M2_HOME}/bin:/usr/bin/:/usr/sbin"
#wget 'http://mirror.opencsw.org/opencsw/allpkgs/maven2-2.0.10%2cREV%3d2009.04.09-SunOS5.8-all-CSW.pkg.gz'
pkgadd -d http://get.opencsw.org/now
/opt/csw/bin/pkgutil -U
PKG="maven automake autoconf libtool openssl perl ninja go"
PKG="${PKG} cmake gsed ggrep gawk libapr1_0" gcc4core gcc4g++"
for pkg in ${PKG}
do
/opt/csw/bin/pkgutil -y -i ${pkg}
done
# pkgutil -r gcc4core gcc4g++ # using solaris build tools instead
export MVN_VERSION=3.6.3
export PATH=/opt/csw/bin:/opt/solarisstudio12.4/bin:/opt/apache-maven-${MVN_VERSION}/bin:/usr/bin/:/usr/sbin
export PATH="/opt/csw/bin:$PATH"
cd /usr/src
git clone git@github.com:fusesource/hawtjni.git
cd hawtjni
patch -p1 < hawtjni-solaris.diff
#perl -i -pe 's:hawtjni-website::' pom.xml
#perl -i -pe 's:#!/bin/sh:#!/bin/bash:' $(find . -name 'autogen.sh')
#chmod a+x $(find . -name 'autogen.sh')
#find . -name 'autogen.sh' -exec chmod a+x \{\} \;
mvn clean -e install
#mvn install:install-file -Dfile=$(find /usr/src/hawtjni -name 'maven-hawtjni-plugin-1.18-SNAPSHOT.jar') \
#-DgroupId=org.fusesource.hawtjni -DartifactId=maven-hawtjni-plugin -Dversion=1.18 \
#-Dpackaging=jar -DlocalRepositoryPath=/usr/src/main/resources/repo
cd ..
git clone git@github.com:netty/netty-tcnative.git
cd netty-tcnative
patch -p1 < netty-tcnative-solaris.diff
# on sparc: mvn -Dcontainer-executor.additional_cflags="-mcpu=v9a" package
mvn package
mvn clean -e install