summaryrefslogtreecommitdiff
path: root/user/arcticfox/APKBUILD
blob: da5bce014851ff24ab896e2a9e6c6eb583cfce10 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
# Maintainer: A. Wilcox <awilfox@adelielinux.org>
pkgname=arcticfox
pkgver=45.1
pkgrel=0
pkgdesc="Arctic Fox web browser (fork of Firefox with PPC support)"
url="https://github.com/rmottola/Arctic-Fox/wiki"
arch="pmmx ppc ppc64 x86"
options="!check"  # Disable tests.
license="MPL-2.0"
depends=""
makedepends="alsa-lib-dev bzip2-dev dbus-glib-dev gconf-dev gtk+2.0-dev
	gtk+3.0-dev hunspell-dev icu-dev libevent-dev libidl-dev
	libjpeg-turbo-dev libnotify-dev libogg-dev libtheora-dev libvorbis-dev
	libxt-dev libxcomposite-dev mesa-dev nspr-dev automake libtool
	pulseaudio-dev sqlite-dev startup-notification-dev autoconf2.13
	bsd-compat-headers cmd:which openssl-dev sed yasm zip"
subpackages="$pkgname-dev"
source="arcticfox-$pkgver.tar.gz::https://github.com/rmottola/Arctic-Fox/archive/refs/tags/v$pkgver.tar.gz
	mozconfig
	https://www.python.org/ftp/python/2.7.15/Python-2.7.15.tar.xz
	arcticfox.desktop

	hunspell.patch
	override-cxx-version.patch
	stackwalk-x86-ppc.patch
	"
builddir="$srcdir/Arctic-Fox-$pkgver"
_mozappdir="/usr/lib/$pkgname-$pkgver"
ldpath="$_mozappdir"

unpack() {
	default_unpack

	[ -z $SKIP_PYTHON ] || return 0
	msg "Killing all remaining hope for humanity and building Python 2..."
	cd "$srcdir"
	[ -d python ] && rm -r python
	mkdir python
	# 19:39 <+solar> just make the firefox build process build its own py2 copy
	# 20:03 <calvin> TheWilfox: there's always violence
	cd Python-2.7.15
	./configure --prefix="$srcdir/python"
	make -j $JOBS
	# 6 tests failed:
	#    test__locale test_os test_posix test_re test_strptime test_time
	# make test
	make -j $JOBS install
}

prepare() {
	default_prepare

	cp "$srcdir"/mozconfig "$builddir"/mozconfig
	echo "ac_add_options --host=\"$CHOST\"" >> "$builddir"/mozconfig
	echo "ac_add_options --target=\"$CTARGET\"" >> "$builddir"/mozconfig
	echo "mk_add_options MOZ_MAKE_FLAGS=\"-j$JOBS\"" >> "$builddir"/mozconfig
	# Needed, see upstream https://github.com/rmottola/Arctic-Fox/issues/125
	# on ppc, fails in NSFrameState::operator& without these flags
	export CFLAGS="$CFLAGS -O1 -fno-delete-null-pointer-checks -fno-lifetime-dse -fno-schedule-insns2"
	export LDFLAGS="$LDFLAGS -Wl,-rpath,$_mozappdir"

	# arch-specific configuration
	case "$CARCH" in
	pmmx|x86*|arm*)
		echo "ac_add_options --disable-elf-hack" >> "$builddir"/mozconfig
		;;
	ppc)
		export LDFLAGS="$LDFLAGS -latomic"
		;;
	ppc64)
		echo "ac_add_options --enable-altivec" >> "$builddir"/mozconfig
		;;
	s390x)
		echo "ac_add_options --disable-startupcache" >> "$builddir"/mozconfig
		;;
	esac

	echo "ac_add_options --enable-optimize=\"$CFLAGS\"" >> "$builddir"/mozconfig
}

