Fix android build (#657)

* Fix android build

Ref: https://github.com/khvzak/mlua/issues/267#issuecomment-1644559018

* Update docs

* Fix typos by cheating a bit

* Instruction first
pull/658/head
Arijit Basu 10 months ago committed by GitHub
parent 1b2226512f
commit 9a7ff5846d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -8,7 +8,7 @@ rustflags = ["-C", "link-args=-rdynamic"]
rustflags = ["-C", "linker=aarch64-linux-gnu-gcc", "-C", "link-args=-rdynamic"] rustflags = ["-C", "linker=aarch64-linux-gnu-gcc", "-C", "link-args=-rdynamic"]
[target.aarch64-linux-android] [target.aarch64-linux-android]
rustflags = ["-C", "linker=aarch64-linux-android-clang", "-C", "link-args=-rdynamic"] rustflags = ["-C", "linker=aarch64-linux-android-clang", "-C", "link-args=-rdynamic", "-C", "default-linker-libraries"]
[target.arm-unknown-linux-gnueabihf] [target.arm-unknown-linux-gnueabihf]
rustflags = ["-C", "linker=arm-linux-gnueabihf-gcc", "-C", "link-args=-rdynamic"] rustflags = ["-C", "linker=arm-linux-gnueabihf-gcc", "-C", "link-args=-rdynamic"]

@ -587,12 +587,16 @@ Type: nullable list of [Node Sorter](https://xplr.dev/en/sorting#node-sorter-app
#### xplr.config.general.initial_mode #### xplr.config.general.initial_mode
The name of one of the modes to use when xplr loads. The name of one of the modes to use when xplr loads.
This isn't the default mode. To modify the default mode, overwrite
[xplr.config.modes.builtin.default](https://xplr.dev/en/modes#xplrconfigmodesbuiltindefault).
Type: nullable string Type: nullable string
#### xplr.config.general.initial_layout #### xplr.config.general.initial_layout
The name of one of the layouts to use when xplr loads. The name of one of the layouts to use when xplr loads.
This isn't the default layout. To modify the default layout, overwrite
[xplr.config.layouts.builtin.default](https://xplr.dev/en/layouts#xplrconfiglayoutsbuiltindefault).
Type: nullable string Type: nullable string

@ -196,6 +196,23 @@ cargo build --locked --release --bin xplr
sudo cp target/release/xplr /usr/local/bin/ sudo cp target/release/xplr /usr/local/bin/
``` ```
## Android
### [Termux][24]
```bash
pkg install rust make binutils
cargo install --locked xplr
# Run
~/.cargo/bin/xplr
```
> Please note that xplr isn't heavily tested on Termux, hence things might need
> a little tweaking and fixing for a smooth user experience.
![termux demo][23]
[1]: #direct-download [1]: #direct-download
[2]: #from-cratesio [2]: #from-cratesio
[3]: #build-from-source [3]: #build-from-source
@ -218,6 +235,8 @@ sudo cp target/release/xplr /usr/local/bin/
[20]: https://gcc.gnu.org/ [20]: https://gcc.gnu.org/
[21]: https://www.gnu.org/software/make/ [21]: https://www.gnu.org/software/make/
[22]: https://git-scm.com/ [22]: https://git-scm.com/
[23]: https://github.com/sayanarijit/xplr/assets/11632726/3b61e8c8-76f0-48e8-8734-50e9e7e495b7
[24]: https://termux.dev/
[25]: https://gifyu.com/image/tF2D [25]: https://gifyu.com/image/tF2D
[26]: https://github.com/sayanarijit/xplr/releases/latest/download/xplr-linux-musl.tar.gz [26]: https://github.com/sayanarijit/xplr/releases/latest/download/xplr-linux-musl.tar.gz
[27]: https://pkgs.alpinelinux.org/packages?name=xplr [27]: https://pkgs.alpinelinux.org/packages?name=xplr

@ -2,15 +2,13 @@
#### Example: Defining Custom Layout #### Example: Defining Custom Layout
[![layout.png][23]][24]
```lua ```lua
xplr.config.layouts.builtin.default = { xplr.config.layouts.builtin.default = {
Horizontal = { Horizontal = {
config = { config = {
margin = 1, margin = 1,
horizontal_margin = 2, horizontal_margin = 1,
vertical_margin = 3, vertical_margin = 1,
constraints = { constraints = {
{ Percentage = 50 }, { Percentage = 50 },
{ Percentage = 50 }, { Percentage = 50 },
@ -24,6 +22,21 @@ xplr.config.layouts.builtin.default = {
} }
``` ```
Result:
```
╭ /home ─────────────╮╭ Help [default] ────╮
│ ╭─── path ││. show hidden │
│ ├▸[ð Desktop/] ││/ search │
│ ├ ð Documents/ ││: action │
│ ├ ð Downloads/ ││? global help │
│ ├ ð GitHub/ ││G go to bottom │
│ ├ ð Music/ ││V select/unselect│
│ ├ ð Pictures/ ││ctrl duplicate as │
│ ├ ð Public/ ││ctrl next visit │
╰────────────────────╯╰────────────────────╯
```
A layout is a [sum type][56] can be one of the following: A layout is a [sum type][56] can be one of the following:
- [Nothing][8] - [Nothing][8]
@ -86,7 +99,7 @@ Type: { Static = [Custom Panel][27] }
This is a custom layout to render dynamic content using a function defined in This is a custom layout to render dynamic content using a function defined in
[xplr.fn][28] that takes [Content Renderer Argument][36] and returns [Custom Panel][27]. [xplr.fn][28] that takes [Content Renderer Argument][36] and returns [Custom Panel][27].
Type: { Dynamic = [Content Renderer][35] } Type: { Dynamic = "[Content Renderer][35]" }
### Horizontal ### Horizontal
@ -97,7 +110,7 @@ It contains the following information:
- [config][15] - [config][15]
- [splits][17] - [splits][17]
Type: { Horizontal = { config = [config][15], splits = [splits][17] } Type: { Vertical = { config = [Layout Config][15], splits = { [Layout][17], ... } }
### Vertical ### Vertical
@ -108,7 +121,7 @@ It contains the following information:
- [config][15] - [config][15]
- [splits][17] - [splits][17]
Type: { Vertical = { config = [config][15], splits = [splits][17] } Type: { Vertical = { config = [Layout Config][15], splits = { [Layout][17], ... } }
## Layout Config ## Layout Config
@ -200,6 +213,16 @@ xplr.config.layouts.builtin.default = {
} }
``` ```
Result:
```
╭ custom title ────────╮
│custom body │
│ │
│ │
╰──────────────────────╯
```
#### Example: Render a custom dynamic paragraph #### Example: Render a custom dynamic paragraph
```lua ```lua
@ -215,6 +238,23 @@ xplr.fn.custom.render_layout = function(ctx)
end end
``` ```
Result:
```
╭/home/sayanarijit───────────────────────────╮
│mime_essence: inode/directory │
│relative_path: Desktop │
│is_symlink: false │
│is_readonly: false │
│parent: /home/sayanarijit │
│absolute_path: /home/sayanarijit/Desktop │
│is_broken: false │
│created: 1668087850396758714 │
│size: 4096 │
│gid: 100 │
╰────────────────────────────────────────────╯
```
### CustomList ### CustomList
A list to render. It contains the following fields: A list to render. It contains the following fields:
@ -235,6 +275,17 @@ xplr.config.layouts.builtin.default = {
} }
``` ```
Result:
```
╭ custom title ─────────────╮
│1 │
│2 │
│3 │
│ │
╰───────────────────────────╯
```
#### Example: Render a custom dynamic list #### Example: Render a custom dynamic list
```lua ```lua
@ -254,6 +305,18 @@ xplr.fn.custom.render_layout = function(ctx)
end end
``` ```
Result:
```
╭/home/sayanarijit──────────╮
│Desktop │
│0.21.2 │
│17336 │
│ │
│ │
╰───────────────────────────╯
```
## CustomTable ## CustomTable
A custom table to render. It contains the following fields: A custom table to render. It contains the following fields:
@ -283,6 +346,18 @@ xplr.config.layouts.builtin.default = {
} }
``` ```
Result:
```
╭ custom title ────────────────────╮
│a b │
│c d │
│ │
│ │
│ │
╰──────────────────────────────────╯
```
#### Example: Render a custom dynamic table #### Example: Render a custom dynamic table
```lua ```lua
@ -309,6 +384,23 @@ xplr.fn.custom.render_layout = function(ctx)
end end
``` ```
Result:
```
╭/home/sayanarijit───────────────────────────╮
│ │
│Layout height 12 │
│Layout width 46 │
│ │
│Screen height 12 │
│Screen width 46 │
│ │
│ │
│ │
│ │
╰────────────────────────────────────────────╯
```
### CustomLayout ### CustomLayout
A whole custom layout to render. It doesn't make sense to use it as a A whole custom layout to render. It doesn't make sense to use it as a
@ -347,6 +439,40 @@ xplr.fn.custom.render_layout = function(ctx)
end end
``` ```
Result:
```
╭─────────────────────╮╭─────────────────────╮
│Try your luck... ││Press ctrl-r │
│ ││ │
│ ││ │
│ ││ │
│ ││ │
│ ││ │
│ ││ │
│ ││ │
│ ││ │
│ ││ │
╰─────────────────────╯╰─────────────────────╯
```
Or
```
╭────────────────────────────────────────────╮
│Try your luck... │
│ │
│ │
│ │
╰────────────────────────────────────────────╯
╭────────────────────────────────────────────╮
│Press ctrl-r │
│ │
│ │
│ │
╰────────────────────────────────────────────╯
```
## Panel UI Config ## Panel UI Config
It contains the following optional fields: It contains the following optional fields:
@ -429,8 +555,6 @@ Hence, only the following fields are available.
[20]: #vertical_margin [20]: #vertical_margin
[21]: #constraints [21]: #constraints
[22]: #constraint [22]: #constraint
[23]: https://s6.gifyu.com/images/layout.png
[24]: https://gifyu.com/image/1X38
[25]: #static [25]: #static
[26]: #dynamic [26]: #dynamic
[27]: #custom-panel [27]: #custom-panel

@ -12,15 +12,13 @@ You can add new panels in `xplr.config.layouts.custom`.
##### Example: Defining Custom Layout ##### Example: Defining Custom Layout
![demo](https://s6.gifyu.com/images/layout.png)
```lua ```lua
xplr.config.layouts.builtin.default = { xplr.config.layouts.builtin.default = {
Horizontal = { Horizontal = {
config = { config = {
margin = 1, margin = 1,
horizontal_margin = 2, horizontal_margin = 1,
vertical_margin = 3, vertical_margin = 1,
constraints = { constraints = {
{ Percentage = 50 }, { Percentage = 50 },
{ Percentage = 50 }, { Percentage = 50 },
@ -34,6 +32,21 @@ xplr.config.layouts.builtin.default = {
} }
``` ```
Result:
```
╭ /home ─────────────╮╭ Help [default] ────╮
│ ╭─── path ││. show hidden │
│ ├▸[ð Desktop/] ││/ search │
│ ├ ð Documents/ ││: action │
│ ├ ð Downloads/ ││? global help │
│ ├ ð GitHub/ ││G go to bottom │
│ ├ ð Music/ ││V select/unselect│
│ ├ ð Pictures/ ││ctrl duplicate as │
│ ├ ð Public/ ││ctrl next visit │
╰────────────────────╯╰────────────────────╯
```
#### xplr.config.layouts.builtin.default #### xplr.config.layouts.builtin.default
The default layout The default layout

@ -29,23 +29,23 @@ them, but only a few modern programming languages allow nesting other types
into a sum type. into a sum type.
```rust ```rust
enum Result { enum Color {
Ok, Red,
Err, Green,
} }
``` ```
Here, `Result` can be one of two possible set of values: `Ok` and `Err`, just Here, `Color` can be one of two possible set of values: `Red` and `Green`, just
like `boolean`, but unlike `boolean`, being tagged allows `Result` to have more like `boolean`, but unlike `boolean`, being tagged allows `Color` to have more
than two variants if required, by changing the definition. than two variants if required, by changing the definition.
e.g. e.g.
```rust ```rust
enum Result { enum Color {
Ok, Red,
Err, Green,
Pending, Blue,
} }
``` ```
@ -53,35 +53,39 @@ We'd document it here as:
> Result is a sum type that can be one of the following: > Result is a sum type that can be one of the following:
> >
> - "Ok" > - "Red"
> - "Err" > - "Green"
> - "Pending" > - "Blue"
But some languages (like Rust, Haskell, Elm etc.) go even further, allowing us But some languages (like Rust, Haskell, Elm etc.) go even further, allowing us
to associate each branch of the enum with further nested types like: to associate each branch of the enum with further nested types like:
```rust ```rust
enum Result { enum Layout {
Ok(bool), Table,
Err(Error), HelpMenu,
Pending, Horizontal {
config: LayoutConfig, // A product type (similar to class/struct)
splits: Vec<Layout> // A list of "Layout"s (i.e. list of sum types)
},
} }
``` ```
Here, as we can see, unlike the first example, some of `Result`'s possible Here, as we can see, unlike the first example, some of `Layout`'s possible
variants can have further nested types associated with them. Note that `Error` variants can have further nested types associated with them. Note that
here can be either a sum type (e.g. enum), or a product type (e.g. `Horizontal` here can have a sum type (e.g. enum), or a product type (e.g.
class/struct), but whatever it is, it will only exist when `Result` is `Err`. class/struct), or both (any number of them actually) nested in it. But the
nested values will only exist when `Layout` is `Horizontal`.
We'd document it here as: We'd document it here as:
> Result is a sum type that can be one of the following: > Layout is a sum type that can be one of the following:
> >
> - { Ok = bool } > - "Table"
> - { Err = Error } > - "HelpMenu"
> - "Pending" > - { Horizontal = { config = Layout Config, splits = { Layout, ... } }
And then we'd go on documenting whatever `Error` is. And then we'd go on documenting whatever `Layout Config` is.
So, there you go. This is exactly what sum types are - glorified enums that can So, there you go. This is exactly what sum types are - glorified enums that can
have nested types in each branch. have nested types in each branch.

@ -680,11 +680,15 @@ xplr.config.general.initial_sorting = {
} }
-- The name of one of the modes to use when xplr loads. -- The name of one of the modes to use when xplr loads.
-- This isn't the default mode. To modify the default mode, overwrite
-- [xplr.config.modes.builtin.default](https://xplr.dev/en/modes#xplrconfigmodesbuiltindefault).
-- --
-- Type: nullable string -- Type: nullable string
xplr.config.general.initial_mode = "default" xplr.config.general.initial_mode = "default"
-- The name of one of the layouts to use when xplr loads. -- The name of one of the layouts to use when xplr loads.
-- This isn't the default layout. To modify the default layout, overwrite
-- [xplr.config.layouts.builtin.default](https://xplr.dev/en/layouts#xplrconfiglayoutsbuiltindefault).
-- --
-- Type: nullable string -- Type: nullable string
xplr.config.general.initial_layout = "default" xplr.config.general.initial_layout = "default"
@ -852,15 +856,13 @@ xplr.config.node_types.special = {}
-- --
-- ##### Example: Defining Custom Layout -- ##### Example: Defining Custom Layout
-- --
-- ![demo](https://s6.gifyu.com/images/layout.png)
--
-- ```lua -- ```lua
-- xplr.config.layouts.builtin.default = { -- xplr.config.layouts.builtin.default = {
-- Horizontal = { -- Horizontal = {
-- config = { -- config = {
-- margin = 1, -- margin = 1,
-- horizontal_margin = 2, -- horizontal_margin = 1,
-- vertical_margin = 3, -- vertical_margin = 1,
-- constraints = { -- constraints = {
-- { Percentage = 50 }, -- { Percentage = 50 },
-- { Percentage = 50 }, -- { Percentage = 50 },
@ -873,6 +875,21 @@ xplr.config.node_types.special = {}
-- } -- }
-- } -- }
-- ``` -- ```
--
-- Result:
--
-- ```
-- ╭ /home ─────────────╮╭ Help [default] ────╮
-- │ ╭─── path ││. show hidden │
-- │ ├▸[ð Desktop/] ││/ search │
-- │ ├ ð Documents/ ││: action │
-- │ ├ ð Downloads/ ││? global help │
-- │ ├ ð GitHub/ ││G go to bottom │
-- │ ├ ð Music/ ││V select/unselect│
-- │ ├ ð Pictures/ ││ctrl duplicate as │
-- │ ├ ð Public/ ││ctrl next visit │
-- ╰────────────────────╯╰────────────────────╯
-- ```
-- The default layout -- The default layout
-- --
@ -3077,6 +3094,14 @@ xplr.fn.custom = {}
-- { LogSuccess = "Switched layout" }, -- { LogSuccess = "Switched layout" },
-- { CallLuaSilently = "custom.some_plugin_with_hooks.on_layout_switch" }, -- { CallLuaSilently = "custom.some_plugin_with_hooks.on_layout_switch" },
-- } -- }
--
-- -- Add messages to send when the selection changes
-- --
-- -- Type: list of [Message](https://xplr.dev/en/message#message)s
-- on_selection_change = {
-- { LogSuccess = "Selection changed" },
-- { CallLuaSilently = "custom.some_plugin_with_hooks.on_selection_change" },
-- }
-- } -- }
-- ``` -- ```

Loading…
Cancel
Save