ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/ozone/mgar/pkg/basilisk/Makefile
Revision: 34
Committed: Mon Jun 22 15:01:10 2026 UTC (4 weeks, 1 day ago) by operz
File size: 15992 byte(s)
Log Message:
basilisk: disable LOCAL_CHECKS in libxul.mk (NSModule sentinel ordering differs on Solaris/GNU ld but runtime is correct per Mozilla bmo)

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 operz 32 @# Fix arc4random.c: removes XP_SOLARIS block that includes Chromium-specific
111     @# build/build_config.h (not in include path when compiled as static include of evutil_rand.c)
112     @gsed -i '/#ifdef XP_SOLARIS/,/#endif/d' \
113     $(WORKSRC)/platform/ipc/chromium/src/third_party/libevent/arc4random.c
114 operz 31 @# Fix libopus silk/resampler_private.h: Solaris sys/regset.h also defines SS=18
115     @# (x86 stack-segment register index), conflicting with the 'SS' parameter name.
116     @/opt/ozsw/bin/python3 -c "\
117     path='$(WORKSRC)/platform/media/libopus/silk/resampler_private.h'; \
118     c=open(path).read(); \
119     old='#ifndef SILK_RESAMPLER_PRIVATE_H\n#define SILK_RESAMPLER_PRIVATE_H'; \
120     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'; \
121     open(path,'w').write(c.replace(old,new))"
122     @# Fix libpng moz.build: -std=c89 + _XOPEN_SOURCE=600 is rejected by Solaris
123     @# feature_tests.h (XPG6/UNIX 03 requires C99). Use gnu99 on SunOS instead.
124     @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']/" \
125     $(WORKSRC)/platform/media/libpng/moz.build
126 operz 34 @# Fix toolkit/library/libxul.mk: NSModules ordering check fails on Solaris because
127     @# GNU ld places sentinel symbols differently than Linux. The runtime ordering IS
128     @# correct per Mozilla bug reports; the check just has wrong expectations. Disable it.
129     @gsed -i 's/^LOCAL_CHECKS = test .*/# LOCAL_CHECKS disabled: Solaris GNU ld ordering OK at runtime/' \
130     $(WORKSRC)/platform/toolkit/library/libxul.mk
131     @gsed -i '/^# LOCAL_CHECKS disabled:/a LOCAL_CHECKS = $$(true)' \
132     $(WORKSRC)/platform/toolkit/library/libxul.mk
133     @gsed -i 's/^LOCAL_CHECKS += ; test .*/# &/' \
134     $(WORKSRC)/platform/toolkit/library/libxul.mk
135 operz 31 @# Fix xpcom nsMemoryReporterManager.cpp: _XOPEN_SOURCE>=500 (set globally) causes
136     @# Solaris to enable large file mode (_FILE_OFFSET_BITS=64), but procfs.h
137     @# explicitly rejects that. Undef the large-file macros before the procfs include.
138     @/opt/ozsw/bin/python3 -c "\
139     path='$(WORKSRC)/platform/xpcom/base/nsMemoryReporterManager.cpp'; \
140     c=open(path).read(); \
141     old='#elif defined(XP_SOLARIS)\n\n#include <procfs.h>'; \
142     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>'; \
143     open(path,'w').write(c.replace(old,new))"
144 operz 29 @echo "==> Writing .mozconfig"
145     @{ \
146 operz 31 echo '# Basilisk euxp build for OpenSolaris i386 (snv_111b)'; \
147 operz 29 echo 'ac_add_options --enable-application=basilisk'; \
148     echo 'ac_add_options --enable-optimize="-O2 -w"'; \
149     echo 'ac_add_options --disable-official-branding'; \
150     echo 'ac_add_options --enable-default-toolkit=cairo-gtk3'; \
151     echo 'ac_add_options --enable-jemalloc'; \
152     echo 'ac_add_options --enable-strip'; \
153     echo 'ac_add_options --enable-devtools'; \
154     echo 'ac_add_options --enable-av1'; \
155 operz 31 echo 'ac_add_options --disable-pie'; \
156 operz 29 echo 'ac_add_options --disable-webrtc'; \
157     echo 'ac_add_options --disable-gamepad'; \
158     echo 'ac_add_options --disable-tests'; \
159     echo 'ac_add_options --disable-debug'; \
160     echo 'ac_add_options --disable-necko-wifi'; \
161     echo 'ac_add_options --disable-updater'; \
162 operz 31 echo 'ac_add_options --disable-npapi'; \
163     echo 'ac_add_options --disable-dbus'; \
164     echo 'ac_add_options --disable-pulseaudio'; \
165 operz 29 echo 'ac_add_options --with-pthreads'; \
166     echo 'ac_add_options --prefix=$(prefix)'; \
167 operz 31 echo '# Force 32-bit build: OZSW GCC12 target is i386-pc-solaris2.11'; \
168     echo 'ac_add_options --host=i386-pc-solaris2.11'; \
169     echo 'ac_add_options --target=i386-pc-solaris2.11'; \
170     echo 'export CC=/opt/ozsw/bin/gcc'; \
171     echo 'export CXX=/opt/ozsw/bin/g++'; \
172     echo 'export HOST_CC=/opt/ozsw/bin/gcc'; \
173     echo 'export HOST_CXX=/opt/ozsw/bin/g++'; \
174 operz 29 echo ''; \
175     echo 'export BASILISK_VERSION=1'; \
176     echo 'export MOZ_PKG_SPECIAL=gtk3'; \
177 operz 31 echo 'export CONFIG_SHELL=/usr/bin/bash'; \
178 operz 29 echo 'mk_add_options MOZ_MAKE_FLAGS="-j3"'; \
179     echo 'mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/obj-build'; \
180     echo 'export MOZILLA_OFFICIAL=1'; \
181     echo ''; \
182     echo 'ac_add_options --x-libraries=$(BUILD_PREFIX)/lib'; \
183 operz 31 echo 'export PKG_CONFIG_PATH=$(BUILD_PREFIX)/lib/pkgconfig:$(BUILD_PREFIX)/share/pkgconfig'; \
184     echo ''; \
185     echo '# Solaris: _POSIX_C_SOURCE=200809L (from zbuild.h) not handled by old'; \
186     echo '# feature_tests.h; _XOPEN_SOURCE=600 gets _XPG6 so C99 + POSIX is valid.'; \
187     echo '# __EXTENSIONS__ exposes Solaris-specific APIs (madvise, MADV_DONTNEED etc.)'; \
188     echo 'export CFLAGS="-D_XOPEN_SOURCE=600 -D__EXTENSIONS__"'; \
189     echo 'export CXXFLAGS="-D_XOPEN_SOURCE=600 -D__EXTENSIONS__"'; \
190 operz 29 } > $(WORKSRC)/.mozconfig
191     @$(MAKECOOKIE)
192    
193 operz 31 pre-build:
194     @echo "==> Configuring Basilisk with mach"
195     cd $(WORKSRC) && \
196     PATH="/opt/ozsw/bin:/opt/oz/bin:/usr/bin:/bin:/usr/sfw/bin:/usr/ccs/bin" \
197     MOZCONFIG=$(WORKSRC)/.mozconfig \
198     /opt/ozsw/bin/python3 ./platform/mach configure
199     @echo "==> Setting up ld wrapper and patching system_wrappers/sys/regset.h"
200     @# GNU ld 2.45 on Solaris records SUNW_x.y versioned symbol refs in .so files,
201     @# then fails to parse them when linking the next .so ("invalid version N, max 0").
202     @# Workaround: wrap ld to strip .gnu.version* sections from .so outputs.
203     @# Stripping is safe because ld.so.1 uses SHT_SUNW_versym (not SHT_GNU_versym).
204     @# Install ld wrapper at /opt/ozsw/bin/ld (original backed up as ld.real).
205     @# -B/tmp/mozld-wrap does NOT work: GCC12 collect2 path is hardcoded at compile time.
206     @if [ ! -f /opt/ozsw/bin/ld.real ]; then \
207     sudo cp /opt/ozsw/bin/ld /opt/ozsw/bin/ld.real && \
208     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 && \
209     sudo chmod +x /opt/ozsw/bin/ld; \
210     fi
211     @echo "==> Patching system_wrappers/sys/regset.h (configure generates this)"
212     @# Solaris sys/regset.h defines short x86 register names (CS=15, SS=18, DS=16,
213     @# ES=17, FS=20, GS=19, EAX=11, ...) as integer macros. These collide with
214     @# variable and parameter names throughout Mozilla/NSS/media code. The system
215     @# wrapper is the right place to undef them after the real header is included.
216     @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' \
217     > $(WORKSRC)/obj-build/dist/system_wrappers/sys/regset.h
218     @echo "==> Patching system_wrappers/sys/ucontext.h: undef CS/SS etc. from Solaris regset.h"
219     @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' \\
220     > $(WORKSRC)/obj-build/dist/system_wrappers/sys/ucontext.h
221     @echo "==> Adding atk-bridge-2.0 to MOZ_GTK3_LIBS in config.status and autoconf.mk"
222 operz 33 @# config.status stores MOZ_GTK3_LIBS as a Python list; patch '-lgdk-3' entry
223     @/opt/ozsw/bin/python3 -c "path='$(WORKSRC)/obj-build/config.status'; c=open(path).read(); \
224     old=\" '-lgdk-3',\\n\"; \
225     new=\" '-lgdk-3',\\n '-latk-bridge-2.0',\\n\"; \
226     open(path,'w').write(c.replace(old,new)) if '-latk-bridge-2.0' not in c else None"
227 operz 31 @gsed -i "s/MOZ_GTK3_LIBS = -lgtk-3 -lgdk-3 /MOZ_GTK3_LIBS = -lgtk-3 -lgdk-3 -latk-bridge-2.0 /" \\
228     $(WORKSRC)/obj-build/config/autoconf.mk
229 operz 33 @# Make autoconf.mk newer than config.status to prevent make from regenerating it
230     @touch $(WORKSRC)/obj-build/config/autoconf.mk
231 operz 31 @echo "==> Building Basilisk with mach (this will take a long time)"
232     cd $(WORKSRC) && \
233     PATH="/opt/ozsw/bin:/opt/oz/bin:/usr/bin:/bin:/usr/sfw/bin:/usr/ccs/bin" \
234     MOZCONFIG=$(WORKSRC)/.mozconfig \
235     /opt/ozsw/bin/python3 ./platform/mach build
236     @echo "==> Packaging Basilisk"
237     cd $(WORKSRC) && \
238     PATH="/opt/ozsw/bin:/opt/oz/bin:/usr/bin:/bin:/usr/sfw/bin:/usr/ccs/bin" \
239     MOZCONFIG=$(WORKSRC)/.mozconfig \
240     /opt/ozsw/bin/python3 ./platform/mach package
241 operz 29 @$(MAKECOOKIE)
242    
243 operz 31 pre-install:
244     @echo "==> Installing Basilisk from package tarball"
245     $(MKDIRS) $(DESTDIR)$(libdir)/basilisk
246     $(MKDIRS) $(DESTDIR)$(bindir)
247     gtar -xf $(WORKSRC)/obj-build/dist/basilisk-*.tar.xz \
248     -C $(DESTDIR)$(libdir)/basilisk --strip-components=1
249     @printf '#!/bin/sh\nexec $(libdir)/basilisk/basilisk "$$@"\n' \
250     > $(DESTDIR)$(bindir)/basilisk
251     chmod 755 $(DESTDIR)$(bindir)/basilisk
252 operz 29 @$(MAKECOOKIE)
253    
254     include gar/category.mk