ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/ozone/mgar/pkg/basilisk/Makefile
Revision: 31
Committed: Mon Jun 22 13:11:15 2026 UTC (4 weeks, 1 day ago) by operz
File size: 14712 byte(s)
Log Message:
basilisk: add Thread.cpp/arc4random/atk-bridge/ld-wrapper fixes for OpenSolaris snv_111b

File Contents

# User Rev Content
1 operz 29 # vim: ft=make ts=4 sw=4 noet
2     .DEFAULT_GOAL := all
3    
4     NAME = basilisk
5     VERSION = euxp
6     GARTYPE = v2
7    
8     DESCRIPTION = Basilisk browser (UXP/GTK3) tracking the euxp branch
9     define BLURB
10     Basilisk is a web browser based on the Unified XUL Platform (UXP),
11     a fork of Mozilla Firefox 52 ESR. This build tracks the euxp branch.
12     endef
13    
14 operz 31 # Source comes from git (recursive clone for platform/ submodule).
15     # No DISTFILES — fetch/checksum/extract are no-ops; post-extract does the clone.
16     DISTFILES =
17     DISTNAME = basilisk-mirror-euxp
18 operz 29
19     LICENSE = LICENSE
20    
21 operz 31 BUILD_DEP_PKGS += OZSWgit OZSWgcc12 OZSWpkgconf OZSWpy311
22 operz 29 BUILD_DEP_PKGS += OZSWgtk3 OZSWcairo OZSWpango OZSWglib
23     BUILD_DEP_PKGS += OZSWlibX11 OZSWlibXt OZSWlibXext OZSWlibXft OZSWlibXrender OZSWlibXmu
24     BUILD_DEP_PKGS += OZSWfreetype OZSWfontconfig OZSWlibpng OZSWlibjpeg OZSWzlib
25    
26     PACKAGES += OZSWbasilisk
27     SPKG_DESC_OZSWbasilisk = Basilisk browser (UXP, GTK3, euxp branch)
28     CATALOGNAME_OZSWbasilisk = basilisk
29     RUNTIME_DEP_PKGS_OZSWbasilisk += OZSWgcc12rt OZSWzlib
30     RUNTIME_DEP_PKGS_OZSWbasilisk += OZSWgtk3 OZSWcairo OZSWpango OZSWglib
31     RUNTIME_DEP_PKGS_OZSWbasilisk += OZSWlibX11 OZSWlibXt OZSWlibXext OZSWlibXft OZSWlibXrender
32     RUNTIME_DEP_PKGS_OZSWbasilisk += OZSWfreetype OZSWfontconfig OZSWlibpng OZSWlibjpeg
33    
34 operz 31 # UXP/mach handles configure and build — skip GAR's defaults
35     CONFIGURE_SCRIPTS =
36     BUILD_SCRIPTS =
37     INSTALL_SCRIPTS =
38    
39 operz 29 post-extract:
40 operz 31 @echo "==> Cloning Basilisk euxp branch with platform submodule"
41     @if [ ! -d $(WORKSRC)/.git ]; then \
42     $(MKDIRS) $(WORKDIR); \
43     git clone -b euxp --single-branch --recursive --depth=1 \
44     https://github.com/Basilisk-Development-Team/basilisk-mirror.git \
45     $(WORKSRC); \
46     fi
47     @echo "==> Creating /opt/ozsw/bin helper symlinks"
48     @test -f /opt/ozsw/bin/grep || sudo ln -s /usr/bin/ggrep /opt/ozsw/bin/grep
49     @test -f /opt/ozsw/bin/pkg-config || sudo ln -s /opt/ozsw/bin/pkgconf /opt/ozsw/bin/pkg-config
50     @test -f /opt/ozsw/bin/python || sudo ln -s /opt/ozsw/bin/python3 /opt/ozsw/bin/python
51     @echo "==> Patching for Python 3 and Solaris"
52     @gsed -i "s/error = e\.message/error = str(e)/" \
53     $(WORKSRC)/platform/build/moz.configure/checks.configure
54     @printf '#!/bin/sh\nexec /opt/ozsw/bin/python3 "$$(dirname "$$0")/platform/mach" "$$@"\n' \
55     > $(WORKSRC)/mach
56     @chmod +x $(WORKSRC)/mach
57     @/opt/ozsw/bin/python3 /opt/ozsw/lib/ozsw-patch-mach.py $(WORKSRC)/platform/mach
58     @gsed -i 's|PYTHON ?= $$(shell which python3 > /dev/null 2>&1 && echo python3 || echo python)|PYTHON ?= /opt/ozsw/bin/python3|' \
59     $(WORKSRC)/client.mk
60     @# Fix mozconfig.py IGNORE_SHELL_VARIABLES: bash internal arrays (BASH_ARGC etc.)
61     @# pollute old-configure.vars via 'set' output after .mozconfig functions run
62     @gsed -i "s/ IGNORE_SHELL_VARIABLES = {'_'}/ IGNORE_SHELL_VARIABLES = {'_', 'BASH_ARGC', 'BASH_ARGV', 'BASH_LINENO', 'BASH_SOURCE', 'BASH_VERSINFO', 'DIRSTACK', 'FUNCNAME', 'GROUPS', 'PIPESTATUS', 'BASH_REMATCH', '_mozconfig_opt', '_mozconfig_name', '_mozconfig_op', '_mozconfig_app', 'opt'}/" \
63     $(WORKSRC)/platform/python/mozbuild/mozbuild/mozconfig.py
64     @# Fix platform/old-configure: fallback PYTHON if old-configure.vars sourcing aborted
65     @gsed -i '12a # OZSW: ensure PYTHON is set even if old-configure.vars sourcing aborted early\n: $${PYTHON:=/opt/ozsw/bin/python3}' \
66     $(WORKSRC)/platform/old-configure
67     @# Fix NSPR moz.build for SunOS: missing OS_LIBS (-lnsl -lsocket -lrt -ldl).
68     @# Also replace _PR_HAVE_OFF64_T with _PR_NO_LARGE_FILES: the former makes unix.c
69     @# take a direct reference to open64@SUNW_1.1 which GNU ld on OpenSolaris
70     @# mishandles, producing "invalid version 15 (max 0)" link errors.
71     @/opt/ozsw/bin/python3 -c "\
72     path='$(WORKSRC)/platform/config/external/nspr/pr/moz.build'; \
73     c=open(path).read(); \
74     c=c.replace(\" _PR_HAVE_OFF64_T=True,\", \" _PR_NO_LARGE_FILES=True, # open64@SUNW_1.1 confuses GNU ld\"); \
75     c=c.replace(\" DEFINES['SOLARIS'] = True\", \" DEFINES['SOLARIS'] = True\n OS_LIBS += ['-lpthread', '-lsocket', '-lnsl', '-lrt', '-ldl', '-lc']\"); \
76     open(path,'w').write(c)"
77     @# Fix search moz.build: basilisk overrides all platform search components
78     @printf '# OZSW: all search components overridden by basilisk/components/search/service/\n' \
79     > $(WORKSRC)/platform/toolkit/components/search/moz.build
80     @# Fix Chromium IPC: pthread_setname_np not available on OpenSolaris 2009 (snv_111b)
81     @/opt/ozsw/bin/python3 -c "\
82     path='$(WORKSRC)/platform/ipc/chromium/src/base/platform_thread_posix.cc'; \
83     c=open(path).read(); \
84     old='#elif defined(OS_SOLARIS)\n pthread_setname_np(pthread_self(), name);'; \
85     new='#elif defined(OS_SOLARIS)\n /* pthread_setname_np not available on OpenSolaris 2009 */'; \
86     open(path,'w').write(c.replace(old,new))"
87     @# Fix Skia GrAutoLocaleSetter.h: uselocale/freelocale/newlocale/locale_t not on
88     @# OpenSolaris 2009 (snv_111b). Disable HAVE_LOCALE_T for __sun the same way it
89     @# is disabled for Android/uclibc/newlib.
90     @gsed -i 's/#if defined(SK_BUILD_FOR_ANDROID) || defined(__UCLIBC__) || defined(_NEWLIB_VERSION)/#if defined(SK_BUILD_FOR_ANDROID) || defined(__UCLIBC__) || defined(_NEWLIB_VERSION) || defined(__sun)/' \
91     $(WORKSRC)/platform/gfx/skia/skia/src/gpu/GrAutoLocaleSetter.h
92     @# Fix libjxl color_encoding_internal.h: Solaris sys/regset.h (pulled in via
93     @# <sys/ucontext.h> when __EXTENSIONS__ is set) defines CS=15, conflicting with
94     @# the local 'using CS = ColorSpace' alias. Undef it just before the alias.
95     @/opt/ozsw/bin/python3 -c "\
96     path='$(WORKSRC)/platform/media/libjxl/src/lib/jxl/color_encoding_internal.h'; \
97     c=open(path).read(); \
98     old=' using CS = ColorSpace;'; \
99     new='#ifdef CS\n#undef CS /* Solaris sys/regset.h defines CS=15 */\n#endif\n using CS = ColorSpace;'; \
100     open(path,'w').write(c.replace(old,new))"
101     @# Fix js/src/threading/posix/Thread.cpp: pthread_setname_np absent on OpenSolaris snv_111b.
102     @# Add __sun no-op before the #else branch that calls it unconditionally.
103     @gsed -i 's/#elif defined(__NetBSD__)$$/#elif defined(__sun)\\n \/* pthread_setname_np absent on OpenSolaris snv_111b *\/\\n#elif defined(__NetBSD__)/' \\
104     $(WORKSRC)/platform/js/src/threading/posix/Thread.cpp
105     @# Fix libevent bundled Solaris event-config.h: arc4random incorrectly marked available.
106     @gsed -i 's/^#define _EVENT_HAVE_ARC4RANDOM 1$$/\/\* #undef _EVENT_HAVE_ARC4RANDOM *\/ \/\* absent on OpenSolaris snv_111b *\//' \\
107     $(WORKSRC)/platform/ipc/chromium/src/third_party/libevent/solaris/event2/event-config.h
108     @gsed -i 's/^#define _EVENT_HAVE_ARC4RANDOM_BUF 1$$/\/\* #undef _EVENT_HAVE_ARC4RANDOM_BUF *\/ \/\* absent on OpenSolaris snv_111b *\//' \\
109     $(WORKSRC)/platform/ipc/chromium/src/third_party/libevent/solaris/event2/event-config.h
110     @# Fix libopus silk/resampler_private.h: Solaris sys/regset.h also defines SS=18
111     @# (x86 stack-segment register index), conflicting with the 'SS' parameter name.
112     @/opt/ozsw/bin/python3 -c "\
113     path='$(WORKSRC)/platform/media/libopus/silk/resampler_private.h'; \
114     c=open(path).read(); \
115     old='#ifndef SILK_RESAMPLER_PRIVATE_H\n#define SILK_RESAMPLER_PRIVATE_H'; \
116     new='#ifndef SILK_RESAMPLER_PRIVATE_H\n#define SILK_RESAMPLER_PRIVATE_H\n/* Solaris sys/regset.h defines SS=18 (x86 stack segment register index) */\n#ifdef SS\n#undef SS\n#endif'; \
117     open(path,'w').write(c.replace(old,new))"
118     @# Fix libpng moz.build: -std=c89 + _XOPEN_SOURCE=600 is rejected by Solaris
119     @# feature_tests.h (XPG6/UNIX 03 requires C99). Use gnu99 on SunOS instead.
120     @gsed -i "s/ CFLAGS += \['-std=c89'\]/ if CONFIG['OS_TARGET'] == 'SunOS':\n CFLAGS += ['-std=gnu99'] # c89 + _XOPEN_SOURCE=600 rejected by Solaris feature_tests.h\n else:\n CFLAGS += ['-std=c89']/" \
121     $(WORKSRC)/platform/media/libpng/moz.build
122     @# Fix xpcom nsMemoryReporterManager.cpp: _XOPEN_SOURCE>=500 (set globally) causes
123     @# Solaris to enable large file mode (_FILE_OFFSET_BITS=64), but procfs.h
124     @# explicitly rejects that. Undef the large-file macros before the procfs include.
125     @/opt/ozsw/bin/python3 -c "\
126     path='$(WORKSRC)/platform/xpcom/base/nsMemoryReporterManager.cpp'; \
127     c=open(path).read(); \
128     old='#elif defined(XP_SOLARIS)\n\n#include <procfs.h>'; \
129     new='#elif defined(XP_SOLARIS)\n\n/* Solaris procfs.h rejects _FILE_OFFSET_BITS=64 (set by _XOPEN_SOURCE>=500) */\n#ifdef _FILE_OFFSET_BITS\n#undef _FILE_OFFSET_BITS\n#endif\n#ifdef _LARGEFILE_SOURCE\n#undef _LARGEFILE_SOURCE\n#endif\n#include <procfs.h>'; \
130     open(path,'w').write(c.replace(old,new))"
131 operz 29 @echo "==> Writing .mozconfig"
132     @{ \
133 operz 31 echo '# Basilisk euxp build for OpenSolaris i386 (snv_111b)'; \
134 operz 29 echo 'ac_add_options --enable-application=basilisk'; \
135     echo 'ac_add_options --enable-optimize="-O2 -w"'; \
136     echo 'ac_add_options --disable-official-branding'; \
137     echo 'ac_add_options --enable-default-toolkit=cairo-gtk3'; \
138     echo 'ac_add_options --enable-jemalloc'; \
139     echo 'ac_add_options --enable-strip'; \
140     echo 'ac_add_options --enable-devtools'; \
141     echo 'ac_add_options --enable-av1'; \
142 operz 31 echo 'ac_add_options --disable-pie'; \
143 operz 29 echo 'ac_add_options --disable-webrtc'; \
144     echo 'ac_add_options --disable-gamepad'; \
145     echo 'ac_add_options --disable-tests'; \
146     echo 'ac_add_options --disable-debug'; \
147     echo 'ac_add_options --disable-necko-wifi'; \
148     echo 'ac_add_options --disable-updater'; \
149 operz 31 echo 'ac_add_options --disable-npapi'; \
150     echo 'ac_add_options --disable-dbus'; \
151     echo 'ac_add_options --disable-pulseaudio'; \
152 operz 29 echo 'ac_add_options --with-pthreads'; \
153     echo 'ac_add_options --prefix=$(prefix)'; \
154 operz 31 echo '# Force 32-bit build: OZSW GCC12 target is i386-pc-solaris2.11'; \
155     echo 'ac_add_options --host=i386-pc-solaris2.11'; \
156     echo 'ac_add_options --target=i386-pc-solaris2.11'; \
157     echo 'export CC=/opt/ozsw/bin/gcc'; \
158     echo 'export CXX=/opt/ozsw/bin/g++'; \
159     echo 'export HOST_CC=/opt/ozsw/bin/gcc'; \
160     echo 'export HOST_CXX=/opt/ozsw/bin/g++'; \
161 operz 29 echo ''; \
162     echo 'export BASILISK_VERSION=1'; \
163     echo 'export MOZ_PKG_SPECIAL=gtk3'; \
164 operz 31 echo 'export CONFIG_SHELL=/usr/bin/bash'; \
165 operz 29 echo 'mk_add_options MOZ_MAKE_FLAGS="-j3"'; \
166     echo 'mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/obj-build'; \
167     echo 'export MOZILLA_OFFICIAL=1'; \
168     echo ''; \
169     echo 'ac_add_options --x-libraries=$(BUILD_PREFIX)/lib'; \
170 operz 31 echo 'export PKG_CONFIG_PATH=$(BUILD_PREFIX)/lib/pkgconfig:$(BUILD_PREFIX)/share/pkgconfig'; \
171     echo ''; \
172     echo '# Solaris: _POSIX_C_SOURCE=200809L (from zbuild.h) not handled by old'; \
173     echo '# feature_tests.h; _XOPEN_SOURCE=600 gets _XPG6 so C99 + POSIX is valid.'; \
174     echo '# __EXTENSIONS__ exposes Solaris-specific APIs (madvise, MADV_DONTNEED etc.)'; \
175     echo 'export CFLAGS="-D_XOPEN_SOURCE=600 -D__EXTENSIONS__"'; \
176     echo 'export CXXFLAGS="-D_XOPEN_SOURCE=600 -D__EXTENSIONS__"'; \
177 operz 29 } > $(WORKSRC)/.mozconfig
178     @$(MAKECOOKIE)
179    
180 operz 31 pre-build:
181     @echo "==> Configuring Basilisk with mach"
182     cd $(WORKSRC) && \
183     PATH="/opt/ozsw/bin:/opt/oz/bin:/usr/bin:/bin:/usr/sfw/bin:/usr/ccs/bin" \
184     MOZCONFIG=$(WORKSRC)/.mozconfig \
185     /opt/ozsw/bin/python3 ./platform/mach configure
186     @echo "==> Setting up ld wrapper and patching system_wrappers/sys/regset.h"
187     @# GNU ld 2.45 on Solaris records SUNW_x.y versioned symbol refs in .so files,
188     @# then fails to parse them when linking the next .so ("invalid version N, max 0").
189     @# Workaround: wrap ld to strip .gnu.version* sections from .so outputs.
190     @# Stripping is safe because ld.so.1 uses SHT_SUNW_versym (not SHT_GNU_versym).
191     @# Install ld wrapper at /opt/ozsw/bin/ld (original backed up as ld.real).
192     @# -B/tmp/mozld-wrap does NOT work: GCC12 collect2 path is hardcoded at compile time.
193     @if [ ! -f /opt/ozsw/bin/ld.real ]; then \
194     sudo cp /opt/ozsw/bin/ld /opt/ozsw/bin/ld.real && \
195     printf '#!/bin/bash\noutput=""\nnext_o=0\nfor arg in "$$@"; do\n if [ $$next_o -eq 1 ]; then output="$$arg"; next_o=0; fi\n if [ "$$arg" = "-o" ]; then next_o=1; fi\ndone\n/opt/ozsw/bin/ld.real "$$@"\nrc=$$?\nif [ $$rc -eq 0 ] && [ -n "$$output" ]; then\n case "$$output" in\n *.so|*.so.*) /opt/ozsw/bin/objcopy --remove-section=.gnu.version --remove-section=.gnu.version_r --remove-section=.gnu.version_d "$$output" 2>/dev/null || true ;;\n esac\nfi\nexit $$rc\n' | sudo tee /opt/ozsw/bin/ld > /dev/null && \
196     sudo chmod +x /opt/ozsw/bin/ld; \
197     fi
198     @echo "==> Patching system_wrappers/sys/regset.h (configure generates this)"
199     @# Solaris sys/regset.h defines short x86 register names (CS=15, SS=18, DS=16,
200     @# ES=17, FS=20, GS=19, EAX=11, ...) as integer macros. These collide with
201     @# variable and parameter names throughout Mozilla/NSS/media code. The system
202     @# wrapper is the right place to undef them after the real header is included.
203     @printf '#pragma GCC system_header\n#pragma GCC visibility push(default)\n#include_next <sys/regset.h>\n#pragma GCC visibility pop\n/* Undef Solaris i386 register-index macros that conflict with C identifiers */\n#undef SS\n#undef CS\n#undef DS\n#undef ES\n#undef FS\n#undef GS\n#undef EAX\n#undef ECX\n#undef EDX\n#undef EBX\n#undef ESP\n#undef EBP\n#undef ESI\n#undef EDI\n#undef EIP\n#undef EFL\n#undef ERR\n#undef TRAPNO\n#undef UESP\n' \
204     > $(WORKSRC)/obj-build/dist/system_wrappers/sys/regset.h
205     @echo "==> Patching system_wrappers/sys/ucontext.h: undef CS/SS etc. from Solaris regset.h"
206     @printf '#pragma GCC system_header\n#pragma GCC visibility push(default)\n#include_next <sys/ucontext.h>\n#pragma GCC visibility pop\n/* Solaris sys/ucontext.h -> regset.h defines CS=15 etc.; undef to avoid C++ collisions */\n#undef CS\n' \\
207     > $(WORKSRC)/obj-build/dist/system_wrappers/sys/ucontext.h
208     @echo "==> Adding atk-bridge-2.0 to MOZ_GTK3_LIBS in config.status and autoconf.mk"
209     @gsed -i "s/-lgtk-3 -lgdk-3 \([^-]\)/-lgtk-3 -lgdk-3 -latk-bridge-2.0 \1/g" \\
210     $(WORKSRC)/obj-build/config.status
211     @gsed -i "s/MOZ_GTK3_LIBS = -lgtk-3 -lgdk-3 /MOZ_GTK3_LIBS = -lgtk-3 -lgdk-3 -latk-bridge-2.0 /" \\
212     $(WORKSRC)/obj-build/config/autoconf.mk
213     @echo "==> Building Basilisk with mach (this will take a long time)"
214     cd $(WORKSRC) && \
215     PATH="/opt/ozsw/bin:/opt/oz/bin:/usr/bin:/bin:/usr/sfw/bin:/usr/ccs/bin" \
216     MOZCONFIG=$(WORKSRC)/.mozconfig \
217     /opt/ozsw/bin/python3 ./platform/mach build
218     @echo "==> Packaging Basilisk"
219     cd $(WORKSRC) && \
220     PATH="/opt/ozsw/bin:/opt/oz/bin:/usr/bin:/bin:/usr/sfw/bin:/usr/ccs/bin" \
221     MOZCONFIG=$(WORKSRC)/.mozconfig \
222     /opt/ozsw/bin/python3 ./platform/mach package
223 operz 29 @$(MAKECOOKIE)
224    
225 operz 31 pre-install:
226     @echo "==> Installing Basilisk from package tarball"
227     $(MKDIRS) $(DESTDIR)$(libdir)/basilisk
228     $(MKDIRS) $(DESTDIR)$(bindir)
229     gtar -xf $(WORKSRC)/obj-build/dist/basilisk-*.tar.xz \
230     -C $(DESTDIR)$(libdir)/basilisk --strip-components=1
231     @printf '#!/bin/sh\nexec $(libdir)/basilisk/basilisk "$$@"\n' \
232     > $(DESTDIR)$(bindir)/basilisk
233     chmod 755 $(DESTDIR)$(bindir)/basilisk
234 operz 29 @$(MAKECOOKIE)
235    
236     include gar/category.mk