| OLD | NEW |
| 1 libadblockplus | 1 libadblockplus |
| 2 ============== | 2 ============== |
| 3 | 3 |
| 4 A C++ library offering the core functionality of Adblock Plus. | 4 A C++ library offering the core functionality of Adblock Plus. |
| 5 | 5 |
| 6 Getting/updating the dependencies | 6 Getting/updating the dependencies |
| 7 --------------------------------- | 7 --------------------------------- |
| 8 | 8 |
| 9 libadblockplus has dependencies that aren't part of this repository. They are | 9 libadblockplus has dependencies that aren't part of this repository. They are |
| 10 retrieved and updated during the build process, but you can also manually update | 10 retrieved and updated during the build process, but you can also manually update |
| 11 them by running the following: | 11 them by running the following: |
| 12 | 12 |
| 13 ./ensure_dependencies.py | 13 ./ensure_dependencies.py |
| 14 | 14 |
| 15 Additionally one should provide V8 headers in order to build libadblockplus |
| 16 library and V8 prebuilt libraries in order to link a binary (executable, shared |
| 17 object/DLL), even libadblockplus tests. The last time is was tested against V8 |
| 18 6.7. |
| 19 For more details see below. |
| 20 |
| 15 Building | 21 Building |
| 16 -------- | 22 -------- |
| 17 | 23 |
| 18 ### Supported target platforms and prerequisites | 24 ### Supported target platforms and prerequisites |
| 19 | 25 |
| 20 You need a C++11 compatible compiler to build libadblockplus. | 26 You need a C++14 compatible compiler to build libadblockplus. Below there is |
| 27 the list of tested tools. |
| 21 | 28 |
| 22 Win32: | 29 Win32: |
| 23 * At least v140 Visual C++ toolset (available in Microsoft Visual Studio 2015). | 30 * At least v141 Visual C++ toolset (available in Microsoft Visual Studio 2017). |
| 24 | 31 |
| 25 Linux: | 32 Linux: |
| 26 * g++ 5.2 | 33 * g++ 7.3 |
| 27 | 34 |
| 28 Mac: | 35 Mac: |
| 29 * clang 3.6 for OS X/macOS (Xcode should be installed and its developer tools sh
ould be "selected"). | 36 * Apple LLVM 9.1.0 for OS X/macOS (Xcode should be installed and its developer t
ools should be "selected"). |
| 30 | 37 |
| 31 Android: | 38 Android: |
| 32 * The host system should be Linux or OS X | 39 * The host system should be Linux or OS X |
| 33 * android-ndk-r12b Here are the links for downloading | 40 * android-ndk-r16b, here are the links for downloading |
| 34 [OS X](https://dl.google.com/android/repository/android-ndk-r12b-darwin-x86_64
.zip), | 41 [OS X](https://dl.google.com/android/repository/android-ndk-r16b-darwin-x86_64
.zip), |
| 35 [Linux 64](https://dl.google.com/android/repository/android-ndk-r12b-linux-x86
_64.zip). | 42 [Linux 64](https://dl.google.com/android/repository/android-ndk-r16b-linux-x86
_64.zip). |
| 36 * g++ multilib | 43 * g++ multilib |
| 37 | 44 |
| 38 If you have a compilation issue with another compiler please [create an issue](h
ttps://issues.adblockplus.org/). | 45 If you have a compilation issue with another compiler please [create an issue](h
ttps://issues.adblockplus.org/). |
| 39 | 46 |
| 40 You also need Python 2.7 and ensure that `python.exe` is in your `PATH`. | 47 You also need Python 2.7 and ensure that `python.exe` is in your `PATH`. |
| 41 | 48 |
| 42 ### Unix | 49 ### Unix |
| 43 | 50 |
| 51 * Prepare V8 and set environment variables LIBV8_LIB_DIR and LIBV8_INCLUDE_DIR. |
| 52 LIBV8_INCLUDE_DIR should point to the include directory of V8, e.g. |
| 53 `.../v8/include` and there should be `libv8_monolith.a` in the directory |
| 54 LIBV8_LIB_DIR. |
| 55 |
| 44 Using Make: | 56 Using Make: |
| 45 | 57 |
| 46 make | 58 make |
| 47 | 59 |
| 48 The default target architecture is the architecture of a host. In order to build
for a different architecture pass `ARCH` to `make`, e.g. run: | 60 The default target architecture is the architecture of a host. In order to build
for a different architecture pass `TARGET_ARCH` to `make`, e.g. run: |
| 49 | 61 |
| 50 make ARCH=ia32 | 62 make TARGET_ARCH=ia32 |
| 51 | 63 |
| 52 supported values are `ia32` and `x64`. | 64 supported values are `ia32` and `x64`. |
| 53 | 65 |
| 54 | 66 |
| 55 To build and run the tests: | 67 To build and run the tests: |
| 56 | 68 |
| 57 make test | 69 make test |
| 58 | 70 |
| 59 Likewise, use the following with `ARCH`: | 71 Likewise, use the following with `TARGET_ARCH`: |
| 60 | 72 |
| 61 make test ARCH=ia32 | 73 make test TARGET_ARCH=ia32 |
| 62 | 74 |
| 63 To run specific tests, you can specify a filter: | 75 To run specific tests, you can specify a filter: |
| 64 | 76 |
| 65 make test FILTER=*.Matches | 77 make test FILTER=*.Matches |
| 66 | 78 |
| 67 ### Windows | 79 ### Windows |
| 68 | 80 |
| 69 * Execute `createsolution.bat` to generate project files, this will create | 81 * Prepare V8. Let's say V8 is prepared in `build/v8`. There should be V8 |
| 70 `build\ia32\libadblockplus.sln` (solution for the 32 bit build) and | 82 headers in `build/v8/include` and binaries in |
| 71 `build\x64\libadblockplus.sln` (solution for the 64 bit build). Unfortunately, | 83 `build/v8/win-%PLATFORM%.%CONFIGURATION%`, e.g ensure that there is |
| 72 V8 doesn't support creating both from the same project files. | 84 `v8_monolith.lib` available as `build/v8/win-x64.release/v8_monolith.lib`. |
| 85 |
| 86 * Set GYP variable `v8_dir` pointing to the prepared V8, `<path to build/v8>`. |
| 87 E.g. `set "GYP_DEFINES=v8_dir=e:/v8-6.7"` and execute `createsolution.bat` to |
| 88 generate project files, this will create `build\ia32\libadblockplus.sln` |
| 89 (solution for the 32 bit build) and `build\x64\libadblockplus.sln` (solution |
| 90 for the 64 bit build). |
| 91 |
| 73 * Open `build\ia32\libadblockplus.sln` or `build\x64\libadblockplus.sln` in | 92 * Open `build\ia32\libadblockplus.sln` or `build\x64\libadblockplus.sln` in |
| 74 Visual Studio and build the solution there. Alternatively you can use the | 93 Visual Studio and build the solution there. Alternatively you can use the |
| 75 `msbuild` command line tool, e.g. run `msbuild /m build\ia32\libadblockplus.sln` | 94 `msbuild` command line tool, e.g. run `msbuild /m build\ia32\libadblockplus.sln` |
| 76 from the Visual Studio Developer Command Prompt to create a 32 bit debug build. | 95 from the Visual Studio Developer Command Prompt to create a 32 bit debug build. |
| 77 | 96 |
| 78 Tested on Microsoft Visual Studio 2015 Community Edition. | 97 Tested on Microsoft Visual Studio 2017 Community Edition. |
| 98 |
| 99 For more details see CI configuration for appveyor. |
| 79 | 100 |
| 80 ### Building for Android | 101 ### Building for Android |
| 81 | 102 |
| 82 First set ANDROID_NDK_ROOT environment variable to your Android NDK directory. | 103 Configure V8 as for Unix and set ANDROID_NDK_ROOT environment variable to your |
| 104 Android NDK directory. |
| 83 | 105 |
| 84 To build for *x86* arch run: | 106 To build for *x86* arch run: |
| 85 | 107 |
| 86 make android_x86 | 108 make TARGET_OS=android TARGET_ARCH=ia32 |
| 87 | 109 |
| 88 To build for *arm* or *arm64* arch run: | 110 To build for *arm* or *arm64* arch run: |
| 89 | 111 |
| 90 make android_arm | 112 make TARGET_OS=android TARGET_ARCH=arm |
| 91 | 113 |
| 92 or | 114 or |
| 93 make android_arm64 | 115 make TARGET_OS=android TARGET_ARCH=arm64 |
| 94 | 116 |
| 95 Usage | 117 Usage |
| 96 ----- | 118 ----- |
| 97 | 119 |
| 98 You can use libadblockplus to build an ad blocker. Or, strictly speaking, a web | 120 You can use libadblockplus to build an ad blocker. Or, strictly speaking, a web |
| 99 content filter. Just like Adblock Plus, it can detect resources that should be | 121 content filter. Just like Adblock Plus, it can detect resources that should be |
| 100 blocked based on their URL and context information, and generate CSS selectors | 122 blocked based on their URL and context information, and generate CSS selectors |
| 101 to hide DOM elements. | 123 to hide DOM elements. |
| 102 | 124 |
| 103 The basic usage is explained below, see the | 125 The basic usage is explained below, see the |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 ### Unix | 268 ### Unix |
| 247 | 269 |
| 248 The shell is automatically built by `make`, you can run it as follows: | 270 The shell is automatically built by `make`, you can run it as follows: |
| 249 | 271 |
| 250 build/out/abpshell | 272 build/out/abpshell |
| 251 | 273 |
| 252 ### Windows | 274 ### Windows |
| 253 | 275 |
| 254 Just run the project *abpshell*. | 276 Just run the project *abpshell*. |
| 255 | 277 |
| 256 Building with prebuilt V8 | 278 Building V8 |
| 257 ------------------------- | 279 ------------------------- |
| 258 | 280 |
| 259 This functionality is only for internal usage. | 281 Just in case one can find args files to build V8 in `v8-args` directory. |
| 260 | |
| 261 ## How to use it: | |
| 262 Let's say that v8 is stored in `libadblockplus/v8-bins`. | |
| 263 ### Windows | |
| 264 | |
| 265 set "GYP_DEFINES=libv8_include_dir=../../v8-bins/win/include libv8_lib_dir=.
./../v8-bins/win/Win32/<(CONFIGURATION_NAME) libv8_no_build=true" | |
| 266 createsolution.bat | |
| 267 | |
| 268 ### *nix | |
| 269 | |
| 270 [ANDROID_NDK_ROOT=....] make [android_...] LIBV8_LIB_DIR=../v8-bins/libs LIB
V8_INCLUDE_DIR=../v8-bins/include | |
| 271 | |
| 272 The rest is the same. | |
| 273 | 282 |
| 274 Linting | 283 Linting |
| 275 ------- | 284 ------- |
| 276 | 285 |
| 277 You can lint the code using [ESLint](http://eslint.org). | 286 You can lint the code using [ESLint](http://eslint.org). |
| 278 | 287 |
| 279 npm run eslint | 288 npm run eslint |
| 280 | 289 |
| 281 In order to set up ESLint and | 290 In order to set up ESLint and |
| 282 [configuration eslint-config-eyeo](https://hg.adblockplus.org/codingtools/file/t
ip/eslint-config-eyeo) you need [Node.js 7 or higher](https://nodejs.org/) and o
nce it is installed please run `npm install` in the repository directory. | 291 [configuration eslint-config-eyeo](https://hg.adblockplus.org/codingtools/file/t
ip/eslint-config-eyeo) you need [Node.js 7 or higher](https://nodejs.org/) and o
nce it is installed please run `npm install` in the repository directory. |
| 283 | 292 |
| OLD | NEW |