Skip to content

Commit

Permalink
Add build scripts and use in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
mchack-work committed Nov 22, 2023
1 parent da56990 commit 7da0db0
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 36 deletions.
14 changes: 1 addition & 13 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,25 +21,13 @@ jobs:
# fetch-depth: 0
persist-credentials: false

- name: Clone tkey-libs
uses: actions/checkout@v3
with:
repository: tillitis/tkey-libs
ref: main
path: tkey-libs

- name: fix
# https://github.com/actions/runner-images/issues/6775
run: |
git config --global --add safe.directory "$GITHUB_WORKSPACE"
- name: Build tkey-libs
run: |
cd tkey-libs
make
- name: make
run: make LIBDIR=./tkey-libs
run: ./build.sh

- name: check fmt of c code
run: make checkfmt
Expand Down
31 changes: 8 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,33 +121,18 @@ https://spdx.org/licenses/
You have two options for build tools: either you use our OCI image
`ghcr.io/tillitis/tkey-builder` or native tools.

In either case you need the device libraries in a directory next to
this one. The device libraries are available in:
An easy way to build is to use the provided scripts:

https://github.com/tillitis/tkey-libs
- `build.sh` for native tools.
- `build-podman.sh` for use with Podman.

Clone and build the device libraries first. You will most likely want
to specify a release with something like `-b v0.0.1`:
These scripts automatilly clone the [tkey-libs device
libraries](https://github.com/tillitis/tkey-libs) in a directory next
to this one.

```
$ git clone -b v0.0.1 --depth 1 https://github.com/tillitis/tkey-libs
$ cd tkey-libs
$ make
```

### Building with Podman

We provide an OCI image with all tools you can use to build the
tkey-libs and the apps. If you have `make` and Podman installed you
can use it like this in the `tkey-libs` directory and then this
directory:

```
make podman
```
### Installing Podman

and everything should be built. This assumes a working rootless
podman. On Ubuntu 22.10, running
On Ubuntu 22.10, running

```
apt install podman rootlesskit slirp4netns
Expand Down
21 changes: 21 additions & 0 deletions build-podman.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#! /bin/sh

# Copyright (C) 2023 - Tillitis AB
# SPDX-License-Identifier: GPL-2.0-only

set -e

tkey_libs_version="v0.0.2"

printf "Building tkey-libs with version: %s\n" "$tkey_libs_version"

if [ -d ../tkey-libs ]
then
(cd ../tkey-libs; git checkout "$tkey_libs_version")
else
git clone -b "$tkey_libs_version" https://github.com/tillitis/tkey-libs.git ../tkey-libs
fi

make -j -C ../tkey-libs podman

make -j podman
19 changes: 19 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#! /bin/sh

# Copyright (C) 2023 - Tillitis AB
# SPDX-License-Identifier: GPL-2.0-only

tkey_libs_version="v0.0.2"

printf "Building tkey-libs with version: %s\n" "$tkey_libs_version"

if [ -d ../tkey-libs ]
then
(cd ../tkey-libs; git checkout "$tkey_libs_version")
else
git clone -b "$tkey_libs_version" https://github.com/tillitis/tkey-libs.git ../tkey-libs
fi

make -j -C ../tkey-libs

make -j

0 comments on commit 7da0db0

Please sign in to comment.