[Pkg-mozext-maintainers] Bug#858526: ublock-origin: Build the chromium extension

James McCoy jamessan at debian.org
Thu Mar 23 02:37:11 UTC 2017


Source: ublock-origin
Severity: wishlist
Tags: patch

After reading <20170322205820.kizersirlmrphqd4 at hephaestus.silentflame.com>
I figured I would try to build the Chromium extension.  It appears to be
fairly straight forward, so I offer up the attached patch.

I've tried to mimic the intentions of the Firefox packaging, but feel
free to make any changes you deem necessary.  I've never really looked
at the internals of extensions before, so this was cobbled together by
referencing the structure of chromium-lwn4chrome.  I did give it a test
run and it seems to work as expected.

-- System Information:
Debian Release: 9.0
  APT prefers unstable-debug
  APT policy: (500, 'unstable-debug'), (500, 'unstable'), (1, 'experimental-debug'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.9.0-1-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
-------------- next part --------------
From 66aef6cf4c1bd2eb0a951df84c2ba185c4096ab7 Mon Sep 17 00:00:00 2001
From: James McCoy <jamessan at debian.org>
Date: Wed, 22 Mar 2017 21:01:28 -0400
Subject: [PATCH] Add support for chromium

---
 debian/chromium-ublock-origin.docs                        |  1 +
 debian/chromium-ublock-origin.install                     |  2 ++
 debian/chromium/ublock-origin                             |  2 ++
 debian/control                                            | 15 +++++++++++++++
 debian/patches/0003-patch-make-assets.sh-for-Debian.patch |  7 +++++--
 debian/rules                                              |  9 ++++++++-
 debian/{docs => xul-ext-ublock-origin.docs}               |  0
 7 files changed, 33 insertions(+), 3 deletions(-)
 create mode 120000 debian/chromium-ublock-origin.docs
 create mode 100644 debian/chromium-ublock-origin.install
 create mode 100755 debian/chromium/ublock-origin
 rename debian/{docs => xul-ext-ublock-origin.docs} (100%)

diff --git a/debian/chromium-ublock-origin.docs b/debian/chromium-ublock-origin.docs
new file mode 120000
index 00000000..dc5c60a0
--- /dev/null
+++ b/debian/chromium-ublock-origin.docs
@@ -0,0 +1 @@
+xul-ext-ublock-origin.docs
\ No newline at end of file
diff --git a/debian/chromium-ublock-origin.install b/debian/chromium-ublock-origin.install
new file mode 100644
index 00000000..c6711e46
--- /dev/null
+++ b/debian/chromium-ublock-origin.install
@@ -0,0 +1,2 @@
+dist/build/uBlock0.chromium/* usr/share/chromium/extensions/ublock-origin
+debian/chromium/ublock-origin etc/chromium.d
diff --git a/debian/chromium/ublock-origin b/debian/chromium/ublock-origin
new file mode 100755
index 00000000..955a996b
--- /dev/null
+++ b/debian/chromium/ublock-origin
@@ -0,0 +1,2 @@
+#!/bin/sh
+export CHROMIUM_FLAGS="${CHROMIUM_FLAGS} --load-extension=/usr/share/chromium/extensions/ublock-origin"
diff --git a/debian/control b/debian/control
index 4e5eb867..32863d43 100644
--- a/debian/control
+++ b/debian/control
@@ -22,3 +22,18 @@ Description: general-purpose lightweight ads, malware, trackers blocker
  .
  Compared to other blockers like AdBlock and Ghostery, ?Block is focused on
  having a smaller memory and CPU footprint.
+ .
+ This package provides the Mozilla version of the addon.
+
+Package: chromium-ublock-origin
+Architecture: all
+Depends: ${misc:Depends}, fonts-font-awesome
+Recommends: chromium
+Description: general-purpose lightweight ads, malware, trackers blocker (Chromium)
+ uBlock is a small footprint blocker for against web ads, malware, trackers,
+ analytics and similar invasive items.
+ .
+ Compared to other blockers like AdBlock and Ghostery, ?Block is focused on
+ having a smaller memory and CPU footprint.
+ .
+ This package provides the Chromium version of the addon.
diff --git a/debian/patches/0003-patch-make-assets.sh-for-Debian.patch b/debian/patches/0003-patch-make-assets.sh-for-Debian.patch
index c9e4caa0..3e7ac771 100644
--- a/debian/patches/0003-patch-make-assets.sh-for-Debian.patch
+++ b/debian/patches/0003-patch-make-assets.sh-for-Debian.patch
@@ -11,7 +11,7 @@ diff --git a/tools/make-assets.sh b/tools/make-assets.sh
 index fade452..49b5da0 100755
 --- a/tools/make-assets.sh
 +++ b/tools/make-assets.sh
-@@ -6,24 +6,16 @@ DES=$1/assets
+@@ -6,26 +6,18 @@ DES=$1/assets
  
  printf "*** Packaging assets in $DES... "
  
@@ -39,4 +39,7 @@ index fade452..49b5da0 100755
 +cp -R ./uAssets/filters/*                                       $DES/ublock/
  cp -R ./assets/ublock/filter-lists.json                          $DES/ublock/
  
- cp ../uAssets/checksums/ublock0.txt                              $DES/checksums.txt
+-cp ../uAssets/checksums/ublock0.txt                              $DES/checksums.txt
++cp ./uAssets/checksums/ublock0.txt                              $DES/checksums.txt
+ 
+ echo "done."
diff --git a/debian/rules b/debian/rules
index ced99f91..d51925cd 100755
--- a/debian/rules
+++ b/debian/rules
@@ -6,11 +6,16 @@
 
 override_dh_auto_build:
 	./tools/make-firefox.sh
+	./tools/make-chromium.sh
 	xpi-pack dist/build/uBlock0.firefox xul-ext-ublock-origin.xpi
 
 
 override_dh_auto_install:
 	install-xpi xul-ext-ublock-origin.xpi -x LICENSE.txt
+	dh_install -p chromium-ublock-origin -X LICENSE.txt
+
+
+override_dh_install:
 
 
 override_dh_auto_clean:
@@ -29,9 +34,11 @@ override_dh_auto_clean:
 # installed with debian/xul-ext-ublock-origin.links (revert 020a17e
 # and then revert c14b5b3)
 override_dh_link:
-	dh_link -Xfontawesome-webfont.ttf
+	dh_link -p xul-ext-ublock-origin -Xfontawesome-webfont.ttf
 	ln -sf /usr/share/fonts/truetype/font-awesome/fontawesome-webfont.ttf \
 		debian/xul-ext-ublock-origin/usr/share/xul-ext/ublock-origin/css/fonts/fontawesome-webfont.ttf
+	dh_link -p chromium-ublock-origin usr/share/fonts/truetype/font-awesome/fontawesome-webfont.ttf \
+		usr/share/chromium/extensions/ublock-origin/css/fonts/fontawesome-webfont.ttf
 
 
 override_dh_installchangelogs:
diff --git a/debian/docs b/debian/xul-ext-ublock-origin.docs
similarity index 100%
rename from debian/docs
rename to debian/xul-ext-ublock-origin.docs
-- 
2.11.0



More information about the Pkg-mozext-maintainers mailing list