Skip to content

Commit

Permalink
docs: update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
bryanchriswhite committed Dec 12, 2024
1 parent 3e49e0e commit c519682
Showing 1 changed file with 72 additions and 10 deletions.
82 changes: 72 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
## Poktroll C Clients Library
# Poktroll C Clients Library

This repo contains an asynchronous C API to the [Poktroll client packages](https://pkg.go.dev/github.com/pokt-network/poktroll/pkg/client) via [cgo](https://pkg.go.dev/cmd/cgo) wrapper functions.

## Getting started
```bash
# Clone and cd into the repo.
git clone https://github.com/bryanchriswhite/libpoktroll_clients.git --recurse-submodules
Expand All @@ -27,19 +28,33 @@ make
# Run tests (requires running poktroll localnet.
# (see: https://dev.poktroll.com/develop/developer_guide/quickstart#1-launch--inspect-localnet)
ctest --output-on-failure
```

## Linux

### Building shared libraries

```bash
CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -o ./build/libpoktroll_clients-<version>-amd64.so -buildmode=c-shared .
```

### Building installers

```bash
cd libpoktroll_clients/build
cmake ..

# Build deb/rpm/tar install packages.
make package # ALL

## Produces:
# - build/libpoktroll_clients-<version>-Linux.{sh,tar.gz,tar.Z}
# - build/libpoktroll_clients-<version>.deb
# - build/libpoktroll_clients-<version>_amd64.deb
# - build/libpoktroll_clients-<version>.x86_64.rpm
# - build/libpoktroll_clients-<version>-<arch>-linux.{sh,tar.gz}
# - build/libpoktroll_clients-<version>-<arch>-linux.deb
# - build/libpoktroll_clients-<version>-<arch>-linux.rpm

## OR
cpack -G "TGZ;DEB;RPM" # All
cpack -G DEB # Debian
cpack -G DEB # Debian/Ubuntu
cpack -G RPM # RHEL/Fedora
cpack -G TGZ # tar.gz

Expand All @@ -53,11 +68,58 @@ make pkgbuild
# Install the shared library and headers.

## Arch
sudo pacman -U ./pkg/libpoktroll_clients-0.1.0-1-x86_64.pkg.tar.zst
sudo pacman -U ./pkg/libpoktroll_clients-<version>-<arch>-Linux.pkg.tar.zst

## Debian
sudo dpkg -i ./pkg/libpoktroll_clients-0.1.0-Linux.deb
sudo dpkg -i ./libpoktroll_clients-<version>-<arch>-Linux.deb

## RHEL/CentOS
sudo rpm -i ./pkg/libpoktroll_clients-0.1.0-Linux.rpm
```
sudo rpm -i ./libpoktroll_clients-<version>-<arch>-Linux.rpm
```

## MacOS

### Building shared libraries (on a macOS host)

```bash
# MacOS (Intel)
CGO_ENABLED=1 GOOS=darwin GOARCH=amd64 go build -o ./build/libpoktroll_clients-<version>-amd64.dylib -buildmode=c-shared .

# MacOS (ARM)
CGO_ENABLED=1 GOOS=darwin GOARCH=arm64 go build -o ./build/libpoktroll_clients-<version>-arm64.dylib -buildmode=c-shared .
```

### Building installers

```bash
cd poktroll-clients-py
mkdir ./build && cd ./build
cmake ..

cpack -G "productbuild;TGZ"
```

## Cross-compiling from (arch) linux

### Targeting Windows

```bash
## Dependencies
sudo pacman -S mingw-w64-gcc wine wine-mono wine_gecko winetricks
yay -S llvm-mingw-w64-toolchain-ucrt-bin

## Shared library
CGO_ENABLED=1 \
CC=x86_64-w64-mingw32-gcc \
CXX=x86_64-w64-mingw32-g++ \
GOOS=windows \
GOARCH=amd64 \
go build -o ./build/libpoktroll_clients-<version>-amd64.dll -buildmode=c-shared .

## Installer
TODO: While this is possible, it's a bit involved and out of scope for the initial release.
```
### Targeting macOS
**TODO: While this is possible, it's a bit involved and out of scope for the initial release.**

0 comments on commit c519682

Please sign in to comment.