0.4.1: release packages (AppImage, tar.gz, nacre-bin, .deb, Nix), README, LICENSE
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
parent
cbac35495c
commit
b8d6f9005f
14 changed files with 946 additions and 7 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
|
@ -1,3 +1,4 @@
|
|||
target/
|
||||
releases/
|
||||
/releases/
|
||||
*.log
|
||||
/dist
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ Never modify: `~/Documents/Apps/Nacre` (the original Python Nacre, reference onl
|
|||
## 2. Facts
|
||||
|
||||
- **Engine**: WebKitGTK 6.0 (`webkit6` crate, `=0.6.1`) in a GTK 4 window; egui draws the chrome in a transparent `Gtk.GLArea` over the web views (D-033, D-035). WebKit tuning data and the engine test: `docs/engine/engine-comparison.md`, `docs/engine/tune/`. The Servo removal inventory (history): `docs/engine/servo-removal.md`. Pages' network work happens in the web process extension `webext/`.
|
||||
- Cargo package `nacre` 0.4.0, edition 2024, Rust ≥ 1.88. No Servo, vendored crates or patched engine any more; builds take minutes (~2–4 min release), not hours.
|
||||
- Cargo package `nacre` 0.4.1, edition 2024, Rust ≥ 1.88. No Servo, vendored crates or patched engine any more; builds take minutes (~2–4 min release), not hours.
|
||||
- Status: builds, `cargo test` green, hidden smokes pass; features still to re-verify on WebKit are marked in `docs/FEATURES.md`.
|
||||
- User rules: function first; plain egui UI until everything works; the Material You redesign comes afterwards (see `docs/UI-BRIEF.md`); nothing from the original is dropped silently (engine limits are shown as unavailable, see DESIGN.md "Engine limits"); never connect to Tor or proxies in tests.
|
||||
- Known gaps and things to check at the first build: `docs/REVIEW.md`. Feature list with file and review state: `docs/FEATURES.md`.
|
||||
|
|
@ -81,7 +81,7 @@ Never modify: `~/Documents/Apps/Nacre` (the original Python Nacre, reference onl
|
|||
| `tools/smoke.sh tests/smoke/pip.txt` (+ `tools/hidden.sh tests/smoke/pip.txt <out> -- tests/smoke/pip-driver.sh`: `<out>/windows.json` PiP floating), `bindings.txt` (side buttons, middle click; hidden only), `ctxmenu.txt` (site menu vs Nacre's; hidden only), `pip-return.txt` (page input after PiP and back; hidden only), `pip-loop.txt` (+ `-- tests/smoke/pip-loop-driver.sh`: PiP three rounds, ended by command, Escape, window close; `windows-<n>.json`; hidden only), selftest `pick x y` (GTK's pick at a page point + view state), `python3 tests/smoke/net/server.py &` + `SMOKE_SIZE=1280x900 tools/smoke.sh tests/smoke/auth.txt`, `tests/smoke/visible-ui.txt` (by hand, header) | PiP moves the live view and back (offline); HTTP sign-in cancel + saved login (offline); visible: portal file chooser, notification, page full screen, Web Inspector (`dialogs.txt` now also checks dialog answers, context menu, leave page, permission bars, notifications count) | now (S048, S056) |
|
||||
| `python3 tests/smoke/net/server.py &` + `tools/smoke.sh tests/smoke/player-ad.txt`; `tools/smoke.sh tests/smoke/ctxmenu.txt` | video site ad tricks (click catcher over the player, pop-under on click, pop-up without a click, ad frame in a cross-site frame must not take the tab); site context menus (`pages/site-menu.html`: YouTube-like toggle, Discord-like, plain, each 3×) and Nacre's menu keys via selftest `realkey <wtype keys>`. Hidden only, offline | now (S061) |
|
||||
| `tools/hidden.sh <script> [outdir] [-- driver.sh]` | WebKit build hidden with a driver script: Xvfb → nested niri (`tools/nested-session.sh`), throwaway home, software GL, `NACRE_SCRIPT`; the driver gets `click`/`scroll` (`tools/wl-input`), `grab` (grim), `key`/`type` (wtype). Scripts in `tests/hidden/` (`basic.txt` offline; `web.txt` + `web-driver.sh` needs internet). Read the PNGs | now (S045) |
|
||||
| appimagetool, wine + Inno Setup, VM "Windows 10" | packaging and Windows checks | see the user's global CLAUDE.md "Building" |
|
||||
| `tools/package.sh` | release files in `dist/`: tar.gz, AppImage, Arch `nacre-bin` (`packaging/arch-bin`), .deb, `packaging/nix/default.nix`, SHA256SUMS (appimagetool from `~/.local/opt/build-tools`) | now |
|
||||
|
||||
Don't assume a tool exists: check first. When your plan creates a tool, add its row here.
|
||||
|
||||
|
|
|
|||
4
Cargo.lock
generated
4
Cargo.lock
generated
|
|
@ -1899,7 +1899,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "nacre"
|
||||
version = "0.4.0"
|
||||
version = "0.4.1"
|
||||
dependencies = [
|
||||
"adblock",
|
||||
"arboard",
|
||||
|
|
@ -1935,7 +1935,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "nacre-webext"
|
||||
version = "0.4.0"
|
||||
version = "0.4.1"
|
||||
dependencies = [
|
||||
"glib-sys",
|
||||
"gobject-sys",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "nacre"
|
||||
version = "0.4.0"
|
||||
version = "0.4.1"
|
||||
edition = "2024"
|
||||
rust-version = "1.88"
|
||||
description = "Nacre, a web browser built on WebKitGTK"
|
||||
|
|
|
|||
373
LICENSE
Normal file
373
LICENSE
Normal file
|
|
@ -0,0 +1,373 @@
|
|||
Mozilla Public License Version 2.0
|
||||
==================================
|
||||
|
||||
1. Definitions
|
||||
--------------
|
||||
|
||||
1.1. "Contributor"
|
||||
means each individual or legal entity that creates, contributes to
|
||||
the creation of, or owns Covered Software.
|
||||
|
||||
1.2. "Contributor Version"
|
||||
means the combination of the Contributions of others (if any) used
|
||||
by a Contributor and that particular Contributor's Contribution.
|
||||
|
||||
1.3. "Contribution"
|
||||
means Covered Software of a particular Contributor.
|
||||
|
||||
1.4. "Covered Software"
|
||||
means Source Code Form to which the initial Contributor has attached
|
||||
the notice in Exhibit A, the Executable Form of such Source Code
|
||||
Form, and Modifications of such Source Code Form, in each case
|
||||
including portions thereof.
|
||||
|
||||
1.5. "Incompatible With Secondary Licenses"
|
||||
means
|
||||
|
||||
(a) that the initial Contributor has attached the notice described
|
||||
in Exhibit B to the Covered Software; or
|
||||
|
||||
(b) that the Covered Software was made available under the terms of
|
||||
version 1.1 or earlier of the License, but not also under the
|
||||
terms of a Secondary License.
|
||||
|
||||
1.6. "Executable Form"
|
||||
means any form of the work other than Source Code Form.
|
||||
|
||||
1.7. "Larger Work"
|
||||
means a work that combines Covered Software with other material, in
|
||||
a separate file or files, that is not Covered Software.
|
||||
|
||||
1.8. "License"
|
||||
means this document.
|
||||
|
||||
1.9. "Licensable"
|
||||
means having the right to grant, to the maximum extent possible,
|
||||
whether at the time of the initial grant or subsequently, any and
|
||||
all of the rights conveyed by this License.
|
||||
|
||||
1.10. "Modifications"
|
||||
means any of the following:
|
||||
|
||||
(a) any file in Source Code Form that results from an addition to,
|
||||
deletion from, or modification of the contents of Covered
|
||||
Software; or
|
||||
|
||||
(b) any new file in Source Code Form that contains any Covered
|
||||
Software.
|
||||
|
||||
1.11. "Patent Claims" of a Contributor
|
||||
means any patent claim(s), including without limitation, method,
|
||||
process, and apparatus claims, in any patent Licensable by such
|
||||
Contributor that would be infringed, but for the grant of the
|
||||
License, by the making, using, selling, offering for sale, having
|
||||
made, import, or transfer of either its Contributions or its
|
||||
Contributor Version.
|
||||
|
||||
1.12. "Secondary License"
|
||||
means either the GNU General Public License, Version 2.0, the GNU
|
||||
Lesser General Public License, Version 2.1, the GNU Affero General
|
||||
Public License, Version 3.0, or any later versions of those
|
||||
licenses.
|
||||
|
||||
1.13. "Source Code Form"
|
||||
means the form of the work preferred for making modifications.
|
||||
|
||||
1.14. "You" (or "Your")
|
||||
means an individual or a legal entity exercising rights under this
|
||||
License. For legal entities, "You" includes any entity that
|
||||
controls, is controlled by, or is under common control with You. For
|
||||
purposes of this definition, "control" means (a) the power, direct
|
||||
or indirect, to cause the direction or management of such entity,
|
||||
whether by contract or otherwise, or (b) ownership of more than
|
||||
fifty percent (50%) of the outstanding shares or beneficial
|
||||
ownership of such entity.
|
||||
|
||||
2. License Grants and Conditions
|
||||
--------------------------------
|
||||
|
||||
2.1. Grants
|
||||
|
||||
Each Contributor hereby grants You a world-wide, royalty-free,
|
||||
non-exclusive license:
|
||||
|
||||
(a) under intellectual property rights (other than patent or trademark)
|
||||
Licensable by such Contributor to use, reproduce, make available,
|
||||
modify, display, perform, distribute, and otherwise exploit its
|
||||
Contributions, either on an unmodified basis, with Modifications, or
|
||||
as part of a Larger Work; and
|
||||
|
||||
(b) under Patent Claims of such Contributor to make, use, sell, offer
|
||||
for sale, have made, import, and otherwise transfer either its
|
||||
Contributions or its Contributor Version.
|
||||
|
||||
2.2. Effective Date
|
||||
|
||||
The licenses granted in Section 2.1 with respect to any Contribution
|
||||
become effective for each Contribution on the date the Contributor first
|
||||
distributes such Contribution.
|
||||
|
||||
2.3. Limitations on Grant Scope
|
||||
|
||||
The licenses granted in this Section 2 are the only rights granted under
|
||||
this License. No additional rights or licenses will be implied from the
|
||||
distribution or licensing of Covered Software under this License.
|
||||
Notwithstanding Section 2.1(b) above, no patent license is granted by a
|
||||
Contributor:
|
||||
|
||||
(a) for any code that a Contributor has removed from Covered Software;
|
||||
or
|
||||
|
||||
(b) for infringements caused by: (i) Your and any other third party's
|
||||
modifications of Covered Software, or (ii) the combination of its
|
||||
Contributions with other software (except as part of its Contributor
|
||||
Version); or
|
||||
|
||||
(c) under Patent Claims infringed by Covered Software in the absence of
|
||||
its Contributions.
|
||||
|
||||
This License does not grant any rights in the trademarks, service marks,
|
||||
or logos of any Contributor (except as may be necessary to comply with
|
||||
the notice requirements in Section 3.4).
|
||||
|
||||
2.4. Subsequent Licenses
|
||||
|
||||
No Contributor makes additional grants as a result of Your choice to
|
||||
distribute the Covered Software under a subsequent version of this
|
||||
License (see Section 10.2) or under the terms of a Secondary License (if
|
||||
permitted under the terms of Section 3.3).
|
||||
|
||||
2.5. Representation
|
||||
|
||||
Each Contributor represents that the Contributor believes its
|
||||
Contributions are its original creation(s) or it has sufficient rights
|
||||
to grant the rights to its Contributions conveyed by this License.
|
||||
|
||||
2.6. Fair Use
|
||||
|
||||
This License is not intended to limit any rights You have under
|
||||
applicable copyright doctrines of fair use, fair dealing, or other
|
||||
equivalents.
|
||||
|
||||
2.7. Conditions
|
||||
|
||||
Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
|
||||
in Section 2.1.
|
||||
|
||||
3. Responsibilities
|
||||
-------------------
|
||||
|
||||
3.1. Distribution of Source Form
|
||||
|
||||
All distribution of Covered Software in Source Code Form, including any
|
||||
Modifications that You create or to which You contribute, must be under
|
||||
the terms of this License. You must inform recipients that the Source
|
||||
Code Form of the Covered Software is governed by the terms of this
|
||||
License, and how they can obtain a copy of this License. You may not
|
||||
attempt to alter or restrict the recipients' rights in the Source Code
|
||||
Form.
|
||||
|
||||
3.2. Distribution of Executable Form
|
||||
|
||||
If You distribute Covered Software in Executable Form then:
|
||||
|
||||
(a) such Covered Software must also be made available in Source Code
|
||||
Form, as described in Section 3.1, and You must inform recipients of
|
||||
the Executable Form how they can obtain a copy of such Source Code
|
||||
Form by reasonable means in a timely manner, at a charge no more
|
||||
than the cost of distribution to the recipient; and
|
||||
|
||||
(b) You may distribute such Executable Form under the terms of this
|
||||
License, or sublicense it under different terms, provided that the
|
||||
license for the Executable Form does not attempt to limit or alter
|
||||
the recipients' rights in the Source Code Form under this License.
|
||||
|
||||
3.3. Distribution of a Larger Work
|
||||
|
||||
You may create and distribute a Larger Work under terms of Your choice,
|
||||
provided that You also comply with the requirements of this License for
|
||||
the Covered Software. If the Larger Work is a combination of Covered
|
||||
Software with a work governed by one or more Secondary Licenses, and the
|
||||
Covered Software is not Incompatible With Secondary Licenses, this
|
||||
License permits You to additionally distribute such Covered Software
|
||||
under the terms of such Secondary License(s), so that the recipient of
|
||||
the Larger Work may, at their option, further distribute the Covered
|
||||
Software under the terms of either this License or such Secondary
|
||||
License(s).
|
||||
|
||||
3.4. Notices
|
||||
|
||||
You may not remove or alter the substance of any license notices
|
||||
(including copyright notices, patent notices, disclaimers of warranty,
|
||||
or limitations of liability) contained within the Source Code Form of
|
||||
the Covered Software, except that You may alter any license notices to
|
||||
the extent required to remedy known factual inaccuracies.
|
||||
|
||||
3.5. Application of Additional Terms
|
||||
|
||||
You may choose to offer, and to charge a fee for, warranty, support,
|
||||
indemnity or liability obligations to one or more recipients of Covered
|
||||
Software. However, You may do so only on Your own behalf, and not on
|
||||
behalf of any Contributor. You must make it absolutely clear that any
|
||||
such warranty, support, indemnity, or liability obligation is offered by
|
||||
You alone, and You hereby agree to indemnify every Contributor for any
|
||||
liability incurred by such Contributor as a result of warranty, support,
|
||||
indemnity or liability terms You offer. You may include additional
|
||||
disclaimers of warranty and limitations of liability specific to any
|
||||
jurisdiction.
|
||||
|
||||
4. Inability to Comply Due to Statute or Regulation
|
||||
---------------------------------------------------
|
||||
|
||||
If it is impossible for You to comply with any of the terms of this
|
||||
License with respect to some or all of the Covered Software due to
|
||||
statute, judicial order, or regulation then You must: (a) comply with
|
||||
the terms of this License to the maximum extent possible; and (b)
|
||||
describe the limitations and the code they affect. Such description must
|
||||
be placed in a text file included with all distributions of the Covered
|
||||
Software under this License. Except to the extent prohibited by statute
|
||||
or regulation, such description must be sufficiently detailed for a
|
||||
recipient of ordinary skill to be able to understand it.
|
||||
|
||||
5. Termination
|
||||
--------------
|
||||
|
||||
5.1. The rights granted under this License will terminate automatically
|
||||
if You fail to comply with any of its terms. However, if You become
|
||||
compliant, then the rights granted under this License from a particular
|
||||
Contributor are reinstated (a) provisionally, unless and until such
|
||||
Contributor explicitly and finally terminates Your grants, and (b) on an
|
||||
ongoing basis, if such Contributor fails to notify You of the
|
||||
non-compliance by some reasonable means prior to 60 days after You have
|
||||
come back into compliance. Moreover, Your grants from a particular
|
||||
Contributor are reinstated on an ongoing basis if such Contributor
|
||||
notifies You of the non-compliance by some reasonable means, this is the
|
||||
first time You have received notice of non-compliance with this License
|
||||
from such Contributor, and You become compliant prior to 30 days after
|
||||
Your receipt of the notice.
|
||||
|
||||
5.2. If You initiate litigation against any entity by asserting a patent
|
||||
infringement claim (excluding declaratory judgment actions,
|
||||
counter-claims, and cross-claims) alleging that a Contributor Version
|
||||
directly or indirectly infringes any patent, then the rights granted to
|
||||
You by any and all Contributors for the Covered Software under Section
|
||||
2.1 of this License shall terminate.
|
||||
|
||||
5.3. In the event of termination under Sections 5.1 or 5.2 above, all
|
||||
end user license agreements (excluding distributors and resellers) which
|
||||
have been validly granted by You or Your distributors under this License
|
||||
prior to termination shall survive termination.
|
||||
|
||||
************************************************************************
|
||||
* *
|
||||
* 6. Disclaimer of Warranty *
|
||||
* ------------------------- *
|
||||
* *
|
||||
* Covered Software is provided under this License on an "as is" *
|
||||
* basis, without warranty of any kind, either expressed, implied, or *
|
||||
* statutory, including, without limitation, warranties that the *
|
||||
* Covered Software is free of defects, merchantable, fit for a *
|
||||
* particular purpose or non-infringing. The entire risk as to the *
|
||||
* quality and performance of the Covered Software is with You. *
|
||||
* Should any Covered Software prove defective in any respect, You *
|
||||
* (not any Contributor) assume the cost of any necessary servicing, *
|
||||
* repair, or correction. This disclaimer of warranty constitutes an *
|
||||
* essential part of this License. No use of any Covered Software is *
|
||||
* authorized under this License except under this disclaimer. *
|
||||
* *
|
||||
************************************************************************
|
||||
|
||||
************************************************************************
|
||||
* *
|
||||
* 7. Limitation of Liability *
|
||||
* -------------------------- *
|
||||
* *
|
||||
* Under no circumstances and under no legal theory, whether tort *
|
||||
* (including negligence), contract, or otherwise, shall any *
|
||||
* Contributor, or anyone who distributes Covered Software as *
|
||||
* permitted above, be liable to You for any direct, indirect, *
|
||||
* special, incidental, or consequential damages of any character *
|
||||
* including, without limitation, damages for lost profits, loss of *
|
||||
* goodwill, work stoppage, computer failure or malfunction, or any *
|
||||
* and all other commercial damages or losses, even if such party *
|
||||
* shall have been informed of the possibility of such damages. This *
|
||||
* limitation of liability shall not apply to liability for death or *
|
||||
* personal injury resulting from such party's negligence to the *
|
||||
* extent applicable law prohibits such limitation. Some *
|
||||
* jurisdictions do not allow the exclusion or limitation of *
|
||||
* incidental or consequential damages, so this exclusion and *
|
||||
* limitation may not apply to You. *
|
||||
* *
|
||||
************************************************************************
|
||||
|
||||
8. Litigation
|
||||
-------------
|
||||
|
||||
Any litigation relating to this License may be brought only in the
|
||||
courts of a jurisdiction where the defendant maintains its principal
|
||||
place of business and such litigation shall be governed by laws of that
|
||||
jurisdiction, without reference to its conflict-of-law provisions.
|
||||
Nothing in this Section shall prevent a party's ability to bring
|
||||
cross-claims or counter-claims.
|
||||
|
||||
9. Miscellaneous
|
||||
----------------
|
||||
|
||||
This License represents the complete agreement concerning the subject
|
||||
matter hereof. If any provision of this License is held to be
|
||||
unenforceable, such provision shall be reformed only to the extent
|
||||
necessary to make it enforceable. Any law or regulation which provides
|
||||
that the language of a contract shall be construed against the drafter
|
||||
shall not be used to construe this License against a Contributor.
|
||||
|
||||
10. Versions of the License
|
||||
---------------------------
|
||||
|
||||
10.1. New Versions
|
||||
|
||||
Mozilla Foundation is the license steward. Except as provided in Section
|
||||
10.3, no one other than the license steward has the right to modify or
|
||||
publish new versions of this License. Each version will be given a
|
||||
distinguishing version number.
|
||||
|
||||
10.2. Effect of New Versions
|
||||
|
||||
You may distribute the Covered Software under the terms of the version
|
||||
of the License under which You originally received the Covered Software,
|
||||
or under the terms of any subsequent version published by the license
|
||||
steward.
|
||||
|
||||
10.3. Modified Versions
|
||||
|
||||
If you create software not governed by this License, and you want to
|
||||
create a new license for such software, you may create and use a
|
||||
modified version of this License if you rename the license and remove
|
||||
any references to the name of the license steward (except to note that
|
||||
such modified license differs from this License).
|
||||
|
||||
10.4. Distributing Source Code Form that is Incompatible With Secondary
|
||||
Licenses
|
||||
|
||||
If You choose to distribute Source Code Form that is Incompatible With
|
||||
Secondary Licenses under the terms of this version of the License, the
|
||||
notice described in Exhibit B of this License must be attached.
|
||||
|
||||
Exhibit A - Source Code Form License Notice
|
||||
-------------------------------------------
|
||||
|
||||
This Source Code Form is subject to the terms of the Mozilla Public
|
||||
License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
|
||||
If it is not possible or desirable to put the notice in a particular
|
||||
file, then You may include the notice in a location (such as a LICENSE
|
||||
file in a relevant directory) where a recipient would be likely to look
|
||||
for such a notice.
|
||||
|
||||
You may add additional accurate notices of copyright ownership.
|
||||
|
||||
Exhibit B - "Incompatible With Secondary Licenses" Notice
|
||||
---------------------------------------------------------
|
||||
|
||||
This Source Code Form is "Incompatible With Secondary Licenses", as
|
||||
defined by the Mozilla Public License, v. 2.0.
|
||||
54
README.md
Normal file
54
README.md
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
# Nacre
|
||||
|
||||
A web browser for Linux, written in Rust. Pages run in WebKitGTK 6.0 inside a GTK 4 window, and the browser's own
|
||||
interface (tabs, address bar, menus, settings pages) is drawn with egui in a Material You style that follows your
|
||||
desktop colours.
|
||||
|
||||
- Tabs, windows and incognito windows, session restore, reopen closed tabs, find in page, per-site zoom, full screen,
|
||||
picture in picture, Web Inspector.
|
||||
- Built-in ad blocker (adblock-rust filter lists), HTTPS-only mode, privacy switches, permissions per site.
|
||||
- Bookmarks, history, downloads, a password and address vault, import from Chromium and Firefox browsers and from the
|
||||
old Python Nacre, cookies.txt export.
|
||||
- Profiles, a customisable new tab page, rebindable keyboard shortcuts.
|
||||
|
||||
Linux only: WebKitGTK has no Windows or macOS build.
|
||||
|
||||
## Install
|
||||
|
||||
Downloads are on the [Releases page](https://archlinux.tail7c4f5e.ts.net/git/astar76/Nacre/releases). Check them
|
||||
against `SHA256SUMS-<version>`.
|
||||
|
||||
- **Arch Linux:** `sudo pacman -U Nacre-<version>-arch-x86_64.pkg.tar.zst` (package `nacre-bin`; remove it with
|
||||
`sudo pacman -R nacre-bin`). `packaging/arch-bin/PKGBUILD` builds the same package from the release.
|
||||
To build from this checkout instead: `./install.sh` (package `nacre`).
|
||||
- **Debian, Ubuntu and other apt systems:** `sudo apt install ./Nacre-<version>-amd64.deb`. Needs WebKitGTK 6.0 and
|
||||
a glibc as new as the one named in the package (recent releases only).
|
||||
- **Nix:** `nix profile install git+https://archlinux.tail7c4f5e.ts.net/git/astar76/Nacre` (flake), or
|
||||
`callPackage ./packaging/nix { }`.
|
||||
- **Any distribution:** unpack `Nacre-<version>-Linux-x86_64.tar.gz` and run `sh install.sh` (your home, `~/.local`,
|
||||
no root) or `sh install.sh --system` (`/usr/local`). `sh uninstall.sh` removes it; `--purge` also deletes your
|
||||
profiles and data.
|
||||
- **AppImage:** `chmod +x Nacre-<version>-x86_64.AppImage` and run it. WebKitGTK 6.0 and GStreamer come from your
|
||||
system; they are not bundled.
|
||||
|
||||
Runtime needs: `webkitgtk-6.0`, `gtk4`, GStreamer with the base, good, bad and libav plugins, `pam`, `dbus`.
|
||||
Optional: `libnotify`, `xdg-desktop-portal` (file pickers), `gnome-keyring` (keeps the cookie key).
|
||||
|
||||
## Your data
|
||||
|
||||
- `~/.config/nacre-browser/`: profiles and their settings
|
||||
- `~/.local/share/nacre-browser/<profile>/`: history, bookmarks, vault, session, site data
|
||||
- `~/.cache/nacre-browser/<profile>/`: filter lists, favicons, dictionaries
|
||||
|
||||
## Build
|
||||
|
||||
```
|
||||
nice cargo build --release -j 2 # target/release/nacre and libnacre_webext.so
|
||||
tools/package.sh # release files in dist/: tar.gz, AppImage, Arch package, .deb, SHA256SUMS
|
||||
```
|
||||
|
||||
Needs Rust, `pkgconf` and the WebKitGTK 6.0 and GTK 4 development files. Design notes are in `docs/`.
|
||||
|
||||
## Licence
|
||||
|
||||
MPL-2.0, see `LICENSE`.
|
||||
11
docs/releases/0.4.1.md
Normal file
11
docs/releases/0.4.1.md
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
# Nacre 0.4.1
|
||||
|
||||
First packaged release.
|
||||
|
||||
- **New icon colour:** the shell icon is sea teal instead of purple, so it stands apart from the other apps in a dock.
|
||||
- **Packages:** AppImage, tar.gz with an installer, Arch package `nacre-bin` (replaces a `nacre` package built from
|
||||
source), Debian/Ubuntu `.deb` and a Nix flake. WebKitGTK 6.0 and GStreamer come from your system.
|
||||
- Import from the old Python Nacre, including passwords; Save and share exports cookies.txt.
|
||||
- Google sign-in loads again.
|
||||
|
||||
Linux x86_64 only (WebKitGTK has no Windows build).
|
||||
10
flake.nix
Normal file
10
flake.nix
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
description = "A web browser built on WebKitGTK";
|
||||
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
outputs = { self, nixpkgs }:
|
||||
let pkgs = nixpkgs.legacyPackages.x86_64-linux;
|
||||
in {
|
||||
packages.x86_64-linux.default = pkgs.callPackage ./packaging/nix { };
|
||||
apps.x86_64-linux.default = { type = "app"; program = "${self.packages.x86_64-linux.default}/bin/nacre"; };
|
||||
};
|
||||
}
|
||||
159
installer.sh
Executable file
159
installer.sh
Executable file
|
|
@ -0,0 +1,159 @@
|
|||
#!/bin/sh
|
||||
# Nacre installer. Installs from a release tar.gz or AppImage, or removes an install.
|
||||
# installer.sh [--user|--system] [--prefix DIR] [--url URL] [FILE]
|
||||
# installer.sh --uninstall [--purge] [--user|--system] [--prefix DIR]
|
||||
# --user (default): ~/.local, no root. --system: /usr/local, sudo only for the copy.
|
||||
# Without FILE it uses the unpacked release folder it sits in, or Nacre-*-Linux-x86_64.tar.gz or
|
||||
# Nacre-*-x86_64.AppImage next to it. SHA256SUMS-<version> beside the file is checked when present.
|
||||
# --purge also deletes settings and data (~/.config/nacre-browser, ~/.local/share/nacre-browser, ~/.cache/nacre-browser: profiles, history, bookmarks, passwords, site data). DESTDIR=dir stages under dir (no sudo).
|
||||
# Needs glibc 2.43 or newer.
|
||||
set -eu
|
||||
|
||||
app=nacre main=nacre need=2.43
|
||||
mode=install scope=user purge=0 prefix= url= file=
|
||||
while [ $# -gt 0 ]; do
|
||||
case $1 in
|
||||
--user) scope=user ;;
|
||||
--system) scope=system ;;
|
||||
--prefix) [ $# -ge 2 ] || { echo "--prefix needs a folder." >&2; exit 2; }; prefix=$2; shift ;;
|
||||
--url) [ $# -ge 2 ] || { echo "--url needs an address." >&2; exit 2; }; url=$2; shift ;;
|
||||
--uninstall) mode=uninstall ;;
|
||||
--purge) purge=1 ;;
|
||||
-h|--help) sed -n '2,9p' "$0" | sed 's/^# \{0,1\}//'; exit 0 ;;
|
||||
-*) echo "Unknown option: $1 (see --help)." >&2; exit 2 ;;
|
||||
*) file=$1 ;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
[ "$purge" = 0 ] || [ "$mode" = uninstall ] || { echo "--purge only goes with --uninstall." >&2; exit 2; }
|
||||
if [ -z "$prefix" ]; then
|
||||
if [ "$scope" = system ]; then prefix=/usr/local; else prefix=$HOME/.local; fi
|
||||
fi
|
||||
case $prefix in /*) ;; *) echo "--prefix must be an absolute path." >&2; exit 2 ;; esac
|
||||
prefix=${prefix%/}
|
||||
destdir=${DESTDIR:-}
|
||||
root=$destdir$prefix
|
||||
list=$root/lib/$app/files
|
||||
sudo=
|
||||
if [ -z "$destdir" ] && [ "$(id -u)" != 0 ]; then
|
||||
d=$root; while [ ! -e "$d" ]; do d=$(dirname "$d"); done
|
||||
[ -w "$d" ] || sudo=sudo
|
||||
fi
|
||||
|
||||
refresh() {
|
||||
[ -z "$destdir" ] || return 0
|
||||
command -v update-desktop-database >/dev/null 2>&1 && $sudo update-desktop-database -q "$root/share/applications" 2>/dev/null || true
|
||||
[ -f "$root/share/icons/hicolor/index.theme" ] && command -v gtk-update-icon-cache >/dev/null 2>&1 \
|
||||
&& $sudo gtk-update-icon-cache -q -t -f "$root/share/icons/hicolor" 2>/dev/null || true
|
||||
}
|
||||
|
||||
# Removes the files the last install listed, then the folders that became empty.
|
||||
remove_listed() {
|
||||
[ -f "$list" ] || return 0
|
||||
while IFS= read -r f; do
|
||||
[ -n "$f" ] || continue
|
||||
$sudo rm -f "$root/$f"
|
||||
d=$(dirname "$f")
|
||||
while [ "$d" != . ] && $sudo rmdir "$root/$d" 2>/dev/null; do d=$(dirname "$d"); done
|
||||
done < "$list"
|
||||
$sudo rm -f "$list"
|
||||
$sudo rmdir "$root/lib/$app" "$root/lib" 2>/dev/null || true
|
||||
}
|
||||
|
||||
if [ "$mode" = uninstall ]; then
|
||||
if [ ! -f "$list" ]; then
|
||||
echo "Nacre is not installed in $prefix (no $list)." >&2
|
||||
[ "$purge" = 1 ] || exit 1
|
||||
else
|
||||
remove_listed
|
||||
refresh
|
||||
echo "Nacre removed from $prefix."
|
||||
fi
|
||||
if [ "$purge" = 1 ]; then
|
||||
rm -rf "${XDG_CONFIG_HOME:-$HOME/.config}/nacre-browser"
|
||||
rm -rf "${XDG_DATA_HOME:-$HOME/.local/share}/nacre-browser"
|
||||
rm -rf "${XDG_CACHE_HOME:-$HOME/.cache}/nacre-browser"
|
||||
echo "Settings and data removed (~/.config/nacre-browser, ~/.local/share/nacre-browser, ~/.cache/nacre-browser: profiles, history, bookmarks, passwords, site data)."
|
||||
else
|
||||
echo "Settings and data are kept (--purge deletes them)."
|
||||
fi
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# glibc check (NACRE_GLIBC overrides the detected version, for tests)
|
||||
have=${NACRE_GLIBC:-$(getconf GNU_LIBC_VERSION 2>/dev/null | sed 's/^glibc //')}
|
||||
if [ -z "$have" ]; then
|
||||
echo "Nacre needs glibc $need or newer, and this system does not report a glibc (musl?). Nothing was installed." >&2; exit 1
|
||||
fi
|
||||
if [ "$(printf '%s\n%s\n' "$need" "$have" | sort -V | head -n 1)" != "$need" ]; then
|
||||
echo "Nacre needs glibc $need or newer, and this system has glibc $have. Nothing was installed." >&2; exit 1
|
||||
fi
|
||||
|
||||
here=$(cd "$(dirname "$0")" && pwd)
|
||||
tmp=$(mktemp -d); trap 'rm -rf "$tmp"' EXIT INT TERM
|
||||
|
||||
if [ -n "$url" ]; then
|
||||
file=$tmp/$(basename "${url%%\?*}")
|
||||
if command -v curl >/dev/null 2>&1; then curl -fL -o "$file" -- "$url"
|
||||
elif command -v wget >/dev/null 2>&1; then wget -O "$file" -- "$url"
|
||||
else echo "Neither curl nor wget is installed, so $url cannot be fetched." >&2; exit 1; fi
|
||||
fi
|
||||
src=
|
||||
if [ -z "$file" ]; then
|
||||
if [ -f "$here/bin/$main" ]; then src=$here
|
||||
else
|
||||
for f in "$here"/Nacre-*-Linux-x86_64.tar.gz "$here"/Nacre-*-x86_64.AppImage; do
|
||||
[ -f "$f" ] && { file=$f; break; }
|
||||
done
|
||||
fi
|
||||
fi
|
||||
if [ -z "$src" ]; then
|
||||
[ -n "$file" ] && [ -f "$file" ] || { echo "No Nacre tar.gz or AppImage was given or found next to the installer." >&2; exit 1; }
|
||||
dir=$(dirname "$file"); name=$(basename "$file")
|
||||
for s in "$dir"/SHA256SUMS-*; do
|
||||
[ -f "$s" ] || continue
|
||||
line=$(grep -F " $name" "$s" | head -n 1 || true)
|
||||
[ -n "$line" ] || continue
|
||||
[ "${line%% *}" = "$(sha256sum "$file" | cut -d' ' -f1)" ] \
|
||||
|| { echo "The checksum of $name does not match $(basename "$s"). Nothing was installed." >&2; exit 1; }
|
||||
echo "Checksum ok."
|
||||
done
|
||||
mkdir "$tmp/x"
|
||||
case $name in
|
||||
*.tar.gz)
|
||||
tar -xzf "$file" -C "$tmp/x"
|
||||
src=$(find "$tmp/x" -maxdepth 1 -mindepth 1 -type d | head -n 1)
|
||||
[ -n "$src" ] && [ -f "$src/bin/$main" ] || { echo "$name has no bin/$main, so it is not a Nacre release." >&2; exit 1; } ;;
|
||||
*.AppImage)
|
||||
cp "$file" "$tmp/app"; chmod 755 "$tmp/app"
|
||||
(cd "$tmp/x" && "$tmp/app" --appimage-extract >/dev/null 2>&1) || true
|
||||
[ -d "$tmp/x/squashfs-root/usr/share" ] || { echo "Could not read the contents of $name. Nothing was installed." >&2; exit 1; }
|
||||
src=$tmp/src; mkdir -p "$src/bin"
|
||||
mv "$tmp/app" "$src/bin/$main"
|
||||
mv "$tmp/x/squashfs-root/usr/share" "$src/share"
|
||||
[ ! -d "$tmp/x/squashfs-root/usr/lib" ] || mv "$tmp/x/squashfs-root/usr/lib" "$src/lib" ;;
|
||||
*) echo "Unknown file type: $name (need .tar.gz or .AppImage)." >&2; exit 1 ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Stage with launchers pointing at this prefix, then copy and list every file for --uninstall.
|
||||
st=$tmp/stage
|
||||
mkdir -p "$st"
|
||||
for d in bin lib share; do [ ! -d "$src/$d" ] || cp -R "$src/$d" "$st/$d"; done
|
||||
for d in "$st"/share/applications/*.desktop; do
|
||||
[ -f "$d" ] || continue
|
||||
for b in "$st"/bin/*; do
|
||||
b=$(basename "$b")
|
||||
sed -i -e "s#^Exec=$b\( \|\$\)#Exec=$prefix/bin/$b\1#" -e "s#^TryExec=$b\$#TryExec=$prefix/bin/$b#" "$d"
|
||||
done
|
||||
done
|
||||
chmod 755 "$st"/bin/*
|
||||
(cd "$st" && find . \( -type f -o -type l \) | sed 's|^\./||' | sort) > "$tmp/files"
|
||||
mkdir -p "$st/lib/$app"; echo "lib/$app/files" >> "$tmp/files"; cp "$tmp/files" "$st/lib/$app/files"
|
||||
|
||||
remove_listed
|
||||
$sudo mkdir -p "$root"
|
||||
$sudo cp -R "$st/." "$root/"
|
||||
refresh
|
||||
echo "Nacre installed in $prefix/bin/$main"
|
||||
case ":$PATH:" in *":$prefix/bin:"*) ;; *) echo "Note: $prefix/bin is not on your PATH." ;; esac
|
||||
35
packaging/arch-bin/.SRCINFO
Normal file
35
packaging/arch-bin/.SRCINFO
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
pkgbase = nacre-bin
|
||||
pkgdesc = A web browser built on WebKitGTK
|
||||
pkgver = 0.4.1
|
||||
pkgrel = 1
|
||||
url = https://archlinux.tail7c4f5e.ts.net/git/astar76/Nacre
|
||||
arch = x86_64
|
||||
license = MPL-2.0
|
||||
depends = glibc>=2.43
|
||||
depends = gcc-libs
|
||||
depends = webkitgtk-6.0
|
||||
depends = gtk4
|
||||
depends = libsoup3
|
||||
depends = libepoxy
|
||||
depends = gstreamer
|
||||
depends = gst-plugins-base
|
||||
depends = gst-plugins-good
|
||||
depends = gst-plugins-bad
|
||||
depends = gst-libav
|
||||
depends = dbus
|
||||
depends = pam
|
||||
depends = hicolor-icon-theme
|
||||
depends = xdg-utils
|
||||
optdepends = libnotify: desktop notifications
|
||||
optdepends = xdg-desktop-portal: file pickers
|
||||
optdepends = gnome-keyring: keeps the cookie key
|
||||
optdepends = gst-plugin-pipewire: sound through PipeWire
|
||||
optdepends = cava: music bars
|
||||
provides = nacre
|
||||
conflicts = nacre
|
||||
options = !strip
|
||||
options = !debug
|
||||
source = Nacre-0.4.1-Linux-x86_64.tar.gz::https://archlinux.tail7c4f5e.ts.net/git/astar76/Nacre/releases/download/v0.4.1/Nacre-0.4.1-Linux-x86_64.tar.gz
|
||||
sha256sums = 35902a2a539a53320814e9fd4ff670c118153fd8eaa6c788ef2dcf37bdcb2cff
|
||||
|
||||
pkgname = nacre-bin
|
||||
33
packaging/arch-bin/PKGBUILD
Normal file
33
packaging/arch-bin/PKGBUILD
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
# Maintainer: astar76
|
||||
# Built by tools/package.sh from the release tar.gz (TARBALL=file://… for an offline build); it keeps pkgver,
|
||||
# sha256sums and the glibc floor current.
|
||||
pkgname=nacre-bin
|
||||
pkgver=0.4.1
|
||||
pkgrel=1
|
||||
pkgdesc='A web browser built on WebKitGTK'
|
||||
arch=('x86_64')
|
||||
url='https://archlinux.tail7c4f5e.ts.net/git/astar76/Nacre'
|
||||
license=('MPL-2.0')
|
||||
depends=('glibc>=2.43' 'gcc-libs' 'webkitgtk-6.0' 'gtk4' 'libsoup3' 'libepoxy' 'gstreamer' 'gst-plugins-base' 'gst-plugins-good' 'gst-plugins-bad' 'gst-libav' 'dbus' 'pam' 'hicolor-icon-theme' 'xdg-utils')
|
||||
optdepends=(
|
||||
'libnotify: desktop notifications'
|
||||
'xdg-desktop-portal: file pickers'
|
||||
'gnome-keyring: keeps the cookie key'
|
||||
'gst-plugin-pipewire: sound through PipeWire'
|
||||
'cava: music bars'
|
||||
)
|
||||
provides=('nacre')
|
||||
conflicts=('nacre')
|
||||
options=('!strip' '!debug')
|
||||
source=("Nacre-$pkgver-Linux-x86_64.tar.gz::${TARBALL:-$url/releases/download/v$pkgver/Nacre-$pkgver-Linux-x86_64.tar.gz}")
|
||||
sha256sums=('35902a2a539a53320814e9fd4ff670c118153fd8eaa6c788ef2dcf37bdcb2cff')
|
||||
|
||||
package() {
|
||||
cd "$srcdir/nacre-$pkgver"
|
||||
install -d "$pkgdir/usr"
|
||||
for d in bin lib share; do [ ! -d "$d" ] || cp -R "$d" "$pkgdir/usr/"; done
|
||||
if [ -d "$pkgdir/usr/share/licenses/nacre" ] && [ "$pkgname" != nacre ]; then
|
||||
mv "$pkgdir/usr/share/licenses/nacre" "$pkgdir/usr/share/licenses/$pkgname"
|
||||
fi
|
||||
install -Dm644 README.md "$pkgdir/usr/share/doc/$pkgname/README.md"
|
||||
}
|
||||
33
packaging/nix/default.nix
Normal file
33
packaging/nix/default.nix
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
# Nacre for Nix, from the release tar.gz. Written by tools/package.sh (version and hash); edit the header there.
|
||||
# nix build .#default or nix profile install . (from the repo), or callPackage this file.
|
||||
{ lib, stdenv, fetchurl, autoPatchelfHook, makeWrapper, wrapGAppsHook4, glib-networking, webkitgtk_6_0, gtk4, libsoup_3, libepoxy, pam, dbus, gst_all_1 }:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "nacre";
|
||||
version = "0.4.1";
|
||||
src = fetchurl {
|
||||
url = "https://archlinux.tail7c4f5e.ts.net/git/astar76/Nacre/releases/download/v${version}/Nacre-${version}-Linux-x86_64.tar.gz";
|
||||
hash = "sha256-NZAqKlOaUzIIFOn9T/ZwwRgVP9jqpseI7y3PN73LLP8=";
|
||||
};
|
||||
nativeBuildInputs = [ autoPatchelfHook makeWrapper wrapGAppsHook4 ];
|
||||
buildInputs = [ webkitgtk_6_0 gtk4 libsoup_3 libepoxy pam dbus glib-networking gst_all_1.gstreamer gst_all_1.gst-plugins-base gst_all_1.gst-plugins-good gst_all_1.gst-plugins-bad gst_all_1.gst-libav stdenv.cc.cc.lib ];
|
||||
# Loaded with dlopen at run time, so autoPatchelf can't see them.
|
||||
runtimeDependencies = [ ];
|
||||
dontBuild = true;
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
mkdir -p $out
|
||||
for d in bin lib share; do [ ! -d $d ] || cp -R $d $out/; done
|
||||
install -Dm644 README.md $out/share/doc/nacre/README.md
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
meta = {
|
||||
description = "A web browser built on WebKitGTK";
|
||||
homepage = "https://archlinux.tail7c4f5e.ts.net/git/astar76/Nacre";
|
||||
license = lib.licenses.mpl20;
|
||||
platforms = [ "x86_64-linux" ];
|
||||
mainProgram = "nacre";
|
||||
sourceProvenance = [ lib.sourceTypes.binaryNativeCode ];
|
||||
};
|
||||
}
|
||||
230
tools/package.sh
Executable file
230
tools/package.sh
Executable file
|
|
@ -0,0 +1,230 @@
|
|||
#!/bin/bash
|
||||
# Nacre release packages. Run: tools/package.sh (see the common part below for what it makes)
|
||||
set -euo pipefail
|
||||
root=$(cd "$(dirname "$0")/.." && pwd)
|
||||
APP=nacre NAME=Nacre DESKTOP=dev.nacre.Nacre.desktop
|
||||
URL=https://archlinux.tail7c4f5e.ts.net/git/astar76/Nacre
|
||||
ver=$(sed -n 's/^version = "\(.*\)"/\1/p' "$root/Cargo.toml" | head -n 1)
|
||||
BINS=(nacre) EXTRA_ELF=(libnacre_webext.so)
|
||||
LICENSE=MPL-2.0 NIX_LICENSE=mpl20 SUMMARY='A web browser built on WebKitGTK'
|
||||
PKGDIR=packaging/arch-bin # packaging/arch builds from this checkout (install.sh); arch-bin repackages the release
|
||||
DEB_DEPENDS='libwebkitgtk-6.0-4, libgtk-4-1, libsoup-3.0-0, libepoxy0, libpam0g, libdbus-1-3, gstreamer1.0-plugins-base, gstreamer1.0-plugins-good, gstreamer1.0-plugins-bad, gstreamer1.0-libav, xdg-utils'
|
||||
DEB_RECOMMENDS='xdg-desktop-portal, gnome-keyring, libnotify4' DEB_SECTION=web
|
||||
NIX_ARGS='wrapGAppsHook4, glib-networking, webkitgtk_6_0, gtk4, libsoup_3, libepoxy, pam, dbus, gst_all_1'
|
||||
NIX_NATIVE='wrapGAppsHook4'
|
||||
NIX_BUILD_INPUTS='webkitgtk_6_0 gtk4 libsoup_3 libepoxy pam dbus glib-networking gst_all_1.gstreamer gst_all_1.gst-plugins-base gst_all_1.gst-plugins-good gst_all_1.gst-plugins-bad gst_all_1.gst-libav stdenv.cc.cc.lib'
|
||||
WIN=0
|
||||
build() { nice cargo build --release --locked -q -j 2; }
|
||||
stage() {
|
||||
mkdir -p "$t/lib/nacre"; install -m755 "$rel/libnacre_webext.so" "$t/lib/nacre/libnacre_webext.so"
|
||||
install -Dm644 -t "$1/nacre/filters" assets/filters/*.txt
|
||||
install -Dm644 assets/dev.nacre.Nacre.desktop "$1/applications/dev.nacre.Nacre.desktop"
|
||||
icon_pngs assets/dev.nacre.Nacre.svg "$1" dev.nacre.Nacre
|
||||
install -Dm644 -t "$1/licenses/nacre" LICENSE assets/fonts/LICENSE-MaterialSymbols.txt assets/fonts/OFL-Outfit.txt
|
||||
}
|
||||
|
||||
# ---------------------------------------------------------------- common part (same in every project)
|
||||
# Builds into dist/ (and never writes to releases/):
|
||||
# $NAME-<v>-Linux-x86_64.tar.gz bin/ share/ [lib/] laid out like a prefix, with install.sh and uninstall.sh
|
||||
# $NAME-<v>-x86_64.AppImage GUI apps (DESKTOP set); BUNDLE_LIBS=1 adds the non-desktop library closure
|
||||
# $NAME-<v>-arch-x86_64.pkg.tar.zst makepkg from that tar.gz, offline ($PKGDIR/PKGBUILD gets version and checksum)
|
||||
# $NAME-<v>-amd64.deb the same tree under /usr, for apt
|
||||
# $NAME-<v>-Setup.exe and $NAME-<v>-Windows-portable.zip when WIN=1 (mingw cross build, Inno Setup in wine)
|
||||
# SHA256SUMS-<v>
|
||||
# It also writes packaging/nix/default.nix (fetches the release tar.gz; version and hash filled in here) and the
|
||||
# glibc floor read from the binary into installer.sh, the PKGBUILD and the .deb. Nothing is downloaded: appimagetool
|
||||
# and libmpv-2.dll come from ~/.local/opt/build-tools.
|
||||
# SKIP_BUILD=1 packages the existing build, NO_WIN=1 skips Windows. CARGO_TARGET_DIR is honoured.
|
||||
cd "$root"; PKGDIR=${PKGDIR:-packaging/arch}
|
||||
tools=${BUILD_TOOLS:-$HOME/.local/opt/build-tools}
|
||||
[ "${SKIP_BUILD:-}" = 1 ] || build
|
||||
tdir=${CARGO_TARGET_DIR:-$root/target}
|
||||
rel=$tdir/release
|
||||
# ZIG_GLIBC: built with cargo-zigbuild against that glibc, so the binary runs on older distributions too.
|
||||
[ -z "${ZIG_GLIBC:-}" ] || rel=$tdir/x86_64-unknown-linux-gnu/release
|
||||
out=$root/dist
|
||||
mkdir -p "${XDG_CACHE_HOME:-$HOME/.cache}"; work=$(mktemp -d "${XDG_CACHE_HOME:-$HOME/.cache}/package.XXXXXX"); trap 'rm -rf "$work"' EXIT
|
||||
export SOURCE_DATE_EPOCH=${SOURCE_DATE_EPOCH:-$(git log -1 --format=%ct 2>/dev/null || date +%s)}
|
||||
|
||||
# hicolor PNGs from an SVG: icon_pngs <svg> <share dir> <icon name>
|
||||
icon_pngs() {
|
||||
install -Dm644 "$1" "$2/icons/hicolor/scalable/apps/$3.svg"
|
||||
for n in 16 24 32 48 64 128 256 512; do
|
||||
mkdir -p "$2/icons/hicolor/${n}x$n/apps"; rsvg-convert -w "$n" -h "$n" "$1" -o "$2/icons/hicolor/${n}x$n/apps/$3.png"
|
||||
done
|
||||
}
|
||||
|
||||
# glibc floor: the newest GLIBC_x.y symbol version any shipped binary (or EXTRA_ELF library) needs.
|
||||
glibc=$(for b in "${BINS[@]}" ${EXTRA_ELF[@]+"${EXTRA_ELF[@]}"}; do objdump -T "$rel/$b"; done | grep -o 'GLIBC_[0-9.]*' | sed 's/GLIBC_//' | sort -uV | tail -n 1)
|
||||
[ -n "$glibc" ] || { echo "could not read the glibc version from the binary" >&2; exit 1; }
|
||||
sed -i "s/^app=$APP main=\([^ ]*\) need=.*/app=$APP main=\1 need=$glibc/; s/glibc [0-9.]* or newer\./glibc $glibc or newer./" installer.sh
|
||||
sed -i "s/'glibc>=[0-9.]*'/'glibc>=$glibc'/" $PKGDIR/PKGBUILD
|
||||
|
||||
# tar.gz: bin/ and share/ laid out like a prefix, so installer.sh, the PKGBUILD, the .deb and Nix just copy them.
|
||||
rm -rf "$out"; mkdir -p "$out"
|
||||
t=$work/$APP-$ver
|
||||
mkdir -p "$t/bin" "$t/share" # stage may add $t/lib too
|
||||
for b in "${BINS[@]}"; do install -m755 "$rel/$b" "$t/bin/$b"; done
|
||||
stage "$t/share"
|
||||
install -m755 installer.sh "$t/install.sh"
|
||||
printf '#!/bin/sh\n# Removes %s installed by install.sh. --purge also deletes settings and data; --system or --prefix DIR as for install.sh.\nexec sh "$(dirname "$0")/install.sh" --uninstall "$@"\n' "$NAME" > "$t/uninstall.sh"
|
||||
chmod 755 "$t/uninstall.sh"
|
||||
cp README.md "$t/"
|
||||
find "$t" -exec touch -h -d "@$SOURCE_DATE_EPOCH" {} +
|
||||
tgz=$NAME-$ver-Linux-x86_64.tar.gz
|
||||
tar -C "$work" --sort=name --owner=0 --group=0 --numeric-owner -cf - "$APP-$ver" | gzip -n -9 > "$out/$tgz"
|
||||
|
||||
# AppImage (GUI apps): the same tree under usr/, desktop file and icon at the top.
|
||||
if [ -n "${DESKTOP:-}" ]; then
|
||||
a=$work/AppDir
|
||||
mkdir -p "$a/usr"
|
||||
cp -R "$t/bin" "$t/share" "$a/usr/"; [ ! -d "$t/lib" ] || cp -R "$t/lib" "$a/usr/"
|
||||
if [ "${BUNDLE_LIBS:-0}" = 1 ]; then
|
||||
# Libraries every desktop already has (glibc, graphics, windowing, sound servers, fonts) stay with the host.
|
||||
skip='^(linux-vdso|ld-linux|libc|libm|libdl|libpthread|librt|libutil|libresolv|libnsl|libgcc_s|libstdc\+\+|libGL|libGLX|libGLdispatch|libEGL|libOpenGL|libGLESv2|libgbm|libdrm|libvulkan|libX11|libX11-xcb|libxcb.*|libXau|libXdmcp|libXext|libXfixes|libXrandr|libXrender|libXi|libXcursor|libXss|libXv|libXxf86vm|libXinerama|libwayland-.*|libxkbcommon.*|libfontconfig|libfreetype|libharfbuzz|libglib-2.0|libgobject-2.0|libgio-2.0|libgmodule-2.0|libdbus-1|libsystemd|libudev|libasound|libpulse.*|libpipewire-0.3|libjack|libsndio|libcap|libselinux|libpcre2-8|libffi|libz|libexpat|libnss.*)\.so'
|
||||
mkdir -p "$a/usr/lib"
|
||||
ldd "$rel/${BINS[0]}" | awk '/=> \//{print $3} $1 ~ /^\// {print $1}' | while read -r lib; do
|
||||
name=$(basename "$lib"); [[ $name =~ $skip ]] || cp -L "$lib" "$a/usr/lib/$name"
|
||||
done
|
||||
fi
|
||||
cp "$a/usr/share/applications/$DESKTOP" "$a/"
|
||||
icon=$(sed -n 's/^Icon=//p' "$a/$DESKTOP" | head -n 1)
|
||||
for ext in svg png; do
|
||||
f=$(find "$a/usr/share/icons" -name "$icon.$ext" | sort -V | tail -n 1)
|
||||
[ -n "$f" ] && { cp "$f" "$a/$icon.$ext"; break; }
|
||||
done
|
||||
cat > "$a/AppRun" <<RUN
|
||||
#!/bin/sh
|
||||
here=\$(dirname "\$(readlink -f "\$0")")
|
||||
[ ! -d "\$here/usr/lib" ] || [ "${BUNDLE_LIBS:-0}" != 1 ] || export LD_LIBRARY_PATH="\$here/usr/lib\${LD_LIBRARY_PATH:+:\$LD_LIBRARY_PATH}"
|
||||
exec "\$here/usr/bin/${BINS[0]}" "\$@"
|
||||
RUN
|
||||
chmod +x "$a/AppRun"
|
||||
cp "$tools/appimagetool" "$work/appimagetool"
|
||||
(cd "$work" && ./appimagetool --appimage-extract >/dev/null)
|
||||
ARCH=x86_64 "$work/squashfs-root/AppRun" --no-appstream "$a" "$out/$NAME-$ver-x86_64.AppImage" >"$work/ait.log" 2>&1 \
|
||||
|| { tail -20 "$work/ait.log"; exit 1; }
|
||||
fi
|
||||
|
||||
# Arch package from the local tar.gz; the repo's PKGBUILD gets this version and checksum.
|
||||
sum=$(sha256sum "$out/$tgz" | cut -d' ' -f1)
|
||||
sed -i "s/^pkgver=.*/pkgver=$ver/; s/^sha256sums=.*/sha256sums=('$sum')/" $PKGDIR/PKGBUILD
|
||||
mkdir "$work/arch"; cp $PKGDIR/PKGBUILD "$work/arch/"
|
||||
(cd "$work/arch" && makepkg --printsrcinfo > "$root/$PKGDIR/.SRCINFO")
|
||||
(cd "$work/arch" && TARBALL="file://$out/$tgz" makepkg -f -C --nodeps --noconfirm >"$work/makepkg.log" 2>&1) \
|
||||
|| { tail -20 "$work/makepkg.log"; exit 1; }
|
||||
cp "$work"/arch/"$APP"-bin-"$ver"-*-x86_64.pkg.tar.zst "$out/$NAME-$ver-arch-x86_64.pkg.tar.zst"
|
||||
|
||||
# .deb: the tar.gz tree under /usr (licenses go to /usr/share/doc/<pkg>/ as Debian expects).
|
||||
d=$work/deb
|
||||
mkdir -p "$d/root/usr" "$d/root/usr/share/doc/$APP" "$d/control"
|
||||
for x in bin lib share; do [ ! -d "$t/$x" ] || cp -R "$t/$x" "$d/root/usr/"; done
|
||||
if [ -d "$d/root/usr/share/licenses/$APP" ]; then
|
||||
cp -R "$d/root/usr/share/licenses/$APP/." "$d/root/usr/share/doc/$APP/"; rm -rf "$d/root/usr/share/licenses"
|
||||
fi
|
||||
cp README.md "$d/root/usr/share/doc/$APP/"
|
||||
{ echo "Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/"; echo "Upstream-Name: $NAME"
|
||||
echo "Source: $URL"; echo; echo "Files: *"; echo "License: $LICENSE"; } > "$d/root/usr/share/doc/$APP/copyright"
|
||||
size=$(du -sk "$d/root" | cut -f1)
|
||||
cat > "$d/control/control" <<CTL
|
||||
Package: $APP
|
||||
Version: $ver
|
||||
Architecture: amd64
|
||||
Maintainer: astar76 <[email protected]>
|
||||
Installed-Size: $size
|
||||
Depends: libc6 (>= $glibc)${DEB_DEPENDS:+, $DEB_DEPENDS}
|
||||
${DEB_RECOMMENDS:+Recommends: $DEB_RECOMMENDS
|
||||
}Section: ${DEB_SECTION:-misc}
|
||||
Priority: optional
|
||||
Homepage: $URL
|
||||
Description: $SUMMARY
|
||||
Built from $URL (version $ver). Needs glibc $glibc or newer.
|
||||
CTL
|
||||
(cd "$d/root" && find . -type f -printf '%P\n' | sort | xargs -d '\n' md5sum) > "$d/control/md5sums"
|
||||
find "$d/root" "$d/control" -exec touch -h -d "@$SOURCE_DATE_EPOCH" {} +
|
||||
echo 2.0 > "$d/debian-binary"
|
||||
tar -C "$d/control" --sort=name --owner=0 --group=0 --numeric-owner -czf "$d/control.tar.gz" .
|
||||
tar -C "$d/root" --sort=name --owner=0 --group=0 --numeric-owner -cJf "$d/data.tar.xz" .
|
||||
deb=$out/$NAME-$ver-amd64.deb
|
||||
(cd "$d" && ar rcD "$deb" debian-binary control.tar.gz data.tar.xz)
|
||||
! command -v dpkg-deb >/dev/null || dpkg-deb --info "$deb" >/dev/null
|
||||
|
||||
# Nix: packaging/nix/default.nix fetches this release's tar.gz (flake.nix at the top calls it).
|
||||
mkdir -p packaging/nix
|
||||
sri=sha256-$(openssl dgst -sha256 -binary "$out/$tgz" | base64 -w0)
|
||||
cat > packaging/nix/default.nix <<NIX
|
||||
# $NAME for Nix, from the release tar.gz. Written by tools/package.sh (version and hash); edit the header there.
|
||||
# nix build .#default or nix profile install . (from the repo), or callPackage this file.
|
||||
{ lib, stdenv, fetchurl, autoPatchelfHook, makeWrapper${NIX_ARGS:+, $NIX_ARGS} }:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "$APP";
|
||||
version = "$ver";
|
||||
src = fetchurl {
|
||||
url = "$URL/releases/download/v\${version}/$NAME-\${version}-Linux-x86_64.tar.gz";
|
||||
hash = "$sri";
|
||||
};
|
||||
nativeBuildInputs = [ autoPatchelfHook makeWrapper${NIX_NATIVE:+ $NIX_NATIVE} ];
|
||||
buildInputs = [ ${NIX_BUILD_INPUTS:-} ];
|
||||
# Loaded with dlopen at run time, so autoPatchelf can't see them.
|
||||
runtimeDependencies = [ ${NIX_RUNTIME:-} ];
|
||||
dontBuild = true;
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
mkdir -p \$out
|
||||
for d in bin lib share; do [ ! -d \$d ] || cp -R \$d \$out/; done
|
||||
install -Dm644 README.md \$out/share/doc/$APP/README.md
|
||||
runHook postInstall
|
||||
'';
|
||||
${NIX_EXTRA:-}
|
||||
meta = {
|
||||
description = "$SUMMARY";
|
||||
homepage = "$URL";
|
||||
license = lib.licenses.$NIX_LICENSE;
|
||||
platforms = [ "x86_64-linux" ];
|
||||
mainProgram = "${BINS[0]}";
|
||||
sourceProvenance = [ lib.sourceTypes.binaryNativeCode ];
|
||||
};
|
||||
}
|
||||
NIX
|
||||
[ -f flake.nix ] || cat > flake.nix <<FLK
|
||||
{
|
||||
description = "$SUMMARY";
|
||||
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
outputs = { self, nixpkgs }:
|
||||
let pkgs = nixpkgs.legacyPackages.x86_64-linux;
|
||||
in {
|
||||
packages.x86_64-linux.default = pkgs.callPackage ./packaging/nix { };
|
||||
apps.x86_64-linux.default = { type = "app"; program = "\${self.packages.x86_64-linux.default}/bin/${BINS[0]}"; };
|
||||
};
|
||||
}
|
||||
FLK
|
||||
|
||||
# Windows: mingw cross build, a one-folder app zipped as the portable build, and a per-user Inno Setup installer.
|
||||
if [ "${WIN:-0}" = 1 ] && [ "${NO_WIN:-}" != 1 ]; then
|
||||
command -v x86_64-w64-mingw32-gcc >/dev/null || { echo "Windows needs mingw-w64-gcc (sudo pacman -S mingw-w64-gcc), or NO_WIN=1." >&2; exit 1; }
|
||||
if [ -n "${WIN_DLLS[*]:-}" ] && [ "${WIN_MPV:-0}" = 1 ]; then
|
||||
# import library for libmpv-2.dll, so the cross linker can link "mpv"
|
||||
lib=$tools/winlib; mkdir -p "$lib"
|
||||
if [ ! -f "$lib/libmpv.dll.a" ]; then
|
||||
{ echo "LIBRARY libmpv-2.dll"; echo EXPORTS
|
||||
x86_64-w64-mingw32-objdump -p "$tools/libmpv-2.dll" | sed -n '/\[Ordinal\/Name Pointer\] Table/,/^$/p' | awk '/^\s*\[ *[0-9]+\] \+base/ {print $NF}'; } > "$lib/mpv.def"
|
||||
x86_64-w64-mingw32-dlltool -d "$lib/mpv.def" -D libmpv-2.dll -l "$lib/libmpv.dll.a"
|
||||
fi
|
||||
export RUSTFLAGS="${RUSTFLAGS:-} -L $lib"
|
||||
fi
|
||||
[ "${SKIP_BUILD:-}" = 1 ] || nice cargo build --release --locked -q -j 2 --target x86_64-pc-windows-gnu
|
||||
w=$work/win/$NAME; mkdir -p "$w"
|
||||
for b in "${BINS[@]}"; do install -m755 "$tdir/x86_64-pc-windows-gnu/release/$b.exe" "$w/"; done
|
||||
for f in ${WIN_DLLS[@]+"${WIN_DLLS[@]}"}; do install -m644 "$tools/$f" "$w/"; done
|
||||
install -m644 LICENSE "$w/LICENSE.txt"
|
||||
find "$work/win" -exec touch -h -d "@$SOURCE_DATE_EPOCH" {} +
|
||||
(cd "$work/win" && zip -qrX9 "$out/$NAME-$ver-Windows-portable.zip" "$NAME")
|
||||
iscc="$HOME/.wine/drive_c/users/$USER/AppData/Local/Programs/Inno Setup 7/ISCC.exe"
|
||||
WINEDEBUG=-all wine "$iscc" /Q "/DVersion=$ver" "/DSrc=Z:$w" "/DOut=Z:$out" "Z:$root/packaging/$APP.iss" >"$work/iscc.log" 2>&1 \
|
||||
|| { tail -20 "$work/iscc.log"; exit 1; }
|
||||
fi
|
||||
|
||||
(cd "$out" && sha256sum "$NAME-$ver"-* > "SHA256SUMS-$ver")
|
||||
echo "glibc floor: $glibc"
|
||||
ls -l "$out"
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "nacre-webext"
|
||||
version = "0.4.0"
|
||||
version = "0.4.1"
|
||||
edition = "2024"
|
||||
rust-version = "1.88"
|
||||
description = "Nacre's WebKit web process extension: request headers, ad blocker stand-ins, blocked counts (D-036)"
|
||||
|
|
|
|||
Loading…
Reference in a new issue