make-firefox 10.9 KB
Newer Older
1
#!/bin/bash
2
#
3
#    Copyright (C) 2008-2017  Ruben Rodriguez <ruben@trisquel.info>
4
#    Copyright (C) 2015       Santiago Rodriguez <santi@trisquel.info>
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
#
#    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
#

21
VERSION=48
22 23 24

. ./config

25 26
rm debian/control

27
# KDE integration patches from https://www.rosenauer.org/hg/mozilla
28
# Use firefox$MAJORVERSION branch if available, otherwise use default
Legimet committed
29
MAJORVERSION=$(echo `pkgversion` | /bin/sed 's/\([0-9]\+\).*/\1/')
30 31 32 33 34 35
BRANCH=firefox$MAJORVERSION
if ! wget --spider https://rosenauer.org/hg/mozilla/log/$BRANCH; then
	BRANCH=default
fi
wget https://rosenauer.org/hg/mozilla/raw-file/$BRANCH/mozilla-kde.patch -O debian/patches/mozilla-kde.patch
wget https://rosenauer.org/hg/mozilla/raw-file/$BRANCH/firefox-kde.patch -O debian/patches/abrowser-kde.patch
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53

# Add to series
cat << EOF >> debian/patches/series
mozilla-kde.patch
abrowser-kde.patch
EOF

# Add kde.js file
echo 'pref("browser.preferences.instantApply", false);' > debian/kde.js
sed -i '/pre-build/r /dev/stdin' debian/rules << 'EOF'
	mkdir -p $(MOZ_DISTDIR)/bin/defaults/pref
	cp $(CURDIR)/debian/kde.js $(MOZ_DISTDIR)/bin/defaults/pref/kde.js
EOF

# A line is added to widget/gtk/moz.build by unity-menubar.patch, so we have to fix mozilla-kde.patch
sed -i "/widget\/gtk\/moz\.build/,/widget\/gtk\/nsFilePicker\.cpp/{ /chromium/d; /generic/a\ \ \ \ \ '/layout/style',
; }" debian/patches/mozilla-kde.patch

Ruben Rodriguez committed
54 55 56
# js settings
cat $DATA/settings.js >> debian/vendor-firefox.js

57 58
# Replace ubufox recommendation
sed 's/xul-ext-ubufox/xul-ext-youtube-html5-video-player/' -i debian/control.in
59

60 61 62 63
# Disable healtreport
cat << EOF > toolkit/components/telemetry/healthreport-prefs.js
pref("datareporting.healthreport.uploadEnabled", false);
pref("datareporting.healthreport.about.reportUrl", "https://trisquel.info/legal");
64 65
pref("datareporting.healthreport.infoURL", "https://trisquel.info/legal");
EOF
66
cp toolkit/components/telemetry/healthreport-prefs.js mobile/android/chrome/content/healthreport-prefs.js
67

68
sed 's%https://www.mozilla.org/legal/privacy/%https://trisquel.info/legal%' -i ./modules/libpref/init/all.js ./browser/app/profile/firefox.js ./toolkit/content/aboutRights.xhtml
69 70 71

#sed 's%https://www.mozilla.org/firefox/central/%https://trisquel.info/browser%' -i browser/base/content/browser-appmenu.inc

72 73 74
# Remove Google API key
sed '/Google API/,$ d' debian/config/mozconfig.in -i

75
# Org branding
76 77
sed 's/com.ubuntu/org.trisquel/' -i debian/config/mozconfig.in

78 79
# Disable DRM support
echo ac_add_options --disable-eme >> debian/config/mozconfig.in
80
sed '/gmp-clearkey/d' -i ./debian/firefox.install.in
81

82 83 84
# Locale packages should provide firefox-locale-$LANG
sed "s/Provides.*/Provides: firefox-locale-@LANGCODE@/" -i debian/control.langpacks

85
# Remove Ubuntu bookmarks
86
sed -i /ubuntu-bookmarks/d debian/patches/series
87 88
rm debian/patches/ubuntu-bookmarks*

89 90 91 92
# Remove Ubuntu l10n search preferences
sed -i /ubuntu-search-defaults/d debian/patches/series
rm debian/patches/ubuntu-search-defaults*

93
#Unbrand url codes for google and amazon
94 95 96
find debian/searchplugins |grep google| xargs -i /bin/sed '/ubuntu/d; /channel/d' -i {}
find debian/searchplugins |grep amazon| xargs -i /bin/sed '/canoniccom/d;' -i {}

