README: Remove arm64 limitation and add lib loading
- commit
- 52f4db2603024bb67b4ca7d350ca0f5390e7978d
- author
- Jeroen Wijenbergh · · 2023-09-28 15:01 UTC
- committer
- GitHub · · 2023-09-28 15:01 UTC
- parent
- 982a22b
- signature
- GPG Unverified
4AEE18F83AFDEB23The key is unknown
1 file · +17 -4
M README.md +17 -4
| @@ -21,14 +21,13 @@ No Cgo needed, thus: | |||
| 21 | 21 | ||
| 22 | 22 | Limitations of this library as compared to the alternatives using cgo: | |
| 23 | 23 | * Some APIs are not possible due to purego not currently supporting struct arguments (that are not pointers) | |
| 24 | - | * Currently only support for AMD64+Linux, for ARM I need to figure out how to get callbacks working in purego and contribute to purego | |
| 25 | 24 | ||
| 26 | 25 | # Planned features | |
| 27 | 26 | In order of priority: | |
| 28 | 27 | * General code cleanup | |
| 29 | - | * ARM support | |
| 30 | 28 | * Support for OS other than Linux (I only test on Linux currently) | |
| 31 | 29 | * GTK 3 support | |
| 30 | + | * Architectures other than AMD64/ARM64 | |
| 32 | 31 | ||
| 33 | 32 | # Basic example | |
| 34 | 33 | ||
| @@ -66,10 +65,24 @@ func activate(app *gtk.Application) { | |||
| 66 | 65 | Save this to a main.go and then build & run with | |
| 67 | 66 | ||
| 68 | 67 | ```bash | |
| 69 | - | CGO_ENABLED=0 go run main.go | |
| 68 | + | go run main.go | |
| 70 | 69 | ``` | |
| 71 | 70 | ||
| 72 | - | > **_NOTE:_** Passing CGO_ENABLED=0 is currently required | |
| 71 | + | > **_NOTE:_** You can also use `CGO_ENABLED=0` to build without cgo! | |
| 72 | + | ||
| 73 | + | # Library loading | |
| 74 | + | Because the GTK libs are loading at runtime (in `init`), we have to know where your libs are located. | |
| 75 | + | The default configuration is a "just works" configuration, we hardcode some paths that are common. | |
| 76 | + | ||
| 77 | + | However, for systems such as NixOS or distros that use other paths the following environment variables might help: | |
| 78 | + | ||
| 79 | + | - `PUREGOTK_LIB_FOLRER`, set this to the root folder where all libs are stored e.g. `/some/path/` | |
| 80 | + | - `PUREGOTK_LIBNAME_PATH`, e.g. `PUREGOTK_GTK_PATH` for the file path to GTK e.g. `/some/path/libgtk-4.so`. You have to do this for all deps, e.g. cairo, pango, etc | |
| 81 | + | ||
| 82 | + | See https://github.com/jwijenbergh/puregotk/blob/main/internal/core/core.go for exact implementation details. | |
| 83 | + | ||
| 84 | + | Additionally we also have a fallback to `pkg-config`, but I would say only rely on this as a last effort due to the increased startup time. | |
| 85 | + | When packaging code, always make sure that correct paths are used by e.g. using the aforementioned environment variables. | |
| 73 | 86 | ||
| 74 | 87 | # Generating the library | |
| 75 | 88 | This library is automatically generated by reading GIR files. | |
| @@ -21,14 +21,13 @@ No Cgo needed, thus: | |||||
| 21 | 21 | ||||
| 22 | Limitations of this library as compared to the alternatives using cgo: | 22 | Limitations of this library as compared to the alternatives using cgo: | ||
| 23 | * Some APIs are not possible due to purego not currently supporting struct arguments (that are not pointers) | 23 | * Some APIs are not possible due to purego not currently supporting struct arguments (that are not pointers) | ||
| 24 | - | * Currently only support for AMD64+Linux, for ARM I need to figure out how to get callbacks working in purego and contribute to purego | |||
| 25 | 24 | ||||
| 26 | # Planned features | 25 | # Planned features | ||
| 27 | In order of priority: | 26 | In order of priority: | ||
| 28 | * General code cleanup | 27 | * General code cleanup | ||
| 29 | - | * ARM support | |||
| 30 | * Support for OS other than Linux (I only test on Linux currently) | 28 | * Support for OS other than Linux (I only test on Linux currently) | ||
| 31 | * GTK 3 support | 29 | * GTK 3 support | ||
| 30 | + | * Architectures other than AMD64/ARM64 | |||
| 32 | 31 | ||||
| 33 | # Basic example | 32 | # Basic example | ||
| 34 | 33 | ||||
| @@ -66,10 +65,24 @@ func activate(app *gtk.Application) { | |||||
| 66 | Save this to a main.go and then build & run with | 65 | Save this to a main.go and then build & run with | ||
| 67 | 66 | ||||
| 68 | ```bash | 67 | ```bash | ||
| 69 | - | CGO_ENABLED=0 go run main.go | 68 | + | go run main.go |
| 70 | ``` | 69 | ``` | ||
| 71 | 70 | ||||
| 72 | - | > **_NOTE:_** Passing CGO_ENABLED=0 is currently required | 71 | + | > **_NOTE:_** You can also use `CGO_ENABLED=0` to build without cgo! |
| 72 | + | ||||
| 73 | + | # Library loading | |||
| 74 | + | Because the GTK libs are loading at runtime (in `init`), we have to know where your libs are located. | |||
| 75 | + | The default configuration is a "just works" configuration, we hardcode some paths that are common. | |||
| 76 | + | ||||
| 77 | + | However, for systems such as NixOS or distros that use other paths the following environment variables might help: | |||
| 78 | + | ||||
| 79 | + | - `PUREGOTK_LIB_FOLRER`, set this to the root folder where all libs are stored e.g. `/some/path/` | |||
| 80 | + | - `PUREGOTK_LIBNAME_PATH`, e.g. `PUREGOTK_GTK_PATH` for the file path to GTK e.g. `/some/path/libgtk-4.so`. You have to do this for all deps, e.g. cairo, pango, etc | |||
| 81 | + | ||||
| 82 | + | See https://github.com/jwijenbergh/puregotk/blob/main/internal/core/core.go for exact implementation details. | |||
| 83 | + | ||||
| 84 | + | Additionally we also have a fallback to `pkg-config`, but I would say only rely on this as a last effort due to the increased startup time. | |||
| 85 | + | When packaging code, always make sure that correct paths are used by e.g. using the aforementioned environment variables. | |||
| 73 | 86 | ||||
| 74 | # Generating the library | 87 | # Generating the library | ||
| 75 | This library is automatically generated by reading GIR files. | 88 | This library is automatically generated by reading GIR files. | ||