mirror of
https://github.com/logos-messaging/logos-delivery.git
synced 2026-02-28 06:03:39 +00:00
Adjust nix build to new naming
This commit is contained in:
parent
5904538256
commit
124f332284
2
Makefile
2
Makefile
@ -433,7 +433,7 @@ docker-liteprotocoltester-push:
|
||||
################
|
||||
## C Bindings ##
|
||||
################
|
||||
.PHONY: cbindings cwaku_example libwaku liblmapi liblogosdelivery liblogosdelivery_example
|
||||
.PHONY: cbindings cwaku_example libwaku liblogosdelivery liblogosdelivery_example
|
||||
|
||||
STATIC ?= 0
|
||||
LIBWAKU_BUILD_COMMAND ?= libwakuDynamic
|
||||
|
||||
@ -71,10 +71,10 @@
|
||||
zerokitRln = zerokit.packages.${system}.rln;
|
||||
};
|
||||
|
||||
liblmapi = pkgs.callPackage ./nix/default.nix {
|
||||
liblogosdelivery = pkgs.callPackage ./nix/default.nix {
|
||||
inherit stableSystems;
|
||||
src = self;
|
||||
targets = ["liblmapi"];
|
||||
targets = ["liblogosdelivery"];
|
||||
zerokitRln = zerokit.packages.${system}.rln;
|
||||
};
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
# Building liblmapi and Examples
|
||||
# Building liblogosdelivery and Examples
|
||||
|
||||
## Prerequisites
|
||||
|
||||
@ -12,22 +12,22 @@
|
||||
### Dynamic Library
|
||||
|
||||
```bash
|
||||
make liblmapi
|
||||
make liblogosdelivery
|
||||
```
|
||||
|
||||
This creates `build/liblmapi.dylib` (macOS) or `build/liblmapi.so` (Linux).
|
||||
This creates `build/liblogosdelivery.dylib` (macOS) or `build/liblogosdelivery.so` (Linux).
|
||||
|
||||
### Static Library
|
||||
|
||||
```bash
|
||||
nim liblmapiStatic
|
||||
nim liblogosdelivery STATIC=1
|
||||
```
|
||||
|
||||
This creates `build/liblmapi.a`.
|
||||
This creates `build/liblogosdelivery.a`.
|
||||
|
||||
## Building Examples
|
||||
|
||||
### liblmapi Example
|
||||
### liblogosdelivery Example
|
||||
|
||||
Compile the C example that demonstrates all library features:
|
||||
|
||||
@ -37,16 +37,16 @@ make liblogosdelivery_example
|
||||
|
||||
# Or manually on macOS:
|
||||
gcc -o build/liblogosdelivery_example \
|
||||
liblmapi/examples/liblogosdelivery_example.c \
|
||||
-I./liblmapi \
|
||||
liblogosdelivery/examples/liblogosdelivery_example.c \
|
||||
-I./liblogosdelivery \
|
||||
-L./build \
|
||||
-llmapi \
|
||||
-Wl,-rpath,./build
|
||||
|
||||
# Or manually on Linux:
|
||||
gcc -o build/liblogosdelivery_example \
|
||||
liblmapi/examples/liblogosdelivery_example.c \
|
||||
-I./liblmapi \
|
||||
liblogosdelivery/examples/liblogosdelivery_example.c \
|
||||
-I./liblogosdelivery \
|
||||
-L./build \
|
||||
-llmapi \
|
||||
-Wl,-rpath='$ORIGIN'
|
||||
@ -73,15 +73,15 @@ After building, you'll have:
|
||||
|
||||
```
|
||||
build/
|
||||
├── liblmapi.dylib # Dynamic library (34MB)
|
||||
├── liblmapi.dylib.dSYM/ # Debug symbols
|
||||
├── liblogosdelivery.dylib # Dynamic library (34MB)
|
||||
├── liblogosdelivery.dylib.dSYM/ # Debug symbols
|
||||
└── liblogosdelivery_example # Compiled example (34KB)
|
||||
```
|
||||
|
||||
## Library Headers
|
||||
|
||||
The main header file is:
|
||||
- `liblmapi/liblmapi.h` - C API declarations
|
||||
- `liblogosdelivery/liblogosdelivery.h` - C API declarations
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
@ -115,10 +115,10 @@ This updates all git submodules which are required for building.
|
||||
To link statically instead of dynamically:
|
||||
|
||||
```bash
|
||||
gcc -o build/simple_example \
|
||||
liblmapi/examples/simple_example.c \
|
||||
-I./liblmapi \
|
||||
build/liblmapi.a \
|
||||
gcc -o build/logosdelivery_example \
|
||||
liblogosdelivery/examples/logosdelivery_example.c \
|
||||
-I./liblogosdelivery \
|
||||
build/liblogosdelivery.a \
|
||||
-lm -lpthread
|
||||
```
|
||||
|
||||
@ -129,7 +129,7 @@ Note: Static library is much larger (~129MB) but creates a standalone executable
|
||||
For cross-compilation, you need to:
|
||||
1. Build the Nim library for the target platform
|
||||
2. Use the appropriate cross-compiler
|
||||
3. Link against the target platform's liblmapi
|
||||
3. Link against the target platform's liblogosdelivery
|
||||
|
||||
Example for Linux from macOS:
|
||||
```bash
|
||||
@ -143,14 +143,14 @@ Example for Linux from macOS:
|
||||
|
||||
```cmake
|
||||
find_library(LMAPI_LIBRARY NAMES lmapi PATHS ${PROJECT_SOURCE_DIR}/build)
|
||||
include_directories(${PROJECT_SOURCE_DIR}/liblmapi)
|
||||
include_directories(${PROJECT_SOURCE_DIR}/liblogosdelivery)
|
||||
target_link_libraries(your_target ${LMAPI_LIBRARY})
|
||||
```
|
||||
|
||||
### Makefile
|
||||
|
||||
```makefile
|
||||
CFLAGS += -I/path/to/liblmapi
|
||||
CFLAGS += -I/path/to/liblogosdelivery
|
||||
LDFLAGS += -L/path/to/build -llmapi -Wl,-rpath,/path/to/build
|
||||
|
||||
your_program: your_program.c
|
||||
@ -160,5 +160,5 @@ your_program: your_program.c
|
||||
## API Documentation
|
||||
|
||||
See:
|
||||
- [liblmapi.h](liblmapi/liblmapi.h) - API function declarations
|
||||
- [MESSAGE_EVENTS.md](liblmapi/MESSAGE_EVENTS.md) - Message event handling guide
|
||||
- [liblogosdelivery.h](liblogosdelivery/liblogosdelivery.h) - API function declarations
|
||||
- [MESSAGE_EVENTS.md](liblogosdelivery/MESSAGE_EVENTS.md) - Message event handling guide
|
||||
|
||||
@ -159,9 +159,9 @@ The library follows the same build system as the main Logos Messaging project.
|
||||
### Build the library
|
||||
|
||||
```bash
|
||||
make liblmapiStatic # Build static library
|
||||
make liblogosdeliveryStatic # Build static library
|
||||
# or
|
||||
make liblmapiDynamic # Build dynamic library
|
||||
make liblogosdeliveryDynamic # Build dynamic library
|
||||
```
|
||||
|
||||
## Return Codes
|
||||
@ -194,7 +194,7 @@ typedef void (*FFICallBack)(
|
||||
## Example Usage
|
||||
|
||||
```c
|
||||
#include "liblmapi.h"
|
||||
#include "liblogosdelivery.h"
|
||||
#include <stdio.h>
|
||||
|
||||
void callback(int ret, const char *msg, size_t len, void *userData) {
|
||||
@ -243,8 +243,8 @@ int main() {
|
||||
|
||||
The library is structured as follows:
|
||||
|
||||
- `liblmapi.h`: C header file with function declarations
|
||||
- `liblmapi.nim`: Main library entry point
|
||||
- `liblogosdelivery.h`: C header file with function declarations
|
||||
- `liblogosdelivery.nim`: Main library entry point
|
||||
- `declare_lib.nim`: Library declaration and initialization
|
||||
- `lmapi/node_api.nim`: Node lifecycle API implementation
|
||||
- `lmapi/messaging_api.nim`: Subscribe/send API implementation
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
# Examples for liblmapi
|
||||
# Examples for liblogosdelivery
|
||||
|
||||
This directory contains example programs demonstrating the usage of the Logos Messaging API (LMAPI) library.
|
||||
|
||||
@ -6,15 +6,15 @@ This directory contains example programs demonstrating the usage of the Logos Me
|
||||
|
||||
### Prerequisites
|
||||
|
||||
1. Build the liblmapi library first:
|
||||
1. Build the liblogosdelivery library first:
|
||||
```bash
|
||||
cd /path/to/logos-messaging-nim
|
||||
make liblmapi
|
||||
make liblogosdelivery
|
||||
```
|
||||
|
||||
2. The library will be available in `build/liblmapi.so` (or `.dylib` on macOS, `.dll` on Windows)
|
||||
2. The library will be available in `build/liblogosdelivery.so` (or `.dylib` on macOS, `.dll` on Windows)
|
||||
|
||||
### Compile the liblmapi Example
|
||||
### Compile the liblogosdelivery Example
|
||||
|
||||
#### On Linux/macOS:
|
||||
```bash
|
||||
@ -22,7 +22,7 @@ This directory contains example programs demonstrating the usage of the Logos Me
|
||||
gcc -o liblogosdelivery_example liblogosdelivery_example.c -I.. -L../../build -llmapi -Wl,-rpath,../../build
|
||||
|
||||
# Static library (if built with STATIC=1)
|
||||
gcc -o liblogosdelivery_example liblogosdelivery_example.c -I.. ../../build/liblmapi.a -lpthread -lm -ldl
|
||||
gcc -o liblogosdelivery_example liblogosdelivery_example.c -I.. ../../build/liblogosdelivery.a -lpthread -lm -ldl
|
||||
```
|
||||
|
||||
#### On macOS:
|
||||
@ -37,7 +37,7 @@ gcc -o liblogosdelivery_example.exe liblogosdelivery_example.c -I.. -L../../buil
|
||||
|
||||
## Running the Examples
|
||||
|
||||
### liblmapi Example
|
||||
### liblogosdelivery Example
|
||||
|
||||
```bash
|
||||
./liblogosdelivery_example
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
# Nim configuration for liblmapi
|
||||
# Nim configuration for liblogosdelivery
|
||||
|
||||
# Ensure correct compiler configuration
|
||||
--gc:
|
||||
|
||||
@ -99,7 +99,7 @@ in stdenv.mkDerivation {
|
||||
|
||||
# Copy header files
|
||||
cp library/libwaku.h $out/include/ 2>/dev/null || true
|
||||
cp liblmapi/liblmapi.h $out/include/ 2>/dev/null || true
|
||||
cp liblogosdelivery/liblogosdelivery.h $out/include/ 2>/dev/null || true
|
||||
'';
|
||||
|
||||
meta = with pkgs.lib; {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user