FreeBSD GTK+2 build

Talk about code development, features, specific bugs, enhancements, patches, and similar things.
Forum rules
Please keep everything here strictly on-topic.
This board is meant for Pale Moon source code development related subjects only like code snippets, patches, specific bugs, git, the repositories, etc.

This is not for tech support! Please do not post tech support questions in the "Development" board!
Please make sure not to use this board for support questions. Please post issues with specific websites, extensions, etc. in the relevant boards for those topics.

Please keep things on-topic as this forum will be used for reference for Pale Moon development. Expect topics that aren't relevant as such to be moved or deleted.
User avatar
hexagonwin
Newbie
Newbie
Posts: 5
Joined: 2023-04-30, 16:18

FreeBSD GTK+2 build

Unread post by hexagonwin » 2023-04-30, 16:23

Hello. I'm currently using FreeBSD 13.2-RELEASE amd64 on my computer.
It appears to be that Pale Moon now supports FreeBSD, which I'm very glad.
Unfortunately I do not like GTK+3 as it is much heavier than GTK+2 and breaks my themes. Even on GNU/Linux, I'm using Pale Moon's GTK+2 builds for this reason.
The binary provided on the Pale Moon download page for FreeBSD appears to be built with GTK+3. Also, it is built with dbus and pulseaudio enabled, which I do not have on my system.
It would be great if there is a build instruction provided somewhere (or a FreeBSD ports file) so that I can build Pale Moon to fit my needs. Can this be done? I was unable to find build instructions for FreeBSD.

dbsoft
Project Contributor
Project Contributor
Posts: 407
Joined: 2020-02-21, 17:35

Re: FreeBSD GTK+2 build

Unread post by dbsoft » 2023-05-01, 05:23

hexagonwin wrote:
2023-04-30, 16:23
It would be great if there is a build instruction provided somewhere (or a FreeBSD ports file) so that I can build Pale Moon to fit my needs. Can this be done? I was unable to find build instructions for FreeBSD.
Can see about making GTK2 builds, but I don't use GTK2 personally... I was planning on trying to resurrect the port, but due to the python2/tauthon build dependencies it might be tough. The FreeBSD build instructions are basically the same as Linux, this is the .mozconfig I use currently:

Code: Select all

# Set GTK Version to 2 or 3
_GTK_VERSION=3

# Standard build options for Pale Moon
ac_add_options --enable-application=palemoon
ac_add_options --enable-optimize="-O3 -w"
ac_add_options --enable-default-toolkit=cairo-gtk$_GTK_VERSION
ac_add_options --enable-jemalloc
ac_add_options --enable-strip
ac_add_options --enable-devtools
ac_add_options --enable-av1
ac_add_options --enable-jxl
ac_add_options --disable-eme
ac_add_options --disable-webrtc
ac_add_options --disable-gamepad
ac_add_options --disable-tests
ac_add_options --disable-debug
ac_add_options --disable-necko-wifi
ac_add_options --disable-updater
ac_add_options --with-pthreads

# Please see https://www.palemoon.org/redist.shtml for restrictions when using the official branding.
#ac_add_options --enable-official-branding
#export MOZILLA_OFFICIAL=1
ac_add_options --with-branding=palemoon/branding/beta

User avatar
hexagonwin
Newbie
Newbie
Posts: 5
Joined: 2023-04-30, 16:18

Re: FreeBSD GTK+2 build

Unread post by hexagonwin » 2023-05-12, 13:56

dbsoft wrote:
2023-05-01, 05:23
Can see about making GTK2 builds, but I don't use GTK2 personally... I was planning on trying to resurrect the port, but due to the python2/tauthon build dependencies it might be tough. The FreeBSD build instructions are basically the same as Linux, this is the .mozconfig I use currently:
jmos on the FreeBSD Forums is maintaining a port for SeaMonkey on FreeBSD which also requires python2 as a dependency. He's simply using the python2 port right before the removal and it seems to work, if we're not trying to get Palemoon on the official FreeBSD ports tree I don't think this will be of an issue. python2 is only used in the build process AFAIK so it won't cause much problems on the actual program..

I'll see if I can build this on my machine with GTK+2. Thanks a lot.

dbsoft
Project Contributor
Project Contributor
Posts: 407
Joined: 2020-02-21, 17:35

Re: FreeBSD GTK+2 build

Unread post by dbsoft » 2023-05-12, 17:22

hexagonwin wrote:
2023-05-12, 13:56
jmos on the FreeBSD Forums is maintaining a port for SeaMonkey on FreeBSD which also requires python2 as a dependency. He's simply using the python2 port right before the removal and it seems to work, if we're not trying to get Palemoon on the official FreeBSD ports tree I don't think this will be of an issue. python2 is only used in the build process AFAIK so it won't cause much problems on the actual program..
That is what I am doing as well, but when referring to "ports" in a FreeBSD context they are generally talking about the "port system" which tells FreeBSD how to build an application from source. Those require the build requirements be in the ports as well. Since python2 has been removed from ports any ports depending on it are broken. We fall into that category. The only option is to use something still maintained like tauthon. A tauthon port was done years ago for that purpose but the maintainer of that has stopped so... will require that be maintained as well for it to be an official port.

