ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/ozone/mgar/pkg/basilisk/Makefile
Revision: 33
Committed: Mon Jun 22 14:00:46 2026 UTC (4 weeks, 1 day ago) by operz
File size: 15373 byte(s)
Log Message:
basilisk: fix config.status atk-bridge patch (uses Python list format, not flat string); add gtk+ .pc fix note

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