build() {
	export CFLAGS="$CFLAGS -Wno-dangling-pointer -Wno-array-bounds -Wno-comment -Wno-maybe-uninitialized -Wno-misleading-indentation -Wno-multistatement-macros -Wno-stringop-overflow -Wno-unused-function -Wno-unused-value -Wno-ignored-qualifiers -Wno-deprecated-declarations -Wno-implicit-fallthrough -Wno-unused-but-set-variable -Wno-int-in-bool-context -Wno-stringop-overread -Wno-address -Wno-use-after-free"
	export CXXFLAGS="$CFLAGS -Wno-class-memaccess -Wno-changes-meaning -Wno-subobject-linkage -Wno-return-local-addr -Wno-unused-local-typedefs"
	export SHELL=/bin/sh
	export BUILD_OFFICIAL=1
	export MOZILLA_OFFICIAL=1
	export USE_SHORT_LIBNAME=1
	export MACH_BUILD_PYTHON_NATIVE_PACKAGE_SOURCE=system
	export PATH="$PATH:$srcdir/python/bin"
	export CXX="/usr/bin/g++ -std=gnu++17"

	# set rpath so linker finds the libs
	export UNIXCONFDIR="$srcdir"

	./mach configure
	# parallel make bug hit on gwyn (64 threads)
	./mach build -j1 export
	./mach build
}

package() {
	export PATH="$PATH:$srcdir/python/bin"
	DESTDIR="$pkgdir" ./mach install

	for pngsize in 16 32 48; do
		install -D -m644 \
			"browser/branding/$pkgname/default$pngsize.png" \
			"$pkgdir"/usr/share/icons/hicolor/${pngsize}x${pngsize}/apps/$pkgname.png
	done

	install -D -m644 "browser/branding/$pkgname/mozicon128.png" \
		"$pkgdir"/usr/share/pixmaps/$pkgname.png
	install -D -m644 $srcdir/$pkgname.desktop \
		"$pkgdir"/usr/share/applications/$pkgname.desktop
}

dev() {
	mkdir -p "$subpkgdir"/usr/lib "$subpkgdir"/usr/share
	mv "$pkgdir"/usr/lib/$pkgname-devel-$pkgver \
		"$subpkgdir"/usr/lib/
	mv "$pkgdir"/usr/share/idl "$subpkgdir"/usr/share/
	default_dev
}

sha512sums="0b24bc8cf201a78517c7934c119b1e21d511068e8ea06c8b7f5ce65e5867e9f091cc0c8c65b0f8c78e8637d27dd3d505126d355c8ca5693f1b0417020b838800  arcticfox-45.1.tar.gz
ce5312b4fcf07d0dd0496366f6e3be406ef19a389f67a3eb8e3df62232d9eb08ed1a5e212dee1725d907bb025bc3da19b6d0b0d97210893846eb8206890fe8de  mozconfig
27ea43eb45fc68f3d2469d5f07636e10801dee11635a430ec8ec922ed790bb426b072da94df885e4dfa1ea8b7a24f2f56dd92f9b0f51e162330f161216bd6de6  Python-2.7.15.tar.xz
d4f9a2a64cb8c1e679a13429e62cfd2e8a44cf54896c2999258571ab990711fbc3d078ce655efd90437e60ef113af1e5277f416f5cf78dfea21f82c481f6929b  arcticfox.desktop
50cc077df6d17358f5dcffcabb1a75087b58ac46f60d9d5fc8f2d407e93a26d89778e4c09a5203f2a55bc9f9ddb247f4482483d30f495bc9e3393fad37a322d7  hunspell.patch
bf63b06c030b388711554a4eff36fc50f2af802b59a9f1d7c5b42f11fcc1dd806d53980bdd89bf9518fc51ba25a812c892dfaf47e9d50b33a82ebad9462da92a  override-cxx-version.patch
a0f97b8b3e5b0d93b155f1678a3d5984b52ede440202656d35237a6e7025b4a1315c114a1a87c3974d0d43b0f637e186b2be6422c44ba5f111ede53893e39c54  stackwalk-x86-ppc.patch"