Skip to content

Instantly share code, notes, and snippets.

@firefish5000
Last active January 17, 2017 11:29
Show Gist options
  • Save firefish5000/fcafba4f70504ac16aab7fc65a24f0e9 to your computer and use it in GitHub Desktop.
Save firefish5000/fcafba4f70504ac16aab7fc65a24f0e9 to your computer and use it in GitHub Desktop.
Firefox live ebuild (for those that like long compile times, and those not using pulse for some oddball reason)
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$
# www-client/firefox/firefox-9999.ebuild
EAPI=6
VIRTUALX_REQUIRED="pgo"
WANT_AUTOCONF="2.1"
MOZ_ESR=""
# This list can be updated with scripts/get_langs.sh from the mozilla overlay
MOZ_LANGS=( ach af an ar as ast az be bg bn-BD bn-IN br bs ca cak cs cy da de dsb
el en en-GB en-US en-ZA eo es-AR es-CL es-ES es-MX et eu fa ff fi fr fy-NL
ga-IE gd gl gn gu-IN he hi-IN hr hsb hu hy-AM id is it ja kk km kn ko lij lt
lv mai mk ml mr ms nb-NO nl nn-NO or pa-IN pl pt-BR pt-PT rm ro ru si sk sl
son sq sr sv-SE ta te th tr uk uz vi xh zh-CN zh-TW )
# Convert the ebuild version to the upstream mozilla version, used by mozlinguas
MOZ_PV="${PV/_alpha/a}" # Handle alpha for SRC_URI
MOZ_PV="${MOZ_PV/_beta/b}" # Handle beta for SRC_URI
MOZ_PV="${MOZ_PV/_rc/rc}" # Handle rc for SRC_URI
#MOZ_PV="nightly" # Handle rc for SRC_URI
# Used for gentoo patches.
# FIXME Also a temporary workaround to get (old) language packs.
MOZ_PV="50.1.0" # Handle rc for SRC_URI
if [[ ${MOZ_ESR} == 1 ]]; then
# ESR releases have slightly different version numbers
MOZ_PV="${MOZ_PV}esr"
fi
# Patch version
PATCH="${PN}-50.0-patches-02"
# FIXME Used for downloading (old) language packs.
MOZ_HTTP_URI="https://archive.mozilla.org/pub/${PN}/releases"
MOZCONFIG_OPTIONAL_GTK2ONLY=1
MOZCONFIG_OPTIONAL_WIFI=1
MOZCONFIG_OPTIONAL_JIT="enabled"
inherit check-reqs flag-o-matic toolchain-funcs eutils gnome2-utils mozconfig-v6.49 pax-utils fdo-mime autotools virtualx mozlinguas-v2 mercurial
DESCRIPTION="Firefox Web Browser"
HOMEPAGE="http://www.mozilla.com/firefox"
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~ia64 ~ppc ~ppc64 ~x86 ~amd64-linux ~x86-linux"
SLOT="0"
LICENSE="MPL-2.0 GPL-2 LGPL-2.1"
IUSE="bindist hardened +hwaccel jack pgo selinux +gmp-autoupdate test alsa"
RESTRICT="!bindist? ( bindist )"
# I don't like patching live ebuilds, but some of these are required
PATCH_URIS=( https://dev.gentoo.org/~{anarchy,axs,polynomial-c}/mozilla/patchsets/${PATCH}.tar.xz )
SRC_URI="${SRC_URI}
${PATCH_URIS[@]}"
#${MOZ_HTTP_URI}/${MOZ_PV}/source/firefox-${MOZ_PV}.source.tar.xz
EHG_REPO_URI='https://hg.mozilla.org/mozilla-central/'
ASM_DEPEND=">=dev-lang/yasm-1.1"
# Use development version of mozilla's nss and nspr
# with development version of mozilla firefox
RDEPEND="
>dev-db/sqlite-3.16.1
jack? ( virtual/jack )
>=dev-libs/nss-9999
>=dev-libs/nspr-9999
selinux? ( sec-policy/selinux-mozilla )"
# NOTE rust will pull in it's package manager cargo.
# As of version 0.15.0, cargo must be bootstrapped with an existing cargo installation.
# As such, you will have to install cargo 0.14.0 in order to compile the lattest version
DEPEND="${RDEPEND}
dev-lang/rust
pgo? ( >=sys-devel/gcc-4.5 )
amd64? ( ${ASM_DEPEND} virtual/opengl )
x86? ( ${ASM_DEPEND} virtual/opengl )"
S="${WORKDIR}/firefox-${MOZ_PV}"
QA_PRESTRIPPED="usr/lib*/${PN}/firefox"
BUILD_OBJ_DIR="${S}/ff"
# dependencies newer than specified in the eclass
# Use latest versions of all packages we depend on
RDEPEND="${RDEPEND}
>=media-libs/libpng-1.6.28
"
src_fetch() {
mercurial_fetch
}
pkg_setup() {
moz_pkgsetup
# Avoid PGO profiling problems due to enviroment leakage
# These should *always* be cleaned up anyway
unset DBUS_SESSION_BUS_ADDRESS \
DISPLAY \
ORBIT_SOCKETDIR \
SESSION_MANAGER \
XDG_SESSION_COOKIE \
XAUTHORITY
if ! use bindist; then
einfo
elog "You are enabling official branding. You may not redistribute this build"
elog "to any users on your network or the internet. Doing so puts yourself into"
elog "a legal problem with Mozilla Foundation"
elog "You can disable it by emerging ${PN} _with_ the bindist USE-flag"
fi
if use pgo; then
einfo
ewarn "You will do a double build for profile guided optimization."
ewarn "This will result in your build taking at least twice as long as before."
fi
}
pkg_pretend() {
# Ensure we have enough disk space to compile
if use pgo || use debug || use test ; then
CHECKREQS_DISK_BUILD="8G"
else
CHECKREQS_DISK_BUILD="4G"
fi
check-reqs_pkg_setup
}
src_unpack() {
#unpack ${A}
mercurial_src_unpack
# Unpack language packs
mozlinguas_src_unpack
}
src_prepare() {
ln -s "${WORKDIR}/firefox-${MOZ_PV}" "${WORKDIR}/firefox"
# Apply our patches
cp "${FILESDIR}"/${PN}-48.0-pgo.patch "${WORKDIR}/firefox"
eapply "${WORKDIR}/firefox" \
"${FILESDIR}"/${PN}-48.0-pgo.patch
# Enable gnomebreakpad
if use debug ; then
sed -i -e "s:GNOME_DISABLE_CRASH_DIALOG=1:GNOME_DISABLE_CRASH_DIALOG=0:g" \
"${S}"/build/unix/run-mozilla.sh || die "sed failed!"
fi
# Drop -Wl,--as-needed related manipulation for ia64 as it causes ld sefgaults, bug #582432
if use ia64 ; then
sed -i \
-e '/^OS_LIBS += no_as_needed/d' \
-e '/^OS_LIBS += as_needed/d' \
"${S}"/widget/gtk/mozgtk/gtk2/moz.build \
"${S}"/widget/gtk/mozgtk/gtk3/moz.build \
|| die "sed failed to drop --as-needed for ia64"
fi
# Ensure that our plugins dir is enabled as default
sed -i -e "s:/usr/lib/mozilla/plugins:/usr/lib/nsbrowser/plugins:" \
"${S}"/xpcom/io/nsAppFileLocationProvider.cpp || die "sed failed to replace plugin path for 32bit!"
sed -i -e "s:/usr/lib64/mozilla/plugins:/usr/lib64/nsbrowser/plugins:" \
"${S}"/xpcom/io/nsAppFileLocationProvider.cpp || die "sed failed to replace plugin path for 64bit!"
# Fix sandbox violations during make clean, bug 372817
sed -e "s:\(/no-such-file\):${T}\1:g" \
-i "${S}"/config/rules.mk \
-i "${S}"/nsprpub/configure{.in,} \
|| die
# Don't exit with error when some libs are missing which we have in
# system.
sed '/^MOZ_PKG_FATAL_WARNINGS/s@= 1@= 0@' \
-i "${S}"/browser/installer/Makefile.in || die
# Don't error out when there's no files to be removed:
sed 's@\(xargs rm\)$@\1 -f@' \
-i "${S}"/toolkit/mozapps/installer/packager.mk || die
# Keep codebase the same even if not using official branding
sed '/^MOZ_DEV_EDITION=1/d' \
-i "${S}"/browser/branding/aurora/configure.sh || die
# Allow user to apply any additional patches without modifing ebuild
eapply_user
# Autotools configure is now called old-configure.in
# This works because there is still a configure.in that happens to be for the
# shell wrapper configure script
eautoreconf old-configure.in
# Must run autoconf in js/src
cd "${S}"/js/src || die
eautoconf old-configure.in
# Need to update jemalloc's configure
cd "${S}"/memory/jemalloc/src || die
WANT_AUTOCONF= eautoconf
}
src_configure() {
MEXTENSIONS="default"
# Google API keys (see http://www.chromium.org/developers/how-tos/api-keys)
# Note: These are for Gentoo Linux use ONLY. For your own distribution, please
# get your own set of keys.
_google_api_key=AIzaSyDEAOvatFo0eTgsV_ZlEzx0ObmepsMzfAc
####################################
#
# mozconfig, CFLAGS and CXXFLAGS setup
#
####################################
mozconfig_init
mozconfig_config
# enable JACK, bug 600002
mozconfig_use_enable jack
# It doesn't compile on alpha without this LDFLAGS
use alpha && append-ldflags "-Wl,--no-relax"
# Add full relro support for hardened
use hardened && append-ldflags "-Wl,-z,relro,-z,now"
# Only available on mozilla-overlay for experimentation -- Removed in Gentoo repo per bug 571180
#use egl && mozconfig_annotate 'Enable EGL as GL provider' --with-gl-provider=EGL
# Setup api key for location services
echo -n "${_google_api_key}" > "${S}"/google-api-key
mozconfig_annotate '' --with-google-api-keyfile="${S}/google-api-key"
mozconfig_annotate '' --enable-extensions="${MEXTENSIONS}"
if use alsa; then
mozconfig_annotate '' --enable-alsa
fi
# Allow for a proper pgo build
if use pgo; then
echo "mk_add_options PROFILE_GEN_SCRIPT='EXTRA_TEST_ARGS=10 \$(MAKE) -C \$(MOZ_OBJDIR) pgo-profile-run'" >> "${S}"/.mozconfig
fi
echo "mk_add_options MOZ_OBJDIR=${BUILD_OBJ_DIR}" >> "${S}"/.mozconfig
echo "mk_add_options XARGS=/usr/bin/xargs" >> "${S}"/.mozconfig
echo "Removing broken system harfuzz option"
sed '/system-harfbuzz/d' -i ""${S}"/.mozconfig" || die
echo "Removing broken system graphite2 option"
sed '/system-graphite2/d' -i ""${S}"/.mozconfig" || die
# Finalize and report settings
mozconfig_final
if [[ $(gcc-major-version) -lt 4 ]]; then
append-cxxflags -fno-stack-protector
fi
# workaround for funky/broken upstream configure...
SHELL="${SHELL:-${EPREFIX%/}/bin/bash}" \
emake -f client.mk configure
}
src_compile() {
if use pgo; then
addpredict /root
addpredict /etc/gconf
# Reset and cleanup environment variables used by GNOME/XDG
gnome2_environment_reset
# Firefox tries to use dri stuff when it's run, see bug 380283
shopt -s nullglob
cards=$(echo -n /dev/dri/card* | sed 's/ /:/g')
if test -z "${cards}"; then
cards=$(echo -n /dev/ati/card* /dev/nvidiactl* | sed 's/ /:/g')
if test -n "${cards}"; then
# Binary drivers seem to cause access violations anyway, so
# let's use indirect rendering so that the device files aren't
# touched at all. See bug 394715.
export LIBGL_ALWAYS_INDIRECT=1
fi
fi
shopt -u nullglob
addpredict "${cards}"
MOZ_MAKE_FLAGS="${MAKEOPTS}" SHELL="${SHELL:-${EPREFIX%/}/bin/bash}" \
virtx emake -f client.mk profiledbuild || die "virtx emake failed"
else
MOZ_MAKE_FLAGS="${MAKEOPTS}" SHELL="${SHELL:-${EPREFIX%/}/bin/bash}" \
emake -f client.mk realbuild
fi
}
src_install() {
cd "${BUILD_OBJ_DIR}" || die
# Pax mark xpcshell for hardened support, only used for startupcache creation.
pax-mark m "${BUILD_OBJ_DIR}"/dist/bin/xpcshell
# Add our default prefs for firefox
cp "${FILESDIR}"/gentoo-default-prefs.js-1 \
"${BUILD_OBJ_DIR}/dist/bin/browser/defaults/preferences/all-gentoo.js" \
|| die
mozconfig_install_prefs \
"${BUILD_OBJ_DIR}/dist/bin/browser/defaults/preferences/all-gentoo.js"
# Augment this with hwaccel prefs
if use hwaccel ; then
cat "${FILESDIR}"/gentoo-hwaccel-prefs.js-1 >> \
"${BUILD_OBJ_DIR}/dist/bin/browser/defaults/preferences/all-gentoo.js" \
|| die
fi
echo "pref(\"extensions.autoDisableScopes\", 3);" >> \
"${BUILD_OBJ_DIR}/dist/bin/browser/defaults/preferences/all-gentoo.js" \
|| die
local plugin
use gmp-autoupdate || for plugin in \
gmp-gmpopenh264 ; do
echo "pref(\"media.${plugin}.autoupdate\", false);" >> \
"${BUILD_OBJ_DIR}/dist/bin/browser/defaults/preferences/all-gentoo.js" \
|| die
done
MOZ_MAKE_FLAGS="${MAKEOPTS}" \
emake DESTDIR="${D}" install
# Install language packs
mozlinguas_src_install
local size sizes icon_path icon name
if use bindist; then
sizes="16 32 48"
icon_path="${S}/browser/branding/aurora"
# Firefox's new rapid release cycle means no more codenames
# Let's just stick with this one...
icon="aurora"
name="Aurora"
# Override preferences to set the MOZ_DEV_EDITION defaults, since we
# don't define MOZ_DEV_EDITION to avoid profile debaucles.
# (source: browser/app/profile/firefox.js)
cat >>"${BUILD_OBJ_DIR}/dist/bin/browser/defaults/preferences/all-gentoo.js" <<PROFILE_EOF
pref("app.feedback.baseURL", "https://input.mozilla.org/%LOCALE%/feedback/firefoxdev/%VERSION%/");
sticky_pref("lightweightThemes.selectedThemeID", "firefox-devedition@mozilla.org");
sticky_pref("browser.devedition.theme.enabled", true);
sticky_pref("devtools.theme", "dark");
PROFILE_EOF
else
sizes="16 22 24 32 256"
icon_path="${S}/browser/branding/official"
icon="${PN}"
name="Mozilla Firefox"
fi
# Install icons and .desktop for menu entry
for size in ${sizes}; do
insinto "/usr/share/icons/hicolor/${size}x${size}/apps"
newins "${icon_path}/default${size}.png" "${icon}.png"
done
# The 128x128 icon has a different name
insinto "/usr/share/icons/hicolor/128x128/apps"
newins "${icon_path}/mozicon128.png" "${icon}.png"
# Install a 48x48 icon into /usr/share/pixmaps for legacy DEs
newicon "${icon_path}/content/icon48.png" "${icon}.png"
newmenu "${FILESDIR}/icon/${PN}.desktop" "${PN}.desktop"
sed -i -e "s:@NAME@:${name}:" -e "s:@ICON@:${icon}:" \
"${ED}/usr/share/applications/${PN}.desktop" || die
# Add StartupNotify=true bug 237317
if use startup-notification ; then
echo "StartupNotify=true"\
>> "${ED}/usr/share/applications/${PN}.desktop" \
|| die
fi
# Required in order to use plugins and even run firefox on hardened, with jit useflag.
if use jit; then
pax-mark m "${ED}"${MOZILLA_FIVE_HOME}/{firefox,firefox-bin,plugin-container}
else
ewarn "At the time of this writting, the config option to disable JIT eith doesn't work, or isn't passed. We are likly to fail to compile without it."
pax-mark m "${ED}"${MOZILLA_FIVE_HOME}/plugin-container
fi
# very ugly hack to make firefox not sigbus on sparc
# FIXME: is this still needed??
use sparc && { sed -e 's/Firefox/FirefoxGentoo/g' \
-i "${ED}/${MOZILLA_FIVE_HOME}/application.ini" \
|| die "sparc sed failed"; }
}
pkg_preinst() {
gnome2_icon_savelist
}
pkg_postinst() {
# Update mimedb for the new .desktop file
fdo-mime_desktop_database_update
gnome2_icon_cache_update
}
pkg_postrm() {
gnome2_icon_cache_update
}
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$
# dev-libs/nspr/nspr-9999.ebuild
EAPI=6
WANT_AUTOCONF="2.5"
inherit autotools eutils multilib toolchain-funcs versionator multilib-minimal mercurial
MIN_PV="$(get_version_component_range 2)"
DESCRIPTION="Netscape Portable Runtime"
HOMEPAGE="http://www.mozilla.org/projects/nspr/"
EHG_REPO_URI='https://hg.mozilla.org/projects/nspr'
#SRC_URI="https://archive.mozilla.org/pub/nspr/releases/v${PV}/src/${P}.tar.gz"
LICENSE="|| ( MPL-2.0 GPL-2 LGPL-2.1 )"
SLOT="0"
KEYWORDS="alpha amd64 arm ~arm64 hppa ~ia64 ~m68k ~mips ppc ~ppc64 ~s390 ~sh sparc x86 ~ppc-aix ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux ~x64-macos ~x86-macos ~sparc-solaris ~x64-solaris ~x86-solaris"
IUSE="debug"
RDEPEND="
abi_x86_32? (
!<=app-emulation/emul-linux-x86-baselibs-20140508-r12
!app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
)"
MULTILIB_CHOST_TOOLS=(
/usr/bin/nspr-config
)
PATCHES=(
"${FILESDIR}"/${PN}-4.7.0-prtime.patch
"${FILESDIR}"/${PN}-4.7.1-solaris.patch
"${FILESDIR}"/${PN}-4.10.6-solaris.patch
"${FILESDIR}"/${PN}-4.8.4-darwin-install_name.patch
"${FILESDIR}"/${PN}-4.8.9-link-flags.patch
# We do not need to pass -L$libdir via nspr-config --libs
"${FILESDIR}"/${PN}-4.9.5_nspr_config.patch
)
src_fetch() {
mercurial_fetch
}
src_prepare() {
#cd "${S}"/nspr || die
ln -s "${S}" "${WORKDIR}/nspr-9999-abi_x86_64.amd64"
default
# rename configure.in to configure.ac for new autotools compatibility
if [[ -e "${S}"/configure.in ]] ; then
einfo "Renaming configure.in to configure.ac"
mv "${S}"/configure.{in,ac} || die
fi
# We must run eautoconf to regenerate configure
eautoconf
# make sure it won't find Perl out of Prefix
sed -i -e "s/perl5//g" "${S}"/configure || die
# Respect LDFLAGS
sed -i -e 's/\$(MKSHLIB) \$(OBJS)/\$(MKSHLIB) \$(LDFLAGS) \$(OBJS)/g' \
"${S}"/config/rules.mk || die
}
multilib_src_configure() {
# We use the standard BUILD_xxx but nspr uses HOST_xxx
tc-export_build_env BUILD_CC
export HOST_CC=${BUILD_CC} HOST_CFLAGS=${BUILD_CFLAGS} HOST_LDFLAGS=${BUILD_LDFLAGS}
tc-export AR CC CXX RANLIB
[[ ${CBUILD} != ${CHOST} ]] \
&& export CROSS_COMPILE=1 \
|| unset CROSS_COMPILE
local myconf=()
# The configure has some fancy --enable-{{n,x}32,64bit} switches
# that trigger some code conditional to platform & arch. This really
# matters for the few common arches (x86, ppc) but we pass a little
# more of them to be future-proof.
# use ABI first, this will work for most cases
case "${ABI}" in
alpha|arm|hppa|m68k|o32|ppc|s390|sh|sparc|x86) ;;
n32) myconf+=( --enable-n32 );;
x32) myconf+=( --enable-x32 );;
s390x|*64) myconf+=( --enable-64bit );;
default) # no abi actually set, fall back to old check
einfo "Running a short build test to determine 64bit'ness"
echo > "${T}"/test.c || die
${CC} ${CFLAGS} ${CPPFLAGS} -c "${T}"/test.c -o "${T}"/test.o || die
case $(file "${T}"/test.o) in
*32-bit*x86-64*) myconf+=( --enable-x32 );;
*64-bit*|*ppc64*|*x86_64*) myconf+=( --enable-64bit );;
*32-bit*|*ppc*|*i386*) ;;
*) die "Failed to detect whether your arch is 64bits or 32bits, disable distcc if you're using it, please";;
esac ;;
*) ;;
esac
# Ancient autoconf needs help finding the right tools.
LC_ALL="C" ECONF_SOURCE="${S}" \
ac_cv_path_AR="${AR}" \
econf \
--libdir="${EPREFIX}/usr/$(get_libdir)" \
$(use_enable debug) \
$(use_enable !debug optimize) \
"${myconf[@]}"
}
multilib_src_install() {
# Their build system is royally confusing, as usual
MINOR_VERSION=${MIN_PV} # Used for .so version
emake DESTDIR="${D}" install
einfo "removing static libraries as upstream has requested!"
rm -f "${ED}"/usr/$(get_libdir)/*.a || die "failed to remove static libraries."
# install nspr-config
dobin config/nspr-config
# Remove stupid files in /usr/bin
rm "${ED}"/usr/bin/prerr.properties || die
# This is used only to generate prerr.c and prerr.h at build time.
# No other projects use it, and we don't want to depend on perl.
# Talked to upstream and they agreed w/punting.
rm "${ED}"/usr/bin/compile-et.pl || die
}
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$
# dev-libs/nss/nss-9999.ebuild
EAPI=6
inherit eutils flag-o-matic multilib toolchain-funcs multilib-minimal mercurial
NSPR_VER="4.13.1"
RTM_NAME="NSS_${PV//./_}_RTM"
# Rev of https://git.fedorahosted.org/cgit/nss-pem.git
PEM_GIT_REV="429b0222759d8ad8e6dcd29e62875ae3efd69116"
PEM_P="${PN}-pem-20160329"
DESCRIPTION="Mozilla's Network Security Services library that implements PKI support"
HOMEPAGE="http://www.mozilla.org/projects/security/pki/nss/"
EHG_REPO_URI='https://hg.mozilla.org/projects/nss'
#SRC_URI="https://archive.mozilla.org/pub/security/nss/releases/${RTM_NAME}/src/${P}.tar.gz
SRC_URI="cacert? ( https://dev.gentoo.org/~axs/distfiles/${PN}-cacert-class1-class3.patch )
nss-pem? ( https://dev.gentoo.org/~polynomial-c/${PEM_P}.tar.xz )"
LICENSE="|| ( MPL-2.0 GPL-2 LGPL-2.1 )"
SLOT="0"
KEYWORDS="alpha amd64 arm ~arm64 hppa ~ia64 ~m68k ~mips ppc ~ppc64 ~s390 ~sh sparc x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux ~x86-macos ~sparc-solaris ~x64-solaris ~x86-solaris"
IUSE="cacert +nss-pem utils"
CDEPEND=">=dev-db/sqlite-3.8.2[${MULTILIB_USEDEP}]
>=sys-libs/zlib-1.2.8-r1[${MULTILIB_USEDEP}]"
DEPEND=">=virtual/pkgconfig-0-r1[${MULTILIB_USEDEP}]
>=dev-libs/nspr-${NSPR_VER}[${MULTILIB_USEDEP}]
${CDEPEND}"
RDEPEND=">=dev-libs/nspr-${NSPR_VER}[${MULTILIB_USEDEP}]
${CDEPEND}
abi_x86_32? (
!<=app-emulation/emul-linux-x86-baselibs-20140508-r12
!app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
)"
RESTRICT="test"
S="${WORKDIR}/${P}/${PN}"
#S="${WORKDIR}/${PN}"
MULTILIB_CHOST_TOOLS=(
/usr/bin/nss-config
)
PATCHES=(
# Custom changes for gentoo
"${FILESDIR}/${PN}-3.28-gentoo-fixups.patch"
"${FILESDIR}/${PN}-3.21-gentoo-fixup-warnings.patch"
"${FILESDIR}/${PN}-3.23-hppa-byte_order.patch"
)
src_fetch() {
echo "Fetching"
mercurial_fetch
echo "Fetched"
}
src_unpack() {
src_fetch
unpack ${A}
if use nss-pem ; then
mv "${PN}"/lib/ckfw/pem/ "${S}"/lib/ckfw/ || die
fi
}
src_prepare() {
if use nss-pem ; then
PATCHES+=(
"${FILESDIR}/${PN}-3.21-enable-pem.patch"
)
fi
if use cacert ; then #521462
PATCHES+=(
"${DISTDIR}/${PN}-cacert-class1-class3.patch"
)
fi
default
pushd coreconf >/dev/null || die
# hack nspr paths
echo 'INCLUDES += -I$(DIST)/include/dbm' \
>> headers.mk || die "failed to append include"
# modify install path
sed -e '/CORE_DEPTH/s:SOURCE_PREFIX.*$:SOURCE_PREFIX = $(CORE_DEPTH)/dist:' \
-i source.mk || die
# Respect LDFLAGS
sed -i -e 's/\$(MKSHLIB) -o/\$(MKSHLIB) \$(LDFLAGS) -o/g' rules.mk
popd >/dev/null || die
# Fix pkgconfig file for Prefix
sed -i -e "/^PREFIX =/s:= /usr:= ${EPREFIX}/usr:" \
config/Makefile || die
# use host shlibsign if need be #436216
if tc-is-cross-compiler ; then
sed -i \
-e 's:"${2}"/shlibsign:shlibsign:' \
cmd/shlibsign/sign.sh || die
fi
# dirty hack
sed -i -e "/CRYPTOLIB/s:\$(SOFTOKEN_LIB_DIR):../freebl/\$(OBJDIR):" \
lib/ssl/config.mk || die
sed -i -e "/CRYPTOLIB/s:\$(SOFTOKEN_LIB_DIR):../../lib/freebl/\$(OBJDIR):" \
cmd/platlibs.mk || die
multilib_copy_sources
strip-flags
}
multilib_src_configure() {
# Ensure we stay multilib aware
sed -i -e "/@libdir@/ s:lib64:$(get_libdir):" config/Makefile || die
}
nssarch() {
# Most of the arches are the same as $ARCH
local t=${1:-${CHOST}}
case ${t} in
aarch64*)echo "aarch64";;
hppa*) echo "parisc";;
i?86*) echo "i686";;
x86_64*) echo "x86_64";;
*) tc-arch ${t};;
esac
}
nssbits() {
local cc cppflags="${1}CPPFLAGS" cflags="${1}CFLAGS"
if [[ ${1} == BUILD_ ]]; then
cc=$(tc-getBUILD_CC)
else
cc=$(tc-getCC)
fi
echo > "${T}"/test.c || die
${cc} ${!cppflags} ${!cflags} -c "${T}"/test.c -o "${T}/${1}test.o" || die
case $(file "${T}/${1}test.o") in
*32-bit*x86-64*) echo USE_X32=1;;
*64-bit*|*ppc64*|*x86_64*) echo USE_64=1;;
*32-bit*|*ppc*|*i386*) ;;
*) die "Failed to detect whether ${cc} builds 64bits or 32bits, disable distcc if you're using it, please";;
esac
}
multilib_src_compile() {
# use ABI to determine bit'ness, or fallback if unset
local buildbits mybits
case "${ABI}" in
n32) mybits="USE_N32=1";;
x32) mybits="USE_X32=1";;
s390x|*64) mybits="USE_64=1";;
${DEFAULT_ABI})
einfo "Running compilation test to determine bit'ness"
mybits=$(nssbits)
;;
esac
# bitness of host may differ from target
if tc-is-cross-compiler; then
buildbits=$(nssbits BUILD_)
fi
local makeargs=(
CC="$(tc-getCC)"
AR="$(tc-getAR) rc \$@"
RANLIB="$(tc-getRANLIB)"
OPTIMIZER=
${mybits}
)
# Take care of nspr settings #436216
local myCPPFLAGS="${CPPFLAGS} $($(tc-getPKG_CONFIG) nspr --cflags)"
unset NSPR_INCLUDE_DIR
# Do not let `uname` be used.
if use kernel_linux ; then
makeargs+=(
OS_TARGET=Linux
OS_RELEASE=2.6
OS_TEST="$(nssarch)"
)
fi
export NSS_ENABLE_WERROR=0 #567158
export BUILD_OPT=1
export NSS_USE_SYSTEM_SQLITE=1
export NSDISTMODE=copy
export NSS_ENABLE_ECC=1
export FREEBL_NO_DEPEND=1
export ASFLAGS=""
local d
# Build the host tools first.
LDFLAGS="${BUILD_LDFLAGS}" \
XCFLAGS="${BUILD_CFLAGS}" \
NSPR_LIB_DIR="${T}/fakedir" \
emake -j1 -C coreconf \
CC="$(tc-getBUILD_CC)" \
${buildbits:-${mybits}}
makeargs+=( NSINSTALL="${PWD}/$(find -type f -name nsinstall)" )
# Then build the target tools.
for d in . lib/dbm ; do
CPPFLAGS="${myCPPFLAGS}" \
XCFLAGS="${CFLAGS} ${CPPFLAGS}" \
NSPR_LIB_DIR="${T}/fakedir" \
emake -j1 "${makeargs[@]}" -C ${d}
done
}
# Altering these 3 libraries breaks the CHK verification.
# All of the following cause it to break:
# - stripping
# - prelink
# - ELF signing
# http://www.mozilla.org/projects/security/pki/nss/tech-notes/tn6.html
# Either we have to NOT strip them, or we have to forcibly resign after
# stripping.
#local_libdir="$(get_libdir)"
#export STRIP_MASK="
# */${local_libdir}/libfreebl3.so*
# */${local_libdir}/libnssdbm3.so*
# */${local_libdir}/libsoftokn3.so*"
export NSS_CHK_SIGN_LIBS="freebl3 nssdbm3 softokn3"
generate_chk() {
local shlibsign="$1"
local libdir="$2"
einfo "Resigning core NSS libraries for FIPS validation"
shift 2
local i
for i in ${NSS_CHK_SIGN_LIBS} ; do
local libname=lib${i}.so
local chkname=lib${i}.chk
"${shlibsign}" \
-i "${libdir}"/${libname} \
-o "${libdir}"/${chkname}.tmp \
&& mv -f \
"${libdir}"/${chkname}.tmp \
"${libdir}"/${chkname} \
|| die "Failed to sign ${libname}"
done
}
cleanup_chk() {
local libdir="$1"
shift 1
local i
for i in ${NSS_CHK_SIGN_LIBS} ; do
local libfname="${libdir}/lib${i}.so"
# If the major version has changed, then we have old chk files.
[ ! -f "${libfname}" -a -f "${libfname}.chk" ] \
&& rm -f "${libfname}.chk"
done
}
multilib_src_install() {
pushd dist >/dev/null || die
dodir /usr/$(get_libdir)
cp -L */lib/*$(get_libname) "${ED}"/usr/$(get_libdir) || die "copying shared libs failed"
cp -L */lib/libcrmf.a "${ED}"/usr/$(get_libdir) || die "copying libs failed"
cp -L */lib/libfreebl.a "${ED}"/usr/$(get_libdir) || die "copying libs failed"
# Install nss-config and pkgconfig file
dodir /usr/bin
cp -L */bin/nss-config "${ED}"/usr/bin || die
dodir /usr/$(get_libdir)/pkgconfig
cp -L */lib/pkgconfig/nss.pc "${ED}"/usr/$(get_libdir)/pkgconfig || die
# create an nss-softokn.pc from nss.pc for libfreebl and some private headers
# bug 517266
sed -e 's#Libs:#Libs: -lfreebl#' \
-e 's#Cflags:#Cflags: -I${includedir}/private#' \
*/lib/pkgconfig/nss.pc >"${ED}"/usr/$(get_libdir)/pkgconfig/nss-softokn.pc \
|| die "could not create nss-softokn.pc"
# all the include files
insinto /usr/include/nss
doins public/nss/*.h
insinto /usr/include/nss/private
doins private/nss/{blapi,alghmac}.h
popd >/dev/null || die
local f nssutils
# Always enabled because we need it for chk generation.
nssutils="shlibsign"
if multilib_is_native_abi ; then
if use utils; then
# The tests we do not need to install.
#nssutils_test="bltest crmftest dbtest dertimetest
#fipstest remtest sdrtest"
# checkcert utils has been removed in nss-3.22:
# https://bugzilla.mozilla.org/show_bug.cgi?id=1187545
# https://hg.mozilla.org/projects/nss/rev/df1729d37870
nssutils="addbuiltin atob baddbdir btoa certcgi certutil
cmsutil conflict crlutil derdump digest makepqg mangle modutil multinit
nonspr10 ocspclnt oidcalc p7content p7env p7sign p7verify pk11mode
pk12util pp rsaperf selfserv shlibsign signtool signver ssltap strsclnt
symkeyutil tstclnt vfychain vfyserv"
# install man-pages for utils (bug #516810)
doman doc/nroff/*.1
fi
pushd dist/*/bin >/dev/null || die
for f in ${nssutils}; do
dobin ${f}
done
popd >/dev/null || die
fi
# Prelink breaks the CHK files. We don't have any reliable way to run
# shlibsign after prelink.
dodir /etc/prelink.conf.d
printf -- "-b ${EPREFIX}/usr/$(get_libdir)/lib%s.so\n" ${NSS_CHK_SIGN_LIBS} \
> "${ED}"/etc/prelink.conf.d/nss.conf
}
pkg_postinst() {
multilib_pkg_postinst() {
# We must re-sign the libraries AFTER they are stripped.
local shlibsign="${EROOT}/usr/bin/shlibsign"
# See if we can execute it (cross-compiling & such). #436216
"${shlibsign}" -h >&/dev/null
if [[ $? -gt 1 ]] ; then
shlibsign="shlibsign"
fi
generate_chk "${shlibsign}" "${EROOT}"/usr/$(get_libdir)
}
multilib_foreach_abi multilib_pkg_postinst
}
pkg_postrm() {
multilib_pkg_postrm() {
cleanup_chk "${EROOT}"/usr/$(get_libdir)
}
multilib_foreach_abi multilib_pkg_postrm
}
# Copyright 1999-2016 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$
# dev-db/sqlite/sqlite-3.16.2_pre.ebuild
EAPI="6"
inherit autotools eutils flag-o-matic multilib multilib-minimal toolchain-funcs versionator
SRC_PV="$(printf "%u%02u%02u%02u" $(get_version_components))"
DOC_PV="${SRC_PV}"
# DOC_PV="$(printf "%u%02u%02u00" $(get_version_components $(get_version_component_range 1-3)))"
DESCRIPTION="A SQL Database Engine in a C Library"
HOMEPAGE="https://sqlite.org/"
SRC_URI="doc? ( https://sqlite.org/2017/${PN}-doc-${DOC_PV}.zip )
tcl? ( https://sqlite.org/2017/${PN}-src-${SRC_PV}.zip )
test? ( https://sqlite.org/2017/${PN}-src-${SRC_PV}.zip )
tools? ( https://sqlite.org/2017/${PN}-src-${SRC_PV}.zip )
!tcl? ( !test? ( !tools? ( https://sqlite.org/2017/${PN}-autoconf-${SRC_PV}.tar.gz ) ) )"
LICENSE="public-domain"
SLOT="3"
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~ppc-aix ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~x86-freebsd ~hppa-hpux ~ia64-hpux ~x86-interix ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
IUSE="debug doc icu +readline secure-delete static-libs tcl test tools"
RDEPEND="icu? ( dev-libs/icu:0=[${MULTILIB_USEDEP}] )
readline? ( sys-libs/readline:0=[${MULTILIB_USEDEP}] )
tcl? ( dev-lang/tcl:0=[${MULTILIB_USEDEP}] )
tools? ( dev-lang/tcl:0=[${MULTILIB_USEDEP}] )"
DEPEND="${RDEPEND}
doc? ( app-arch/unzip )
tcl? ( app-arch/unzip )
test? (
app-arch/unzip
dev-lang/tcl:0[${MULTILIB_USEDEP}]
)
tools? ( app-arch/unzip )"
full_tarball() {
use tcl || use test || use tools
}
pkg_setup() {
if full_tarball; then
S="${WORKDIR}/${PN}-src-${SRC_PV}"
else
S="${WORKDIR}/${PN}-autoconf-${SRC_PV}"
fi
}
src_prepare() {
if full_tarball; then
eapply "${FILESDIR}/${PN}-3.14.0-full_tarball-build.patch"
eapply_user
# Fix AC_CHECK_FUNCS.
# https://mailinglists.sqlite.org/cgi-bin/mailman/private/sqlite-dev/2016-March/002762.html
sed -e "s/AC_CHECK_FUNCS(.*)/AC_CHECK_FUNCS([fdatasync fullfsync gmtime_r isnan localtime_r localtime_s malloc_usable_size posix_fallocate pread pread64 pwrite pwrite64 strchrnul usleep utime])/" -i configure.ac || die "sed failed"
else
eapply "${FILESDIR}/${PN}-3.12.0-nonfull_tarball-build.patch"
eapply_user
# Fix AC_CHECK_FUNCS.
# https://mailinglists.sqlite.org/cgi-bin/mailman/private/sqlite-dev/2016-March/002762.html
sed \
-e "s/AC_CHECK_FUNCS(\[fdatasync.*/AC_CHECK_FUNCS([fdatasync fullfsync gmtime_r isnan localtime_r localtime_s malloc_usable_size posix_fallocate pread pread64 pwrite pwrite64 strchrnul usleep utime])/" \
-e "/AC_CHECK_FUNCS(posix_fallocate)/d" \
-i configure.ac || die "sed failed"
fi
eautoreconf
multilib_copy_sources
}
multilib_src_configure() {
local CPPFLAGS="${CPPFLAGS}" options=()
options+=(
--enable-$(full_tarball && echo load-extension || echo dynamic-extensions)
--enable-threadsafe
)
if ! full_tarball; then
options+=(--disable-static-shell)
fi
# Support detection of misuse of SQLite API.
# https://sqlite.org/compile.html#enable_api_armor
append-cppflags -DSQLITE_ENABLE_API_ARMOR
# Support column metadata functions.
# https://sqlite.org/c3ref/column_database_name.html
append-cppflags -DSQLITE_ENABLE_COLUMN_METADATA
# Support dbstat virtual table.
# https://sqlite.org/dbstat.html
append-cppflags -DSQLITE_ENABLE_DBSTAT_VTAB
# Support comments in output of EXPLAIN.
# https://sqlite.org/compile.html#enable_explain_comments
append-cppflags -DSQLITE_ENABLE_EXPLAIN_COMMENTS
# Support Full-Text Search versions 3, 4 and 5.
# https://sqlite.org/fts3.html
# https://sqlite.org/fts5.html
append-cppflags -DSQLITE_ENABLE_FTS3 -DSQLITE_ENABLE_FTS3_PARENTHESIS -DSQLITE_ENABLE_FTS4
options+=(--enable-fts5)
# Support hidden columns.
append-cppflags -DSQLITE_ENABLE_HIDDEN_COLUMNS
# Support JSON1 extension.
# https://sqlite.org/json1.html
append-cppflags -DSQLITE_ENABLE_JSON1
# Support memsys5 memory allocator.
# https://sqlite.org/malloc.html#memsys5
append-cppflags -DSQLITE_ENABLE_MEMSYS5
# Support Resumable Bulk Update extension.
# https://sqlite.org/rbu.html
append-cppflags -DSQLITE_ENABLE_RBU
# Support R*Trees.
# https://sqlite.org/rtree.html
append-cppflags -DSQLITE_ENABLE_RTREE
# Support scan status functions.
# https://sqlite.org/c3ref/stmt_scanstatus.html
# https://sqlite.org/c3ref/stmt_scanstatus_reset.html
append-cppflags -DSQLITE_ENABLE_STMT_SCANSTATUS
# Support Session extension.
# https://sqlite.org/sessionintro.html
options+=(--enable-session)
# Support unknown() function.
# https://sqlite.org/compile.html#enable_unknown_sql_function
append-cppflags -DSQLITE_ENABLE_UNKNOWN_SQL_FUNCTION
# Support unlock notification.
# https://sqlite.org/unlock_notify.html
append-cppflags -DSQLITE_ENABLE_UNLOCK_NOTIFY
# Support soundex() function.
# https://sqlite.org/lang_corefunc.html#soundex
append-cppflags -DSQLITE_SOUNDEX
# debug USE flag.
if full_tarball; then
options+=($(use_enable debug))
else
if use debug; then
append-cppflags -DSQLITE_DEBUG
else
append-cppflags -DNDEBUG
fi
fi
# icu USE flag.
if use icu; then
# Support ICU extension.
# https://sqlite.org/compile.html#enable_icu
append-cppflags -DSQLITE_ENABLE_ICU
if full_tarball; then
sed -e "s/^TLIBS = @LIBS@/& -licui18n -licuuc/" -i Makefile.in || die "sed failed"
else
sed -e "s/^LIBS = @LIBS@/& -licui18n -licuuc/" -i Makefile.in || die "sed failed"
fi
fi
# readline USE flag.
options+=(
--disable-editline
$(use_enable readline)
)
if full_tarball && use readline; then
options+=(--with-readline-inc="-I${EPREFIX}/usr/include/readline")
fi
# secure-delete USE flag.
if use secure-delete; then
# Enable secure_delete pragma by default.
# https://sqlite.org/pragma.html#pragma_secure_delete
append-cppflags -DSQLITE_SECURE_DELETE
fi
# static-libs USE flag.
options+=($(use_enable static-libs static))
# tcl, test, tools USE flags.
if full_tarball; then
options+=(--enable-tcl)
fi
if [[ "${CHOST}" == *-mint* ]]; then
append-cppflags -DSQLITE_OMIT_WAL
fi
econf "${options[@]}"
}
multilib_src_compile() {
emake HAVE_TCL="$(usex tcl 1 "")" TCLLIBDIR="${EPREFIX}/usr/$(get_libdir)/${P}"
if use tools && multilib_is_native_abi; then
emake changeset dbhash rbu scrub showdb showjournal showstat4 showwal sqldiff sqlite3_analyzer
fi
}
multilib_src_test() {
if [[ "${EUID}" -eq 0 ]]; then
ewarn "Skipping tests due to root permissions"
return
fi
emake HAVE_TCL="$(usex tcl 1 "")" $(use debug && echo fulltest || echo test)
}
multilib_src_install() {
emake DESTDIR="${D}" HAVE_TCL="$(usex tcl 1 "")" TCLLIBDIR="${EPREFIX}/usr/$(get_libdir)/${P}" install
if use tools && multilib_is_native_abi; then
install_tool() {
if [[ -f ".libs/${1}" ]]; then
newbin ".libs/${1}" "${2}"
else
newbin "${1}" "${2}"
fi
}
install_tool changeset sqlite3-changeset
install_tool dbhash sqlite3-db-hash
install_tool rbu sqlite3-rbu
install_tool scrub sqlite3-scrub
install_tool showdb sqlite3-show-db
install_tool showjournal sqlite3-show-journal
install_tool showstat4 sqlite3-show-stat4
install_tool showwal sqlite3-show-wal
install_tool sqldiff sqlite3-diff
install_tool sqlite3_analyzer sqlite3-analyzer
unset -f install_tool
fi
}
multilib_src_install_all() {
prune_libtool_files
doman sqlite3.1
if use doc; then
rm "${WORKDIR}/${PN}-doc-${DOC_PV}/"*.{db,txt}
(
docinto html
dodoc -r "${WORKDIR}/${PN}-doc-${DOC_PV}/"*
)
fi
}
@firefish5000
Copy link
Author

firefish5000 commented Jan 17, 2017

I got sick of not having audio on my main browser, but didn't want to switch to stable since I enjoy experiencing the new/developing features. And there are a few new features I am quite fond of.

FWIW, I don't have any particular dislike of pulse, it simply doesn't add any useful functionality to my main system. I do use it extensively on my home server, however, since I needed separate volumes for media, alarms, and notifications.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment