[tbb-commits] [Git][tpo/applications/tor-browser-build][main] Bug 41129: Make an rpm package for Mullvad Browser
boklm (@boklm)
git at gitlab.torproject.org
Wed May 29 12:04:53 UTC 2024
boklm pushed to branch main at The Tor Project / Applications / tor-browser-build
Commits:
0d395222 by Nicolas Vigier at 2024-05-29T12:04:09+02:00
Bug 41129: Make an rpm package for Mullvad Browser
- - - - -
10 changed files:
- projects/linux-packages/Makefile.in
- projects/linux-packages/debian/browser.desktop.in → projects/linux-packages/browser.desktop.in
- projects/linux-packages/build
- projects/linux-packages/config
- − projects/linux-packages/debian/install.in
- − projects/linux-packages/debian/links.in
- + projects/linux-packages/rpm-package.spec
- projects/release/build
- projects/release/config
- tools/signing/linux-signer-gpg-sign
Changes:
=====================================
projects/linux-packages/Makefile.in
=====================================
@@ -3,5 +3,25 @@ build:
echo 'This is a packaged app.' > "${DEB_TARGET_ARCH}/Browser/is-packaged-app"
[% c("touch") %] "${DEB_TARGET_ARCH}/Browser/is-packaged-app"
+install:
+ mkdir -p "${DESTDIR}/[% c('var/system_pkg/install_path') %]"
+ cp -a "${DEB_TARGET_ARCH}/Browser"/* "${DESTDIR}/[% c('var/system_pkg/install_path') %]"
+ chmod -R go+rX "${DESTDIR}/[% c('var/system_pkg/install_path') %]"
+ mkdir -p "${DESTDIR}/usr/share/applications"
+ cp -a [% c("var/system_pkg/pkg_name") %].desktop "${DESTDIR}/usr/share/applications"
+ mkdir -p "${DESTDIR}/usr/bin"
+ ln -s "/[% c('var/system_pkg/install_path') %]/start-[% c('var/project-name') %]" \
+ "${DESTDIR}/usr/bin/[% c('var/system_pkg/pkg_name') %]"
+ for res in 16 32 48 64 128 ;\
+ do \
+ resdir="${DESTDIR}/usr/share/icons/hicolor/$${res}x$${res}/apps"; \
+ mkdir -p "$$resdir"; \
+ ln -s "/[% c('var/system_pkg/install_path') %]/browser/chrome/icons/default/default$${res}.png" \
+ "$${resdir}/[% c('var/system_pkg/pkg_name') %].png"; \
+ done
+ mkdir -p "${DESTDIR}/usr/share/icons/hicolor/scalable/apps"
+ ln -s "/[% c('var/system_pkg/install_path') %]/browser/chrome/icons/default/about-logo.svg" \
+ "${DESTDIR}/usr/share/icons/hicolor/scalable/apps/[% c('var/system_pkg/pkg_name') %].svg"
+
clean:
rm -f "${DEB_TARGET_ARCH}/Browser/is-packaged-app"
=====================================
projects/linux-packages/debian/browser.desktop.in → projects/linux-packages/browser.desktop.in
=====================================
=====================================
projects/linux-packages/build
=====================================
@@ -7,12 +7,13 @@ mkdir -p $OUTDIR
mkdir -p "$distdir"
export SOURCE_DATE_EPOCH='[% c("timestamp") %]'
+umask 0022
[% IF c("var/build_deb_pkg") -%]
cd $distdir
project_dir=[% c("var/system_pkg/pkg_name") %]-[% c("var/system_pkg/pkg_version") %]
mkdir "$project_dir"
- mv $rootdir/Makefile "$project_dir"
+ cp -a $rootdir/Makefile $rootdir/[% c("var/system_pkg/pkg_name") %].desktop "$project_dir"
[% c('tar', {
tar_src => [ '$project_dir' ],
tar_args => '-cJf ' _ c("var/system_pkg/pkg_name") _ '_' _ c("var/system_pkg/pkg_version") _ '.orig.tar.xz',
@@ -20,7 +21,7 @@ export SOURCE_DATE_EPOCH='[% c("timestamp") %]'
cd "$project_dir"
mv $rootdir/debian .
- chmod +x debian/install debian/docs debian/rules
+ chmod +x debian/docs debian/rules
mkdir debian/source
echo -n '3.0 (quilt)' > debian/source/format
@@ -30,7 +31,7 @@ export SOURCE_DATE_EPOCH='[% c("timestamp") %]'
deb_arch="$2"
mkdir $deb_arch
tar -C $deb_arch --strip-components=1 -xf "$src_tar"
- mv "$src_tar" \
+ cp "$src_tar" \
../[% c("var/system_pkg/pkg_name") %]_[% c("var/system_pkg/pkg_version") %].orig-$deb_arch.tar.xz
}
[% IF c("var/browser-linux-x86_64") -%]
@@ -52,4 +53,34 @@ export SOURCE_DATE_EPOCH='[% c("timestamp") %]'
mv -f "$deb_file_name" *.dsc *.orig.tar.xz *.debian.tar.xz "$OUTDIR/"
popd
[% END -%]
+
+ cd ..
+[% END %]
+
+[% IF c("var/build_rpm_pkg") -%]
+
+ cat > ~/.rpmmacros << EOF
+ %clamp_mtime_to_source_date_epoch 1
+ %use_source_date_epoch_as_buildtime 1
+ %build_mtime_policy clamp_to_source_date_epoch
+ %_buildhost localhost
+EOF
+
+ mkdir rpm
+ cd rpm
+ mkdir SPECS SOURCES
+ cp -a $rootdir/[% c("var/system_pkg/pkg_name") %].spec SPECS
+ cp -a $rootdir/Makefile $rootdir/[% c("var/system_pkg/pkg_name") %].desktop SOURCES/
+ [% IF c("var/browser-linux-x86_64") -%]
+ cp -a $rootdir/[% c('input_files_by_name/linux-x86_64') %]/[% c("var/project-name") %]-linux-x86_64-[% c("version") %].tar.xz \
+ SOURCES/[% c("var/system_pkg/pkg_name") %]-linux-x86_64-[% c("var/system_pkg/pkg_version") %].tar.xz
+ [% END -%]
+ [% IF c("var/browser-linux-i686") -%]
+ cp -a $rootdir/[% c('input_files_by_name/linux-i686') %]/[% c("var/project-name") %]-linux-i686-[% c("version") %].tar.xz \
+ SOURCES/[% c("var/system_pkg/pkg_name") %]-linux-i686-[% c("var/system_pkg/pkg_version") %].tar.xz
+ [% END -%]
+ rpmdir=$(pwd)
+ rpmbuild --define "_topdir $rpmdir" -v -bb SPECS/[% c("var/system_pkg/pkg_name") %].spec
+ mv RPMS/*/*.rpm "$OUTDIR/"
+
[% END %]
=====================================
projects/linux-packages/config
=====================================
@@ -6,11 +6,10 @@ container:
use_container: 1
var:
- build_deb_pkg: '[% c("var/mullvad-browser") %]'
system_pkg:
install_path: 'usr/lib/[% c("var/system_pkg/pkg_name") %]'
pkg_name: '[% c("var/project-name") %]-[% c("var/channel") %]'
- pkg_version: '[% c("var/torbrowser_version") %]-[% c("var/torbrowser_build") %]'
+ pkg_version: '[% c("var/torbrowser_version") %]'
pkg_revision: '1'
pkg_description: '[% c("var/display_name") %]'
deb_release_date: '[% USE date; date.format(c("timestamp"), format = "%a, %d %b %Y 01:02:03 +0000", locale = "en_US") %]'
@@ -19,25 +18,42 @@ var:
- '[% IF c("var/browser-linux-x86_64") %]amd64[% END %]'
- '[% IF c("var/browser-linux-i686") %]i386[% END %]'
- arch_deps:
- # Packages needed to build the deb package
- - dpkg-dev
- - debhelper
- - dh-exec
- # Packages needed to generate dependencies for the deb package
- - linux-libc-dev
- - libasound2-dev
- - libfontconfig1-dev
- - libfreetype6-dev
- - libgconf2-dev
- - libgtk-3-dev
- - libpango1.0-dev
- - libpulse-dev
- - libx11-xcb-dev
- - libxt-dev
targets:
+ deb:
+ var:
+ build_deb_pkg: '[% c("var/mullvad-browser") %]'
+ arch_deps:
+ # Packages needed to build the deb package
+ - dpkg-dev
+ - debhelper
+ - dh-exec
+ # Packages needed to generate dependencies for the deb package
+ - linux-libc-dev
+ - libasound2-dev
+ - libfontconfig1-dev
+ - libfreetype6-dev
+ - libgconf2-dev
+ - libgtk-3-dev
+ - libpango1.0-dev
+ - libpulse-dev
+ - libx11-xcb-dev
+ - libxt-dev
+
+ rpm:
+ var:
+ build_rpm_pkg: '[% c("var/mullvad-browser") %]'
+
+ arch_deps:
+ # Packages needed to build the rpm package
+ - rpm
+
+ # Use bookworm since rpm version from stretch does not produce
+ # reproducible rpm files
+ container:
+ suite: bookworm
+
browser-all:
- browser-linux-x86_64
- browser-linux-i686
@@ -54,6 +70,8 @@ targets:
torbrowser:
var:
browser_type: torbrowser
+ system_pkg:
+ pkg_url: 'https://torproject.org/'
basebrowser:
var:
browser_type: basebrowser
@@ -62,6 +80,7 @@ targets:
browser_type: mullvadbrowser
system_pkg:
pkg_description: 'Mullvad Browser is a privacy-focused web browser designed to minimize tracking and fingerprinting.'
+ pkg_url: 'https://mullvad.net/browser'
release:
var:
@@ -105,6 +124,11 @@ input_files:
content: "[% INCLUDE 'Makefile.in' %]"
refresh_input: 1
+ - filename: '[% c("var/system_pkg/pkg_name") %].desktop'
+ content: "[% INCLUDE 'browser.desktop.in' %]"
+ refresh_input: 1
+ enable: '[% c("var/build_deb_pkg") || c("var/build_rpm_pkg") %]'
+
# Debian Package
- filename: debian/changelog
content: "[% INCLUDE 'debian/changelog.in' %]"
@@ -120,25 +144,19 @@ input_files:
content: "[% INCLUDE 'debian/copyright.in' %]"
refresh_input: 1
enable: '[% c("var/build_deb_pkg") %]'
- - filename: debian/install
- content: "[% INCLUDE 'debian/install.in' %]"
- refresh_input: 1
- enable: '[% c("var/build_deb_pkg") %]'
- filename: debian/docs
content: "[% INCLUDE 'debian/docs.in' %]"
refresh_input: 1
enable: '[% c("var/build_deb_pkg") %]'
- - filename: 'debian/[% c("var/system_pkg/pkg_name") %].desktop'
- content: "[% INCLUDE 'debian/browser.desktop.in' %]"
- refresh_input: 1
- enable: '[% c("var/build_deb_pkg") %]'
- - filename: debian/links
- content: "[% INCLUDE 'debian/links.in' %]"
- refresh_input: 1
- enable: '[% c("var/build_deb_pkg") %]'
- filename: debian/rules
enable: '[% c("var/build_deb_pkg") %]'
+ # rpm package
+ - filename: '[% c("var/system_pkg/pkg_name") %].spec'
+ content: "[% INCLUDE 'rpm-package.spec' %]"
+ refresh_input: 1
+ enable: '[% c("var/build_rpm_pkg") %]'
+
--- |
# This part of the file contains options written in perl
(
=====================================
projects/linux-packages/debian/install.in deleted
=====================================
@@ -1,3 +0,0 @@
-#! /usr/bin/dh-exec
-${DEB_HOST_ARCH}/Browser/* [% c("var/system_pkg/install_path") %]
-debian/[% c("var/system_pkg/pkg_name") %].desktop usr/share/applications
=====================================
projects/linux-packages/debian/links.in deleted
=====================================
@@ -1,7 +0,0 @@
-[% c("var/system_pkg/install_path") %]/start-[% c("var/project-name") %] usr/bin/[% c("var/system_pkg/pkg_name") %]
-[% c("var/system_pkg/install_path") %]/browser/chrome/icons/default/default16.png usr/share/icons/hicolor/16x16/apps/[% c("var/system_pkg/pkg_name") %].png
-[% c("var/system_pkg/install_path") %]/browser/chrome/icons/default/default32.png usr/share/icons/hicolor/32x32/apps/[% c("var/system_pkg/pkg_name") %].png
-[% c("var/system_pkg/install_path") %]/browser/chrome/icons/default/default48.png usr/share/icons/hicolor/48x48/apps/[% c("var/system_pkg/pkg_name") %].png
-[% c("var/system_pkg/install_path") %]/browser/chrome/icons/default/default64.png usr/share/icons/hicolor/64x64/apps/[% c("var/system_pkg/pkg_name") %].png
-[% c("var/system_pkg/install_path") %]/browser/chrome/icons/default/default128.png usr/share/icons/hicolor/128x128/apps/[% c("var/system_pkg/pkg_name") %].png
-[% c("var/system_pkg/install_path") %]/browser/chrome/icons/default/about-logo.svg usr/share/icons/hicolor/scalable/apps/[% c("var/system_pkg/pkg_name") %].svg
=====================================
projects/linux-packages/rpm-package.spec
=====================================
@@ -0,0 +1,69 @@
+# Avoid provides/requires from private libraries
+%global privlibs libfreeblpriv3
+%global privlibs %{privlibs}|libipcclientcerts
+%global privlibs %{privlibs}|liblgpllibs
+%global privlibs %{privlibs}|libmozavcodec
+%global privlibs %{privlibs}|libmozavutil
+%global privlibs %{privlibs}|libmozgtk
+%global privlibs %{privlibs}|libmozsandbox
+%global privlibs %{privlibs}|libmozsqlite3
+%global privlibs %{privlibs}|libmozwayland
+%global privlibs %{privlibs}|libnspr4
+%global privlibs %{privlibs}|libnss3
+%global privlibs %{privlibs}|libnssckbi
+%global privlibs %{privlibs}|libnssutil3
+%global privlibs %{privlibs}|libplc4
+%global privlibs %{privlibs}|libplds4
+%global privlibs %{privlibs}|libsmime3
+%global privlibs %{privlibs}|libsoftokn3
+%global privlibs %{privlibs}|libssl3
+%global privlibs %{privlibs}|libstdc\\+\\+
+%global privlibs %{privlibs}|libxul
+%global __provides_exclude ^(%{privlibs})\\.so
+%global __requires_exclude ^(%{privlibs})\\.so
+
+Summary: [% c("var/display_name") %]
+Name: [% c("var/system_pkg/pkg_name") %]
+Version: [% c("var/system_pkg/pkg_version") %]
+Release: [% c("var/system_pkg/pkg_revision") %]
+URL: [% c("var/system_pkg/pkg_url") %]
+License: MPL-2.0 AND GPL-3.0-or-later AND OFL-1.1 AND Apache-2.0[% IF c("var/tor-browser") %] AND BSD-3-Clause AND CC0-1.0 AND MIT[% END %]
+Source0: Makefile
+Source1: [% c("var/system_pkg/pkg_name") %].desktop
+[% IF c("var/browser-linux-x86_64") -%]
+Source2: %{name}-linux-x86_64-%{version}.tar.xz
+[% END -%]
+[% IF c("var/browser-linux-i686") -%]
+Source3: %{name}-linux-i686-%{version}.tar.xz
+[% END -%]
+
+%description
+[% c("var/system_pkg/pkg_description") %]
+
+%prep
+mkdir -p "%name-%version"
+cd "%name-%version"
+cp %{_sourcedir}/Makefile .
+cp %{_sourcedir}/[% c("var/system_pkg/pkg_name") %].desktop .
+mkdir %{_arch}
+tar -C %{_arch} --strip-components=1 -xf %{_sourcedir}/%{name}-linux-%{_arch}-%{version}.tar.xz
+
+%build
+cd "%name-%version"
+DEB_TARGET_ARCH=%{_arch} make build
+
+%install
+cd "%name-%version"
+DEB_TARGET_ARCH=%{_arch} make install DESTDIR="$RPM_BUILD_ROOT"
+
+%files
+%defattr(-,root,root)
+/[% c('var/system_pkg/install_path') %]
+/usr/bin/[% c('var/system_pkg/pkg_name') %]
+/usr/share/applications/[% c("var/system_pkg/pkg_name") %].desktop
+/usr/share/icons/hicolor/16x16/apps/[% c("var/system_pkg/pkg_name") %].png
+/usr/share/icons/hicolor/32x32/apps/[% c("var/system_pkg/pkg_name") %].png
+/usr/share/icons/hicolor/48x48/apps/[% c("var/system_pkg/pkg_name") %].png
+/usr/share/icons/hicolor/64x64/apps/[% c("var/system_pkg/pkg_name") %].png
+/usr/share/icons/hicolor/128x128/apps/[% c("var/system_pkg/pkg_name") %].png
+/usr/share/icons/hicolor/scalable/apps/[% c("var/system_pkg/pkg_name") %].svg
=====================================
projects/release/build
=====================================
@@ -38,7 +38,8 @@ mkdir -p "$destdir"
mv [% c('input_files_by_name/linux-x86_64') %]/* "$destdir"/
[% END -%]
[% IF c("var/linux-packages") -%]
- mv [% c('input_files_by_name/linux-packages') %]/* "$destdir"/
+ mv [% c('input_files_by_name/deb-packages') %]/* "$destdir"/
+ mv [% c('input_files_by_name/rpm-packages') %]/* "$destdir"/
[% END -%]
[% IF c("var/browser-src") -%]
mv [% c('input_files_by_name/src-firefox') %] \
@@ -62,7 +63,7 @@ EOF
# empty any existing sh256sums file
echo -n > sha256sums-unsigned-build.txt
# concat sha256sum entry for each file in set
-for i in $(ls -1 *.exe *.tar.xz *.dmg *.mar *.zip *.tar.gz *.apk *.bspatch *.json *.deb | grep -v '\.incremental\.mar$' | sort)
+for i in $(ls -1 *.exe *.tar.xz *.dmg *.mar *.zip *.tar.gz *.apk *.bspatch *.json *.deb *.rpm | grep -v '\.incremental\.mar$' | sort)
do
sha256sum $i >> sha256sums-unsigned-build.txt
done
=====================================
projects/release/config
=====================================
@@ -188,11 +188,21 @@ input_files:
- '[% c("var/build_target") %]'
- '[% c("var/browser_type") %]-linux-i686'
- - name: linux-packages
+ - name: deb-packages
project: linux-packages
enable: '[% c("var/linux-packages") %]'
# Add linux-x86_64 targets for container config
target_prepend:
+ - deb
+ - linux-x86_64
+ - linux
+
+ - name: rpm-packages
+ project: linux-packages
+ enable: '[% c("var/linux-packages") %]'
+ # Add linux-x86_64 targets for container config
+ target_prepend:
+ - rpm
- linux-x86_64
- linux
=====================================
tools/signing/linux-signer-gpg-sign
=====================================
@@ -10,7 +10,7 @@ test -n "$GPG_PASS" || read -sp "Enter gpg passphrase: " GPG_PASS
currentdir=$(pwd)
for i in `find . -name "*.dmg" -o -name "*.exe" -o -name "*.tar.xz" \
-o -name "*.txt" -o -name "*.zip" -o -name "*.tar.gz" -o -name "*.apk" \
- -o -name "*.deb" | sort`
+ -o -name "*.deb" -o -name "*.rpm" | sort`
do
if test -f "$i.asc"
then
View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser-build/-/commit/0d395222f654e0bdc6e32a2cc42ec36267834cd0
--
This project does not include diff previews in email notifications.
View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser-build/-/commit/0d395222f654e0bdc6e32a2cc42ec36267834cd0
You're receiving this email because of your account on gitlab.torproject.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.torproject.org/pipermail/tbb-commits/attachments/20240529/a421b3a3/attachment-0001.htm>
More information about the tbb-commits
mailing list