From d065fe3ddaee8fff7acc9b4738df11877f8f7c42 Mon Sep 17 00:00:00 2001 From: Ruben Rodriguez Date: Thu, 11 Sep 2014 18:27:50 +0200 Subject: Release for upstream v31ESR --- helpers/make-firefox | 352 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 352 insertions(+) create mode 100644 helpers/make-firefox (limited to 'helpers/make-firefox') diff --git a/helpers/make-firefox b/helpers/make-firefox new file mode 100644 index 0000000..1422fe5 --- /dev/null +++ b/helpers/make-firefox @@ -0,0 +1,352 @@ +#!/bin/bash +# +# Copyright (C) 2008-2014 Ruben Rodriguez +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# + +VERSION=1 + +apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 40976EAF437D05B5 +apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 3B4FE6ACC0B21F32 +apt-key adv --recv-keys --keyserver keyserver.ubuntu.com D5946E0F + +. ./config + +#for patch in $DATA/patches/*; do +# patch -p1 < $i +#done + +cp $DATA/Changelog.IceCat $DATA/README.IceCat . +cp $DATA/Changelog.IceCat $DATA/README.IceCat debian +echo 'debian/README.IceCat +debian/Changelog.IceCat' >> debian/docs + +############################################################################### +# Set variables and build config files +############################################################################### + +#BRAND=trisquel +DATA=$DATA/$BRAND + +if [ $BRAND = trisquel ]; then + +INFOURL="www.gnu.org/software/gnuzilla/" +LEGALINFOURL="www.gnu.org/software/gnuzilla/" +ADDONSURL="www.gnu.org/software/gnuzilla/addons.html" +LISTURL="lists.gnu.org/mailman/listinfo/bug-gnuzilla" + +cat << EOF > debian/distribution.ini +[Global] +id=trisquel +version=$ICEATVERSION +about=IceCat for Trisquel GNU/Linux + +[Preferences] +app.distributor = "trisquel" +app.distributor.channel = "trisquel" +app.partner.ubuntu = "trisquel" +EOF + +else + +INFOURL="www.gnu.org/software/gnuzilla/" +LEGALINFOURL="www.gnu.org/software/gnuzilla/" +ADDONSURL="www.gnu.org/software/gnuzilla/addons.html" +LISTURL="lists.gnu.org/mailman/listinfo/bug-gnuzilla" + +cat << EOF > debian/distribution.ini +[Global] +id=trisquel +version=$ICEATVERSION +about=IceCat for Trisquel GNU/Linux + +[Preferences] +app.distributor = "trisquel" +app.distributor.channel = "trisquel" +app.partner.ubuntu = "trisquel" +EOF +fi + +############################################################################### +# Custom settings and features +############################################################################### + +# revert https://bug851702.bugzilla.mozilla.org/attachment.cgi?id=733785 +patch -p1 -R < $DATA/enable-js-options.patch + +# Disable healthreport +sed '/mozilla.org\/legal/d' -i services/healthreport/healthreport-prefs.js +cat << EOF >>services/healthreport/healthreport-prefs.js +pref("datareporting.healthreport.infoURL", "https://$INFOURL"); +EOF + +# Custom privacy statement link +sed "s%https://www.mozilla.org/legal/privacy/%https://$LEGALINFOURL%" -i ./modules/libpref/src/init/all.js ./browser/app/profile/firefox.js ./browser/base/content/aboutDialog.xul ./toolkit/content/aboutRights.xhtml + +# Replace versions for building on Trisquel +sed 's/1204/60/g; s/1210/65/g; s/1404/70/g' -i debian/config/mozconfig.in debian/firefox-dev.install.in debian/firefox-dev.links.in + +# Enable gst support +[ $REVISION = "6.0" ] && apt-get install -y --force-yes libgstreamermm-0.10-dev +[ $REVISION = "6.0" ] && echo "ac_add_options --enable-gstreamer=0.10" >> debian/config/mozconfig.in +[ $REVISION = "7.0" ] && echo "ac_add_options --enable-gstreamer=1.0" >> debian/config/mozconfig.in + +# Set vendor string +sed 's/com.ubuntu/org.gnu/' -i debian/config/mozconfig.in + +# Remove Ubuntu bookmarks +sed -i /ubuntu-bookmarks/d debian/patches/series +rm debian/patches/ubuntu-bookmarks* + +# Unbrand url codes for google and amazon +find debian/searchplugins |grep google| xargs -i /bin/sed '/ubuntu/d; /channel/d' -i {} +find debian/searchplugins |grep duck| xargs -i /bin/sed "s/canonical/$BRAND/" -i {} +find debian/searchplugins |grep amazon| xargs -i /bin/sed '/canoniccom/d;' -i {} +sed 's%duckduckgo.com/%duckduckgo.com/html%' -i debian/searchplugins/en-US/duckduckgo.xml +cp debian/searchplugins/en-US/duckduckgo.xml l10n/gd/browser/searchplugins/duckduckgo.xml + +# Plugin check url +replace "mozilla.com/plugincheck" "$ADDONSURL" . + +# contact link +#sed "s_https://input.mozilla.org/feedback_https://${LISTURL}_" -i browser/base/content/utilityOverlay.js +sed "s/^MOZ_APP_NAME\t.*/MOZ_APP_NAME\t\t:= icecat/;" debian/build/config.mk -i +sed "s/^MOZ_PKG_NAME\t.*/MOZ_PKG_NAME\t\t:= icecat/;" debian/build/config.mk -i + +############################################################################### +# Branding +############################################################################### + +# Branding files +rm browser/branding/* -rf +cp -a $DATA/branding/ browser/branding/official +cat << EOF > debian/config/branch.mk +CHANNEL = release +MOZ_WANT_UNIT_TESTS = 0 +# MOZ_BUILD_OFFICIAL = 1 +MOZ_ENABLE_BREAKPAD = 0 + +MOZILLA_REPO = http://hg.mozilla.org/releases/mozilla-release +L10N_REPO = http://hg.mozilla.org/releases/l10n/mozilla-release +EOF + +# Replace about:home +rm browser/base/content/abouthome -rf +cp $DATA/abouthome -a browser/base/content +sed '/mozilla.*png/d' -i ./browser/base/jar.mn + +# Delete stuff we don't use and that may contain trademaked logos +rm -rf ./browser/metro ./mobile ./addon-sdk/source/doc/static-files/media ./browser/themes/windows ./browser/themes/osx ./b2b + +# Custom bookmarks +cp $DATA/bookmarks.html.in browser/locales/generic/profile/bookmarks.html.in + +cp $DATA/searchplugins debian/search -a +echo "debian/search/* /usr/lib/icecat-addons/searchplugins" >> debian/firefox.install.in + +# Custom legal about pages + +find -wholename '*/brand.dtd' |xargs /bin/sed 's/trademarkInfo.part1.*/trademarkInfo.part1 "">/' -i + +for STRING in community.end3 community.exp.end community.start2 community.mozillaLink community.middle2 community.creditsLink community.end2 contribute.start contribute.getInvolvedLink contribute.end channel.description.start channel.description.end +do + find -name aboutDialog.dtd | xargs sed -i "s/ENTITY $STRING.*/ENTITY $STRING \"\">/" +done + +for STRING in rights.intro-point3-unbranded rights.intro-point4a-unbranded rights.intro-point4b-unbranded rights.intro-point4c-unbranded +do + find -name aboutRights.dtd | xargs sed -i "s/ENTITY $STRING.*/ENTITY $STRING \"\">/" +done + +replace www.mozilla.com/icecat/central $INFOURL +replace www.mozilla.com/legal/privacy $LEGALINFOURL + +sed -i 's/Mozilla\ Project<\/a>/GNU\ Project<\/a>/g' browser/base/content/overrides/app-license.html + +############################################################################### +# Batch rebranding +############################################################################### + +# Replace Firefox branding +find -type d | grep firefox | xargs rename s/firefox/icecat/ +find -type f | grep firefox | xargs rename s/firefox/icecat/ +find -type f | grep Firefox | xargs rename s/Firefox/IceCat/ +replace(){ +find $3 -type f |grep -v changelog |grep -v copyright | xargs -i sed -i s^"$1"^"$2"^g "{}" +} +replace "Mozilla Firefox" "GNU IceCat" . +replace firefox icecat . +replace Firefox IceCat . +replace FIREFOX ICECAT . +replace " Mozilla " " GNU " . +replace PACKAGES/icecat PACKAGES/firefox . +sed s/GNU/Mozilla/ python/compare-locales/scripts/compare-locales -i +sed s/GNU/Mozilla/ python/compare-locales/setup.py -i +replace "iceweasel, icecat" "iceweasel, firefox" . +replace "Replaces: icecat" "Replaces: firefox, abrowser" . +sed s/ubuntu/GNU/g debian/distribution.ini -i +replace "Adobe Flash" "Flash" . + +find -type f | grep run-mozilla | xargs rename s/mozilla/icecat/ +replace run-mozilla.sh run-icecat.sh . + +# We went too far... +replace "GNU Public" "Mozilla Public" . +replace "GNU Foundation" "Mozilla Foundation" . +replace "GNU Corporation" "Mozilla Corporation" . +replace "icecat.com" "firefox.com" . +replace "IceCat-Spdy" "Firefox-Spdy" . + +# Restore useragent to Firefox +sed "/MOZILLA_UAVERSION/ s:IceCat/:Firefox/:" -i netwerk/protocol/http/nsHttpHandler.cpp + +# Set migrator scripts +sed 's/IceCat/Firefox/g; s/icecat/firefox/g' -i browser/components/migration/src/IceCatProfileMigrator.js + +# Copy js settings +cat $DATA/settings.js >> debian/vendor-icecat.js + +if [ $BRAND = trisquel ]; then +cat << EOF >> debian/vendor-icecat.js +// Preferences for the Get Add-ons panel +pref ("extensions.webservice.discoverURL", "https://trisquel.info/browser-plain"); +pref ("extensions.getAddons.search.url", "http://trisquel.info"); + +// PFS url +pref("pfs.datasource.url", "http://trisquel.info/sites/pfs.php?mime=%PLUGIN_MIMETYPE%"); +pref("pfs.filehint.url", "http://trisquel.info/sites/pfs.php?mime=%PLUGIN_MIMETYPE%"); + +// I'm feeling Ducky. +pref("keyword.URL", "https://duckduckgo.com/html?t=trisquel&q=!+"); +pref("browser.search.defaultenginename", "DuckDuckGo"); +pref("browser.search.order.extra.duckduckgo", "DuckDuckGo"); +EOF + +else + +cat << EOF >> debian/vendor-icecat.js +// Preferences for the Get Add-ons panel +pref ("extensions.webservice.discoverURL", "https://directory.fsf.org/wiki/GNU_IceCat"); +pref ("extensions.getAddons.search.url", "https://directory.fsf.org/wiki/GNU_IceCat"); + +// PFS url +pref("pfs.datasource.url", "http://gnuzilla.gnu.org/plugins/PluginFinderService.php?mimetype=%PLUGIN_MIMETYPE%"); +pref("pfs.filehint.url", "http://gnuzilla.gnu.org/plugins/PluginFinderService.php?mimetype=%PLUGIN_MIMETYPE%"); + +// I'm feeling Ducky. +pref("keyword.URL", "https://duckduckgo.com/html?q=!+"); +pref("browser.search.defaultenginename", "DuckDuckGo"); +pref("browser.search.order.extra.duckduckgo", "DuckDuckGo"); +EOF +fi + +############################################################################### +# Extensions +############################################################################### + +# Disable search field at extensions panel +#sed '/header-search/d; /search.placeholder/d' -i toolkit/mozapps/extensions/content/extensions.xul +cat << EOF >> toolkit/mozapps/extensions/content/extensions.css +#header-search { + display:none; +} +EOF + +# Add extrnesions to manifest +#for EXTENSION in $(ls $DATA/branding/extensions/); do +#sed "/Browser Chrome Files/s%$%\n@BINPATH@/browser/extensions/$EXTENSION/*%" -i browser/installer/package-manifest.in +#done +cp $DATA/extensions extensions.gnu -a +sed '/^make-package-internal:/ s%$%\n\tcp $(topsrcdir)/extensions.gnu/* $(DIST)/icecat/browser/extensions -a%' -i toolkit/mozapps/installer/packager.mk +sed '/972ce4c6/ s%$%\n/extensions.gnu/* @MOZ_ADDONDIR@/extensions%' -i debian/icecat.install.in + +############################################################################### +# Deb generation specifics +############################################################################### +cat << EOF >> debian/abrowser.postinst.in + +if [ "\$1" = "configure" ] || [ "\$1" = "abort-upgrade" ] ; then + +[ -f /usr/bin/mozilla ] || ln -s /usr/bin/icecat /usr/bin/mozilla && true + +for USER in \$(grep -v /bin/false /etc/passwd|grep :/home|cut -d: -f1) +do + [ -d /home/\$USER/.mozilla/ ] || continue + [ -d /home/\$USER/.mozilla/icecat ] && continue + [ -d /home/\$USER/.mozilla/firefox ] && DIR=/home/\$USER/.mozilla/firefox + [ -d /home/\$USER/.mozilla/abrowser ] && DIR=/home/\$USER/.mozilla/abrowser + [ \$DIR ] || continue + echo Copying \$DIR into /home/\$USER/.mozilla/icecat + cp -a \$DIR /home/\$USER/.mozilla/icecat +done +fi +EOF + +cat << EOF >> debian/icecat.preinst.in + +EOF + +cat << EOF >> debian/icecat.postrm.in + +[ -L /usr/bin/mozilla ] && rm /usr/bin/mozilla -f || true +EOF + +echo "This package generated from Mozilla Firefox by $DEBFULLNAME <$DEBEMAIL> on +$(date) +More info at http://www.gnu.org/software/gnuzilla/ + +=== + +$(cat debian/copyright)" > debian/copyright + +# Keep firefox as source package name +#sed -i '2s/^Source:.*/Source: firefox/' debian/control.in + +# Don't recommend ubufox +sed '/xul-ext-ubufox/d' -i debian/control.in + +# In Trisquel, require torproxy +[ $BRAND = "trisquel" ] && sed 's/Depends: lsb-release,/Depends: xul-ext-torproxy, lsb-release,/' -i debian/control.in + +# Locale packages should provide firefox-locale-$LANG +sed "s/Provides.*/Provides: firefox-locale-@LANGCODE@, abrowser-locale-@LANGCODE@/" -i debian/control.langpacks + +# icecat-dev should provide firefox-dev +sed '/Package: @MOZ_PKG_NAME@-dev/,/Description:/ s/Provides:/Provides:firefox-dev, /' debian/control.in -i + +# icacat should provide and replace abrowser and firefox +sed '/Package: @MOZ_PKG_NAME@$/,/Description:/ s/Provides:/Provides:firefox, abrowser, /' debian/control.in -i +sed '/Package: @MOZ_PKG_NAME@$/,/Description:/ s/Replaces:/Replaces:firefox, abrowser, /' debian/control.in -i + +sed '/Vcs-Bzr/d; s/from Mozilla/from GNU/' debian/control.in -i + +sed "s_^Maintainer.*_Maintainer: Ruben Rodriguez _g" -i debian/control.in +rm debian/control +debian/rules debian/control +touch -d "yesterday" debian/control +debian/rules debian/control + +changelog "Converted into IceCat (http://www.gnu.org/software/gnuzilla/)" +sed "1s/firefox/icecat/; 1s/+.*)/+gnu$VERSION)/" -i debian/changelog + +compile + +#Copy compiled tarball for distribution as non-deb +#[ $ARCH=i386 ] && ARCH=i686 +#cd obj-$ARCH-linux-gnu/browser/installer +#make +#rm -rf /root/icecat* +#cp ../../icecat.* /root -- cgit v1.2.3