:: krowemoh

Thursday | 26 DEC 2024
Posts Links Other About Now

previous
next

Building Netsurf - Unsuccessfully

2022-08-02

How to build netsurf for Windows on WSL2

This didn't work but it'd be good to have this when I inevitably try again.

This is a hodgepodge of notes.

Helpfull commands to know

$ apt-cache search mingw
$ ls /usr/bin/x86_64-w64-mingw32-* | grep gcc

First Step

$ sudo apt-get update
$ sudo apt-get install texinfo
$ sudo apt-get install gcc-mingw-w64 binutils-mingw-w64 win-iconv-mingw-w64-dev 

I installed these but not sure if it was required

$ sudo apt-get install mingw-w64-tools mingw-w64

Install expat - an xml parser library for netsurf

$ git clone https://github.com/libexpat/libexpat.git
$ cd libexpat/expat
$ ./buildconf.sh
$ ./configure --host=x86_64-w64-mingw32 --prefix=/usr/x86_64-w64-mingw32/
$ make
$ sudo make install
$ wget https://git.netsurf-browser.org/netsurf.git/plain/docs/env.sh
$ unset HOST
$ export HOST=x86_64-w64-mingw32
$ source env.sh
$ ns-package-install

// Sourcing of the env.sh is adding in netsurf specific commands

$ ns-clone
$ ns-pull-install
$ rm env.sh
$ cd ~/dev-netsurf/workspace
$ export HOST=x86_64-w64-mingw32
$ source env.sh
$ cd netsurf
$ cat Makefile.defaults

// Disable things you don't want

$ export MINGW_PREFIX=x86_64-w64-mingw32-
$ export MINGW_INSTALL_ENV=/usr/x86_64-w64-mingw32/
# inside Makefile, don't use pkg_config_find_and_add, copy the mint curl option
$  make TARGET=windows PREFIX=/usr/x86_64-w64-mingw32/

copied the makefile from the toolchains folder and trying that, I overwrote the original makefile which could be a problem.... - crap toolchain seems to be building everything itself. Was i wasting my time?

libcares

$ wget https://c-ares.org/download/c-ares-1.18.1.tar.gz
$ tar xvf c-ares-1.18.1.tar.gz
$ cd c-ares-1.18.1
$ export HOST=x86_64-w64-mingw32
$ ./configure --prefix=/usr/x86_64-w64-mingw32/ --host=x86_64-w64-mingw32

Might be needed
$ ln -s /usr/x86_64-w64-mingw32/lib/libmsvcrt.a  /usr/x86_64-w64-mingw32/lib/libc.a

$ make
$ sudo make install

libcurl

$ cd ~/bp
$ wget https://curl.se/download/curl-7.84.0.tar.gz
$ LDFLAGS=-mwindows ./configure --prefix=/usr/x86_64-w64-mingw32/ --host=x86_64-w64-mingw32 --disable-shared --disable-ldap --without-random --with-openssl
$ make
$ sudo make install

zlib

$ vim /etc/apt/sources.list
// Add deb-src 
deb-src http://archive.ubuntu.com/ubuntu/ focal main restricted

$ cd ~/bp
$ apt-get source zlib
$ cd zlib-1.2.11.dfsg/
$ CC=x86_64-w64-mingw32-gcc AR=x86_64-w64-mingw32-gcc-ar RANLIB=x86_64-w64-mingw32-gcc-ranlib CFLAGS="-DNO_FSEEKO" ./configure --prefix=/usr/x86_64-w64-mingw32/
#update Make file -lc to -lmsvcrt.a
$ make
$sudo make install

libiconv

$ cd ~/bp
$ wget https://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.17.tar.gz
$ tar xvf libiconv-1.17.tar.gz
$ ./configure --prefix=/usr/x86_64-w64-mingw32/ --host=x86_64-w64-mingw32 --disable-shared
$ make
$ sudo make install

OpenSSL

$ sudo ln -s /usr/bin/x86_64-w64-mingw32-windres /usr/bin/windres 

$ cd ~/bp
$ wget wget http://www.openssl.org/source/openssl-1.0.0a.tar.gz
$ tar xvf openssl-1.0.0a.tar.gz
$ cd openssl-1.0.0a

This might be optional - I originally tried to use the latest version of opensll and installed wine to get headers
$ sudo apt-get install libwine-dev
# update /home/nivethan/bp/openssl-1.1.1q/apps/openssl.rc
# change the include to the path through wine
#include "/usr/include/wine/wine/windows/winver.h"

#update winver.h to use absolute path
#include "/usr/include/wine/wine/windows/verrsrc.h"

# had to update the Configure script to remove -mno-cygwin

$ PATH=/usr/x86_64-w64-mingw32/bin/:$PATH ./Configure no-shared disable-capieng --prefix=/usr/x86_64-w64-mingw32/ mingw64
$ PATH=/usr/x86_64-w64-mingw32/bin/:$PATH make CC=x86_64-w64-mingw32-gcc RANLIB=x86_64-w64-mingw32-gcc-ranlib
$ sudo make install_sw # install without man pages

regexhttps://osdn.net/projects/sfnet_ezwinports/downloads/Dependencies/mingw-libgnurx-2.5.1-src.tar.gz/

$ tar xvf mingw-libgnurx-2.5.1-src.tar.gz
$ cd mingw-libgnurx-2.5.1/
$ ./configure --prefix=/usr/x86_64-w64-mingw32/ --host=x86_64-w64-mingw32
$ make
$ sudo make install

libjpeg

$ wget http://www.ijg.org/files/jpegsrc.v8d.tar.gz
$ tar xvf jpegsrc.v8d.tar.gz
$ cd jpeg-8d/
$ ./configure --prefix=/usr/x86_64-w64-mingw32/ --host=x86_64-w64-mingw32 --disable-shared
$ make
$ sudo make install

libpnghttps://sourceforge.net/projects/libpng/files/libpng14/older-releases/1.4.12/

$ tar xvf libpng-1.4.12.tar.gz
$ ./configure --prefix=/usr/x86_64-w64-mingw32/ --host=x86_64-w64-mingw32
$ make
$ sudo make install

Toolchain

$ sudo apt-get install build-essential autoconf automake autogen flex bison
$ sudo apt-get install libtool texinfo help2man subversion cvs git
$ sudo apt-get install lhasa unzip autoconf2.64 automake1.11
$ sudo apt-get install automake-1.15

$ git clone git://git.netsurf-browser.org/toolchains
$ cd toolchains
$ make -C x86_64-w64-mingw32
$ GCCSDK_INSTALL_CROSSBIN=/opt/netsurf/i686-w64-mingw32/cross/bin GCCSDK_INSTALL_ENV=/opt/netsurf/i686-w64-mingw32/env make -C sdk