97 98
#Replace canonical referer with our own for duckduckgo
find debian/searchplugins |grep duck| xargs -i /bin/sed 's/canonical/trisquel/' -i {}
99
replace "mozilla.com/plugincheck" "trisquel.info/browser" .
100

Ruben Rodriguez committed
101
# contact link
102
#sed 's_https://input.mozilla.org/feedback_https://trisquel.info/contact_' -i browser/base/content/utilityOverlay.js
Ruben Rodriguez committed
103

104 105 106 107 108 109 110 111 112 113 114 115
cat << EOF > debian/distribution.ini
[Global]
id=trisquel
version=$REVISION
about=Abrowser for Trisquel GNU/Linux

[Preferences]
app.distributor = "trisquel"
app.distributor.channel = "trisquel"
app.partner.ubuntu = "trisquel"
EOF

116 117
sed  "s/^MOZ_APP_NAME\t.*/MOZ_APP_NAME\t\t:= abrowser/;" debian/build/config.mk -i
sed  "s/^MOZ_PKG_NAME\t.*/MOZ_PKG_NAME\t\t:= abrowser/;" debian/build/config.mk -i
118 119 120 121

############################################################################3
############################################################################3
############################################################################3
122
sed "s_^Maintainer.*_Maintainer: $DEBFULLNAME <$DEBEMAIL>_g" -i debian/control.in
123 124 125

# Replace Firefox branding
find -type d | grep firefox | xargs rename s/firefox/abrowser/
126
find -type d | grep firefox | xargs rename s/firefox/abrowser/
127
find -type f | grep firefox | xargs rename s/firefox/abrowser/
128
find -type f | grep Firefox | xargs rename s/Firefox/Abrowser/
129

130
replace "Mozilla Firefox" "Abrowser" .
131 132 133 134
replace firefox abrowser .
replace Firefox Abrowser .
replace FIREFOX ABROWSER .
replace " Mozilla " " Trisquel " .
135
sed -i '2s/^Source:.*/Source: firefox/' debian/control.in
136
replace PACKAGES/abrowser PACKAGES/firefox .
137 138
sed s/Trisquel/Mozilla/ l10n/compare-locales/scripts/compare-locales -i
sed s/Trisquel/Mozilla/ l10n/compare-locales/setup.py -i
139 140
replace "iceweasel, abrowser" "iceweasel, firefox" .
replace "Replaces: abrowser" "Replaces: firefox" .
141
#sed s/Ubuntu/Trisquel/g debian/rules -i
142
sed s/ubuntu/trisquel/g debian/distribution.ini -i
143
sed 's/ubuntu_version/trisquel_version/; s/Ubuntu 10.10/Trisquel 4.0/; s/1010/40/' -i debian/abrowser.postinst.in
144
replace "Adobe Flash" "Flash" .
145

146 147 148
# abrowser should provide firefox
sed '/Package: @MOZ_PKG_NAME@-dev/,/Description:/ s/Provides:/Provides: firefox-dev, /' debian/control.in -i
sed '/Package: @MOZ_PKG_NAME@$/,/Description:/ s/Provides:/Provides: firefox, /' debian/control.in -i
149

150
# Branding files
151
rm browser/branding/{official,aurora,nightly,unofficial} -rf
152
cp -a $DATA/branding/ browser/branding/official
153
cat << EOF > debian/config/branch.mk
154
CHANNEL                 = release
155
MOZ_WANT_UNIT_TESTS     = 0
156
# MOZ_BUILD_OFFICIAL    = 1
157 158 159 160 161 162
MOZ_ENABLE_BREAKPAD     = 0

MOZILLA_REPO = http://hg.mozilla.org/releases/mozilla-release
L10N_REPO = http://hg.mozilla.org/releases/l10n/mozilla-release
EOF

163 164 165 166
# 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
167
sed '/abouthome/s/*/ /' -i ./browser/base/jar.mn
168 169

# Delete stuff we don't use and that may contain trademaked logos
170
rm -rf ./browser/metro ./addon-sdk/source/doc/static-files/media ./browser/themes/windows ./browser/themes/osx ./b2g
171 172

#Trisquel custom bookmarks
Ruben Rodriguez committed
173
cp $DATA/bookmarks.html.in browser/locales/generic/profile/bookmarks.html.in
174

