uBlock/Makefile

94 lines
2.3 KiB
Makefile
Raw Permalink Normal View History

# https://stackoverflow.com/a/6273809
run_options := $(filter-out $@,$(MAKECMDGOALS))
.PHONY: all clean cleanassets test lint chromium opera firefox npm dig mv3 mv3-quick \
2021-08-29 14:58:20 +02:00
compare maxcost medcost mincost modifiers record wasm
2021-07-31 14:41:28 +02:00
sources := $(wildcard assets/* assets/*/* dist/version src/* src/*/* src/*/*/* src/*/*/*/*)
platform := $(wildcard platform/* platform/*/* platform/*/*/* platform/*/*/*/* platform/*/*/*/*/*)
assets := dist/build/uAssets
2021-07-31 14:41:28 +02:00
all: chromium firefox npm
2021-07-31 14:41:28 +02:00
dist/build/uBlock0.chromium: tools/make-chromium.sh $(sources) $(platform) $(assets)
2021-07-31 14:41:28 +02:00
tools/make-chromium.sh
# Build the extension for Chromium.
chromium: dist/build/uBlock0.chromium
2023-01-01 16:21:54 +01:00
dist/build/uBlock0.opera: tools/make-opera.sh $(sources) $(platform) $(assets)
tools/make-opera.sh
# Build the extension for Opera.
opera: dist/build/uBlock0.opera
dist/build/uBlock0.firefox: tools/make-firefox.sh $(sources) $(platform) $(assets)
2021-07-31 14:41:28 +02:00
tools/make-firefox.sh all
# Build the extension for Firefox.
firefox: dist/build/uBlock0.firefox
dist/build/uBlock0.npm: tools/make-nodejs.sh $(sources) $(platform) $(assets)
tools/make-npm.sh
2021-07-31 14:41:28 +02:00
# Build the Node.js package.
npm: dist/build/uBlock0.npm
2021-07-31 14:41:28 +02:00
lint: npm
2021-08-16 18:34:54 +02:00
cd dist/build/uBlock0.npm && npm run lint
test: npm
2021-08-16 18:34:54 +02:00
cd dist/build/uBlock0.npm && npm run test
test-full-battery: npm
cd dist/build/uBlock0.npm && npm run test-full-battery
2021-08-18 13:28:23 +02:00
check-leaks: npm
cd dist/build/uBlock0.npm && npm run check-leaks
dist/build/uBlock0.dig: tools/make-nodejs.sh $(sources) $(platform) $(assets)
tools/make-dig.sh
dig: dist/build/uBlock0.dig
cd dist/build/uBlock0.dig && npm install
dig-snfe: dig
cd dist/build/uBlock0.dig && npm run snfe $(run_options)
2021-08-10 19:50:06 +02:00
mv3-chromium: tools/make-mv3.sh $(sources) $(platform)
tools/make-mv3.sh chromium
mv3-firefox: tools/make-mv3.sh $(sources) $(platform)
tools/make-mv3.sh firefox
Add experimental mv3 version This create a separate Chromium extension, named "uBO Minus (MV3)". This experimental mv3 version supports only the blocking of network requests through the declarativeNetRequest API, so as to abide by the stated MV3 philosophy of not requiring broad "read/modify data" permission. Accordingly, the extension should not trigger the warning at installation time: Read and change all your data on all websites The consequences of being permission-less are the following: - No cosmetic filtering (##) - No scriptlet injection (##+js) - No redirect= filters - No csp= filters - No removeparam= filters At this point there is no popup panel or options pages. The default filterset correspond to the default filterset of uBO proper: Listset for 'default': https://ublockorigin.github.io/uAssets/filters/badware.txt https://ublockorigin.github.io/uAssets/filters/filters.txt https://ublockorigin.github.io/uAssets/filters/filters-2020.txt https://ublockorigin.github.io/uAssets/filters/filters-2021.txt https://ublockorigin.github.io/uAssets/filters/filters-2022.txt https://ublockorigin.github.io/uAssets/filters/privacy.txt https://ublockorigin.github.io/uAssets/filters/quick-fixes.txt https://ublockorigin.github.io/uAssets/filters/resource-abuse.txt https://ublockorigin.github.io/uAssets/filters/unbreak.txt https://easylist.to/easylist/easylist.txt https://easylist.to/easylist/easyprivacy.txt https://malware-filter.gitlab.io/malware-filter/urlhaus-filter-online.txt https://pgl.yoyo.org/adservers/serverlist.php?hostformat=hosts&showintro=1&mimetype=plaintext The result of the conversion of the filters in all these filter lists is as follow: Ruleset size for 'default': 22245 Good: 21408 Maybe good (regexes): 127 redirect-rule= (discarded): 458 csp= (discarded): 85 removeparams= (discarded): 22 Unsupported: 145 The fact that the number of DNR rules are far lower than the number of network filters reported in uBO comes from the fact that lists-to-rulesets converter does its best to coallesce filters into minimal set of rules. Notably, the DNR's requestDomains condition property allows to create a single DNR rule out of all pure hostname-based filters. Regex-based rules are dynamically added at launch time since they must be validated as valid DNR regexes through isRegexSupported() API call. At this point I consider being permission-less the limiting factor: if broad "read/modify data" permission is to be used, than there is not much point for an MV3 version over MV2, just use the MV2 version if you want to benefit all the features which can't be implemented without broad "read/modify data" permission. To locally build the MV3 extension: make mv3 Then load the resulting extension directory in the browser using the "Load unpacked" button. From now on there will be a uBlock0.mv3.zip package available in each release.
2022-09-06 19:47:52 +02:00
mv3-quick: tools/make-mv3.sh $(sources) $(platform)
tools/make-mv3.sh quick
2022-09-07 16:23:40 +02:00
mv3-full: tools/make-mv3.sh $(sources) $(platform)
2022-09-08 17:21:39 +02:00
tools/make-mv3.sh full
Add experimental mv3 version This create a separate Chromium extension, named "uBO Minus (MV3)". This experimental mv3 version supports only the blocking of network requests through the declarativeNetRequest API, so as to abide by the stated MV3 philosophy of not requiring broad "read/modify data" permission. Accordingly, the extension should not trigger the warning at installation time: Read and change all your data on all websites The consequences of being permission-less are the following: - No cosmetic filtering (##) - No scriptlet injection (##+js) - No redirect= filters - No csp= filters - No removeparam= filters At this point there is no popup panel or options pages. The default filterset correspond to the default filterset of uBO proper: Listset for 'default': https://ublockorigin.github.io/uAssets/filters/badware.txt https://ublockorigin.github.io/uAssets/filters/filters.txt https://ublockorigin.github.io/uAssets/filters/filters-2020.txt https://ublockorigin.github.io/uAssets/filters/filters-2021.txt https://ublockorigin.github.io/uAssets/filters/filters-2022.txt https://ublockorigin.github.io/uAssets/filters/privacy.txt https://ublockorigin.github.io/uAssets/filters/quick-fixes.txt https://ublockorigin.github.io/uAssets/filters/resource-abuse.txt https://ublockorigin.github.io/uAssets/filters/unbreak.txt https://easylist.to/easylist/easylist.txt https://easylist.to/easylist/easyprivacy.txt https://malware-filter.gitlab.io/malware-filter/urlhaus-filter-online.txt https://pgl.yoyo.org/adservers/serverlist.php?hostformat=hosts&showintro=1&mimetype=plaintext The result of the conversion of the filters in all these filter lists is as follow: Ruleset size for 'default': 22245 Good: 21408 Maybe good (regexes): 127 redirect-rule= (discarded): 458 csp= (discarded): 85 removeparams= (discarded): 22 Unsupported: 145 The fact that the number of DNR rules are far lower than the number of network filters reported in uBO comes from the fact that lists-to-rulesets converter does its best to coallesce filters into minimal set of rules. Notably, the DNR's requestDomains condition property allows to create a single DNR rule out of all pure hostname-based filters. Regex-based rules are dynamically added at launch time since they must be validated as valid DNR regexes through isRegexSupported() API call. At this point I consider being permission-less the limiting factor: if broad "read/modify data" permission is to be used, than there is not much point for an MV3 version over MV2, just use the MV2 version if you want to benefit all the features which can't be implemented without broad "read/modify data" permission. To locally build the MV3 extension: make mv3 Then load the resulting extension directory in the browser using the "Load unpacked" button. From now on there will be a uBlock0.mv3.zip package available in each release.
2022-09-06 19:47:52 +02:00
dist/build/uAssets:
tools/pull-assets.sh
2021-07-31 20:50:31 +02:00
2021-07-31 14:41:28 +02:00
clean:
2021-08-16 17:54:03 +02:00
rm -rf dist/build tmp/node_modules
cleanassets:
rm -rf dist/build/mv3-data dist/build/uAssets
# Not real targets, just convenient for auto-completion at shell prompt
compare:
@echo
maxcost:
@echo
2021-08-29 14:58:20 +02:00
medcost:
@echo
mincost:
@echo
modifiers:
@echo
record:
@echo
wasm:
@echo