User avatar
hexagonwin
Newbie
Newbie
Posts: 5
Joined: 2023-04-30, 16:18

Re: FreeBSD GTK+2 build

Unread post by hexagonwin » 2023-05-21, 08:16

I see that you have now uploaded a GTK+2 test binary as well but unfortunatly it's built with dbus / gconf support and thus doesn't meet my use case.
I've tried to build latest PM based on the mozconfig you provided here, however I'm encountering a weird error.
The following is my .mozconfig :

Code: Select all

# Set GTK Version to 2 or 3
_GTK_VERSION=2

# Standard build options for Pale Moon
ac_add_options --enable-application=palemoon
ac_add_options --enable-optimize="-O3 -w"
ac_add_options --enable-default-toolkit=cairo-gtk$_GTK_VERSION

ac_add_options --enable-jemalloc
ac_add_options --enable-strip
ac_add_options --enable-devtools
ac_add_options --enable-av1
ac_add_options --enable-jxl

ac_add_options --disable-eme
ac_add_options --disable-webrtc
ac_add_options --disable-gamepad
ac_add_options --disable-tests
#ac_add_options --disable-debug
ac_add_options --disable-dbus
ac_add_options --disable-pulseaudio
ac_add_options --disable-gconf
ac_add_options --disable-necko-wifi
ac_add_options --disable-updater

ac_add_options --with-pthreads

# Please see https://www.palemoon.org/redist.shtml for restrictions when using the official branding.
#ac_add_options --enable-official-branding
#export MOZILLA_OFFICIAL=1
ac_add_options --with-branding=palemoon/branding/beta
And this error happens when I do ./mach configure (or ./mach build)

Code: Select all

 USE_LIBS contains "static:js", but there is only a shared "js" in js/src. You may want to add FORCE_STATIC_LIB=True in js/src/moz.build, or remove "static:".
The full log can be found at https://termbin.com/sqth .

Could you please help me solve this problem? I'm not familiar with mozilla build system and I don't understand why that happens.
Thanks.

User avatar
bSun0000
Apollo supporter
Apollo supporter
Posts: 36
Joined: 2022-03-22, 23:32

Re: FreeBSD GTK+2 build

Unread post by bSun0000 » 2023-05-21, 14:53

A few notes for your .mozconfig:

Add this:

Code: Select all

_BUILD_64=1
You don't want x86 build, isnt?

Check this pathes and add this to your config:

Code: Select all

export CC=gcc-11
export CXX=g++-11

mk_add_options PYTHON=/usr/bin/python2
mk_add_options AUTOCONF=/usr/bin/autoconf-2.13
Replace -11 with the version of your GCC. 9, 10 and 11 will work just fine. 12/13 - questionable.

Code: Select all

ac_add_options --enable-optimize="-O3 -w"
Its better to keep it -O2. O3 is not that great as you may think and usually only makes binaries fattier without any additional benefits.
If you want some additional optimizations, keep it simple:

Code: Select all

ac_add_options --enable-optimize="-march=native -mtune=native -O2 -w -finline-functions -ftree-partial-pre -fpredictive-commoning -mtls-dialect=gnu2"
Remove -mtls-dialect=gnu2 if it does not work on your system. This 3 flags "-finline-functions -ftree-partial-pre -fpredictive-commoning" is from -O3 option, leaving behind things like loop unrolling. march && mtune will fine tune some gcc options to match your processor - this is good for performance but can/will prevent from running it on other computers.

Code: Select all

ac_add_options --disable-pulseaudio
add this:

Code: Select all

ac_add_options --enable-alsa
If i'm correct alsa is not enabled by default even if you disable pulse.

Uncomment this:

Code: Select all

ac_add_options --disable-debug
And add this:

Code: Select all

ac_add_options --enable-release
If you don't care about debugging i would also recommend you adding this on top:

Code: Select all

ac_add_options --disable-debug-symbols
ac_add_options --disable-debug-js-modules
It will speed-up the compilation and reduce the amount of disk/ram memory required for compilation (significantly!)

Your config is missing this as well:

Code: Select all

# Processor architecture specific build options
if [ -n "$_BUILD_64" ]; then
  ac_add_options --x-libraries=/usr/lib64
else
  ac_add_options --x-libraries=/usr/lib
fi

export MOZ_PKG_SPECIAL=gtk$_GTK_VERSION
If you want to compile in a single or multiple threads, add this:

Code: Select all

mk_add_options MOZ_MAKE_FLAGS="-j1"
And replace -j1 with the number of cores of your processor you want to use for compilation.
Last edited by bSun0000 on 2023-05-21, 14:59, edited 1 time in total.

User avatar
bSun0000
Apollo supporter
Apollo supporter
Posts: 36
Joined: 2022-03-22, 23:32

Re: FreeBSD GTK+2 build

Unread post by bSun0000 » 2023-05-21, 14:55

