# Depends on openssl111
# Depends on curl7611

# Some icons are missing

# Exit on error:
set -e

#wget http://download.netsurf-browser.org/netsurf/releases/source-full/netsurf-all-3.10.tar.gz
tar xf netsurf-all-3.10.tar.gz
cd netsurf-all-3.10

# Use of openssl 1.1.1 fixes the following messages:
# content/fetchers/curl.c:648:8: error: "X509_V_ERR_HOSTNAME_MISMATCH"
# undeclared (first use in this function)
# content/fetchers/curl.c:769:42: error: "X509_CHECK_FLAG_NO_PARTIAL_WILDCARDS"
# undeclared (first use in this function)

make PREFIX=/local install
cd ..
rm -rf netsurf-all-3.10
#rm netsurf-all-3.10.tar.gz

mv /local/bin/netsurf-gtk2 /local/bin/netsurf310

echo '**************************************************************'
echo '* If you get the following message:                          *'
echo '* Problem with the SSL CA cert (path? access rights?)        *'
echo '*                                                            *'
echo '* Be sure to have your CA certificates in the expected file: *'
echo '* curl-config --ca                                           *'
echo '*                                                            *'
echo '* wget https://curl.se/ca/cacert-2022-02-01.pem              *'
echo '* mv cacert-2022-02-01.pem /etc/ssl/cert.pem                 *'
echo '**************************************************************'

exit 0