175 176 177
#Trisquel custom search engines
cp $DATA/searchplugins/*.xml debian/searchplugins/en-US/
cp $DATA/searchplugins/searchplugins.conf debian/config/
178

179 180 181 182
# install aboutabrowser extension
cp $DATA/aboutabrowser@trisquel.info -r debian
echo "debian/aboutabrowser@trisquel.info @MOZ_ADDONDIR@/extensions/" >> debian/abrowser.install.in

183
# Disable newtab "What is this" popup and config button
184
cat << EOF >> browser/themes/linux/newtab/newTab.css
185 186
#newtab-customize-button, #newtab-intro-what{
display:none
187 188 189
}
EOF

190
# Disable search field at extensions panel
191 192
#sed  '/header-search/d; /search.placeholder/d' -i toolkit/mozapps/extensions/content/extensions.xul
cat << EOF >> toolkit/mozapps/extensions/content/extensions.css
193 194 195 196 197
#header-search {
  display:none;
}
EOF

198 199 200 201 202 203 204 205
# Hide mobile promo
echo ".fxaMobilePromo {  display: none !important; }" >> browser/themes/shared/incontentprefs/preferences.inc.css
# Hide plugindeprecation-notice
echo "#plugindeprecation-notice {  display: none !important; }" >> toolkit/mozapps/extensions/content/extensions.css
# Hide warnings on unsigned extensions
echo ".warning{display: none!important; } .addon[notification=warning]{background-image: none!important;}" >> toolkit/mozapps/extensions/content/extensions.css
# Hide extra links in about box
sed '/releaseNotes.link/d; /helpus/d' -i ./browser/base/content/aboutDialog.xul
206

207
find -wholename '*/brand.dtd' |xargs /bin/sed 's/trademarkInfo.part1.*/trademarkInfo.part1 "">/' -i
208 209 210 211 212 213 214 215 216 217 218 219 220 221

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/abrowser/central trisquel.info/browser
replace www.mozilla.com/legal/privacy trisquel.info/legal

222
sed -i 's/<a\ href\=\"http\:\/\/www.mozilla.org\/\">Mozilla\ Project<\/a>/<a\ href\=\"http\:\/\/www.trisquel.info\/\"\>Trisquel\ Project<\/a>/g' browser/base/content/overrides/app-license.html
223 224 225 226 227

# We went too far...
replace "Trisquel Public" "Mozilla Public" .
replace "Trisquel Foundation" "Mozilla Foundation" .
replace "Trisquel Corporation" "Mozilla Corporation" .
Ruben Rodriguez committed
228
replace "abrowser.com" "firefox.com" .
229
#sed -i 's/iceweasel, abrowser, icecat,/iceweasel, firefox, icecat,/g' debian/control.in
230
sed '/Provides/s/abrowser-locale/firefox-locale/' -i debian/control.langpacks
231 232

# Restore useragent to Firefox
233
sed '/MOZILLA_UAVERSION/ s:Abrowser/:Firefox/:' -i netwerk/protocol/http/nsHttpHandler.cpp
234 235

# Set migrator scripts
236
sed 's/Abrowser/Firefox/g; s/abrowser/firefox/g' -i browser/components/migration/AbrowserProfileMigrator.js
237 238 239
sed s/ChromeProfileMigrator/_temp_/ -i browser/components/migration/moz.build
sed s/AbrowserProfileMigrator/ChromeProfileMigrator/ -i browser/components/migration/moz.build
sed s/_temp_/AbrowserProfileMigrator/ -i browser/components/migration/moz.build
240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257

# Postinst script to manage profile migration and system links
echo '

if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] ; then

[ -f /usr/bin/firefox ] || ln -s /usr/bin/abrowser /usr/bin/firefox

for HOMEDIR in $(grep :/home/ /etc/passwd |grep -v usbmux |grep -v syslog|cut -d : -f 6)
do
    [ -d $HOMEDIR/.mozilla/abrowser ] && continue || true
    [ -d $HOMEDIR/.mozilla/firefox ] || continue
    echo Linking $HOMEDIR/.mozilla/firefox into $HOMEDIR/.mozilla/abrowser
    ln -s $HOMEDIR/.mozilla/firefox $HOMEDIR/.mozilla/abrowser
done 
fi
exit 0 ' >> debian/abrowser.postinst.in

258 259
debian/rules debian/control
touch -d "yesterday" debian/control
260 261
debian/rules debian/control

262 263 264
# Regenerate addon-sdk/moz.build
./mach generate-addon-sdk-moz-build

265 266 267
changelog  "Rebranded for Trisquel"

compile