It looks like you'r trying to use clang but you should compile this browser using GCC (only).

Check this page: https://developer.palemoon.org/build/linux/

And install all required dependencies first.

dbsoft
Project Contributor
Project Contributor
Posts: 407
Joined: 2020-02-21, 17:35

Re: FreeBSD GTK+2 build

Unread post by dbsoft » 2023-05-21, 19:53

Ok there is a lot of stuff wrong with your comments. All that BUILD_64 stuff is required on Linux but not on FreeBSD. It should absolutely use clang on FreeBSD. -O3 is what Mozilla uses with clang, not saying -O2 is bad, it performs well but the performance to size difference between -O3 and -O2 is not that bad.

Not sure why the person is getting the sed error with the .mozconfig they posted. Looks like it was parsing the system NSPR option which I didn't see listed in their .mozconfig.

dbsoft
Project Contributor
Project Contributor
Posts: 407
Joined: 2020-02-21, 17:35

Re: FreeBSD GTK+2 build

Unread post by dbsoft » 2023-05-21, 20:08

hexagonwin wrote:
2023-05-21, 08:16
Could you please help me solve this problem? I'm not familiar with mozilla build system and I don't understand why that happens.
There should be a config.log somewhere in the "obj" directory, can you upload that log? I suspect the sed error is causing problems.... the error it reported further down does not seem accurate.

User avatar
bSun0000
Apollo supporter
Apollo supporter
Posts: 36
Joined: 2022-03-22, 23:32

Re: FreeBSD GTK+2 build

Unread post by bSun0000 » 2023-05-22, 13:17

dbsoft wrote:
2023-05-21, 19:53
Ok there is a lot of stuff wrong with your comments. All that BUILD_64 stuff is required on Linux but not on FreeBSD. It should absolutely use clang on FreeBSD. -O3 is what Mozilla uses with clang, not saying -O2 is bad, it performs well but the performance to size difference between -O3 and -O2 is not that bad.

Not sure why the person is getting the sed error with the .mozconfig they posted. Looks like it was parsing the system NSPR option which I didn't see listed in their .mozconfig.
Thats unexpected. Palemoon is compatible with clang or its just freebsd-specific? Instructions on the website clearly needs an update, including bsd/mac compilation.

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 35477
Joined: 2011-08-28, 17:27
Location: Motala, SE
Contact:

Re: FreeBSD GTK+2 build

Unread post by Moonchild » 2023-05-22, 13:41

bSun0000 wrote:
2023-05-22, 13:17
Instructions on the website clearly needs an update, including bsd/mac compilation.
We don't necessarily do hand-holding for people to spin their own.
Mac and BSD has only very recently been added as a target platform, with BSD even more so in beta. All of this has been primarily dbsoft's efforts and assuming you can use Linux instructions for BSD is actually quite the misconception as they operate quite differently.

If you feel that strongly about it though, you are free to contribute documentation! :)
https://repo.palemoon.org/MoonchildProductions/selene
"Sometimes, the best way to get what you want is to be a good person." -- Louis Rossmann
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite

dbsoft
Project Contributor
Project Contributor
Posts: 407
Joined: 2020-02-21, 17:35

Re: FreeBSD GTK+2 build

Unread post by dbsoft » 2023-05-22, 14:11

bSun0000 wrote:
2023-05-22, 13:17
Thats unexpected. Palemoon is compatible with clang or its just freebsd-specific? Instructions on the website clearly needs an update, including bsd/mac compilation.
All my Mac and FreeBSD builds are with clang, it is the system compiler on those platforms. I have also done clang builds on Linux, but gcc is obviously preferred on Linux since most Linux distributions use gcc as their system compiler.

When i tried to build Pale Moon on FreeBSD with gcc I actually had problems with it, I can't remember what the problems were now... but I remember FreeBSD no longer had the old hash list functions for use with the system compiler, so I tried to build with gcc and I had other issues. Pale Moon now uses the new C++ versions of those and there should be no issue using clang on FreeBSD.

I suppose it is an over simplification to say the instructions are the same on Linux. But all the tools required to install are the same, just using the FreeBSD pkg command to install them instead of the package manager for whatever Linux distribution. If you install all the same packages and use my .mozconfig the rest of the instructions should be the same.

I have the current Mac instructions hosted on my personal site, I'll move them over to the Pale Moon site and make a FreeBSD one that doesn't require you do some on the fly command conversion. :P

User avatar
hexagonwin
Newbie
Newbie
Posts: 5
Joined: 2023-04-30, 16:18

Re: FreeBSD GTK+2 build

Unread post by hexagonwin » 2023-05-26, 14:51

dbsoft wrote:
2023-05-21, 20:08
There should be a config.log somewhere in the "obj" directory, can you upload that log?
Hi, sorry it took so long. Here is my config.log : https://termbin.com/nyi9

Additionally, I don't really use Alsa either, I actually have OSS. Firefox on FreeBSD has OSS support but SeaMonkey for example doesn't and I don't get audio there, can we have the OSS patch merged as well like FF? It would be great :)

Locked