# Depends on openssl111
# Depends on curl7611

# Exit on error:
set -e

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

# https://bugs.netsurf-browser.org/mantis/view.php%3Fid%3D2675:
#sed -i -e '/default path to certificates/d' \
#    -e '/nsoption_setnull_charp(ca_path, strdup("\/etc\/ssl\/certs"));/d' \
#    -e '205 d' \
#    -e '210 s/ ||/) {/' \
#    -e '/(nsoption_charp(ca_path) == NULL))/d' \
#    netsurf/frontends/gtk/gui.c

make PREFIX= install
cd ..
#rm -rf netsurf-all-3.9
#rm netsurf-all-3.9.tar.gz

mv /bin/netsurf-gtk /bin/netsurf39

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
