Skip to content

Commit

Permalink
Added Linux/i386 static build action, thanks to https://github.com/ma…
Browse files Browse the repository at this point in the history
…rketplace/actions/setup-alpine-linux-environment. Software: option --old-alg moved to other options help section. README.md updated to include GH Actions credits.
  • Loading branch information
N-Storm committed May 21, 2024
1 parent b036e89 commit f6baf60
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 14 deletions.
51 changes: 39 additions & 12 deletions .github/workflows/build-software.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,16 @@ jobs:

matrix:
sys:
- { os: ubuntu-latest, container: 'ghcr.io/phusion/holy-build-box/hbb-64', shell: bash , c_compiler: gcc , binary_orig: digilivolo }
- { os: ubuntu-latest, container: 'debian:10' , shell: bash , c_compiler: gcc , binary_orig: digilivolo }
- { os: ubuntu-20.04 , shell: bash , c_compiler: gcc , binary_orig: digilivolo , binary_release: digilivolo-linux-x86_64 }
- { os: ubuntu-latest, container: 'debian' , shell: bash , crosscompile: armhf, binary_orig: digilivolo , binary_release: digilivolo-linux-armhf }
- { os: ubuntu-latest, container: 'debian' , shell: bash , crosscompile: arm64, binary_orig: digilivolo , binary_release: digilivolo-linux-arm64 }
- { os: ubuntu-20.04 , shell: bash , c_compiler: clang , binary_orig: digilivolo }
- { os: windows-latest , shell: 'msys2 {0}', c_compiler: gcc , binary_orig: digilivolo.exe, binary_release: digilivolo-win-x86_64.exe }
- { os: windows-latest , shell: pwsh , c_compiler: gcc , binary_orig: digilivolo.exe }
- { os: windows-latest , shell: pwsh , c_compiler: clang , binary_orig: digilivolo.exe }
- { os: ubuntu-latest, container: 'ghcr.io/phusion/holy-build-box/hbb-64', shell: bash , c_compiler: gcc , binary_orig: digilivolo }
- { os: ubuntu-latest, container: 'debian:10' , shell: bash , c_compiler: gcc , binary_orig: digilivolo }
- { os: ubuntu-20.04 , shell: bash , c_compiler: gcc , binary_orig: digilivolo , binary_release: digilivolo-linux-x86_64 }
- { os: ubuntu-latest , shell: 'alpine.sh {0}', crosscompile: i386 , binary_orig: digilivolo , binary_release: digilivolo-linux-static-i386 }
- { os: ubuntu-latest, container: 'debian' , shell: bash , crosscompile: armhf, binary_orig: digilivolo , binary_release: digilivolo-linux-armhf }
- { os: ubuntu-latest, container: 'debian' , shell: bash , crosscompile: arm64, binary_orig: digilivolo , binary_release: digilivolo-linux-arm64 }
- { os: ubuntu-20.04 , shell: bash , c_compiler: clang , binary_orig: digilivolo }
- { os: windows-latest , shell: 'msys2 {0}' , c_compiler: gcc , binary_orig: digilivolo.exe, binary_release: digilivolo-win-x86_64.exe }
- { os: windows-latest , shell: pwsh , c_compiler: gcc , binary_orig: digilivolo.exe }
- { os: windows-latest , shell: pwsh , c_compiler: clang , binary_orig: digilivolo.exe }
build_type: [Release]

defaults:
Expand All @@ -48,6 +49,33 @@ jobs:
echo
cat /etc/os-release
- name: Install & configure Alpine Linux build environment for i386 build
uses: jirutka/setup-alpine@v1
if: matrix.sys.crosscompile == 'i386'
with:
arch: x86
packages: |
build-base
sudo
git
dialog
python3
py3-pip
py3-setuptools
ninja-build
samurai
make
cmake
libusb-dev
eudev
eudev-libs
eudev-dev
curl
wget
pkgconf
pkgconf-dev
linux-headers
- name: Install packages required for the workflow and build deps
uses: ConorMacBride/install-package@v1
if: matrix.sys.container != 'ghcr.io/phusion/holy-build-box/hbb-64'
Expand Down Expand Up @@ -83,7 +111,7 @@ jobs:
ninja:p
- name: Install cross compiling toolchain and deps
if: ${{ matrix.sys.crosscompile != '' }}
if: matrix.sys.crosscompile != '' && matrix.sys.crosscompile != 'i386'
shell: bash
run: |
echo "Installing cross toolchain for ${{ matrix.sys.crosscompile }}"
Expand Down Expand Up @@ -122,8 +150,7 @@ jobs:
- name: Rename binary to release target
if: ${{ matrix.sys.binary_release != '' }}
shell: bash
run: |
mv software/build/${{ matrix.sys.binary_orig }} software/build/${{ matrix.sys.binary_release }}
run: mv software/build/${{ matrix.sys.binary_orig }} software/build/${{ matrix.sys.binary_release }}

- name: Make and upload release
uses: softprops/action-gh-release@v1
Expand Down
18 changes: 17 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,20 @@ Usage: digilivolo [OPTION...] REMOTE_ID KEY_ID
Software to control DigiLivolo devices.

Positional arguments:
KEY_ID Livilo Key ID (1-255)
KEY_CODE Livilo Key ID (1-255)
REMOTE_ID Livilo Remote ID (1-65535)

Options:
-o, --old-alg Use deperecated original transmit algorithm
-v, --verbose Produce verbose output

-?, --help Give this help list
-V, --version Print program version
--usage Give a short usage message

Report bugs to https://github.com/N-Storm/DigiLivolo/
Copyright (c) 2024 GitHub user N-Storm.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
```

REMOTE_ID and KEY_ID can be specified either as deciman numbers or hex numbers if preceeded by `'0x'`.
Expand Down Expand Up @@ -151,6 +157,7 @@ statically linked. If you wish to use system installed `hidapi` library and you
installed, add `-DUSE_SYSTEM_HIDAPI=true` option to first cmake command on the example above.

## Software & libraries used
##### Project

* [PlatformIO](https://platformio.org/)
* [DigistumpArduino](https://github.com/ArminJo/DigistumpArduino)
Expand All @@ -159,3 +166,12 @@ installed, add `-DUSE_SYSTEM_HIDAPI=true` option to first cmake command on the e
* [hidapi](https://github.com/libusb/hidapi)
* [hidapitester](https://github.com/todbot/hidapitester)
* [argp-standalone](https://github.com/tom42/argp-standalone)

##### Github Actions

* [Checkout V3](https://github.com/actions/checkout/tree/releases/v3)
* [action gh-release](https://github.com/softprops/action-gh-release)
* [Setup MSYS2](https://github.com/msys2/setup-msys2)
* [install-package](https://github.com/ConorMacBride/install-package/)
* [Get Ninja GitHub Action](https://github.com/turtlesec-no/get-ninja)
* [GitHub Action: Setup Alpine Linux](https://github.com/marketplace/actions/setup-alpine-linux-environment)
1 change: 1 addition & 0 deletions software/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
set(PROJECT_NAME "digilivolo")
project(${PROJECT_NAME} C)
set(CMAKE_PROJECT_INCLUDE ${CMAKE_TOOLCHAIN_FILE})

option(USE_SYSTEM_HIDAPI "Don't build included hidapi, use system installed version instead" FALSE)
option(HIDAPI_WITH_LIBUSB "Build hidapi with libusb interface" FALSE)
Expand Down
5 changes: 5 additions & 0 deletions software/cmake/i386-linux-toolchain.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
set(CMAKE_SYSTEM_NAME Linux)
# set(CMAKE_SYSTEM_PROCESSOR x86)

set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
set(CMAKE_EXE_LINKER_FLAGS "-static")
2 changes: 1 addition & 1 deletion software/src/args.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>";
char args_doc[] = "REMOTE_ID KEY_CODE";

struct argp_option options[] = {
{"old-alg", 'o', 0, 0, "Use deperecated original transmit algorithm" },
{0, 0, 0, 0, "Positional arguments:" },
{"REMOTE_ID", 0, 0, OPTION_DOC | OPTION_NO_USAGE, "Livilo Remote ID (1-65535)" },
{"KEY_CODE", 0, 0, OPTION_DOC | OPTION_NO_USAGE, "Livilo Key ID (1-255)" },
{0, 0, 0, 0, "Options:" },
{"verbose", 'v', 0, 0, "Produce verbose output" },
{"old-alg", 'o', 0, 0, "Use deperecated original transmit algorithm" },
{ 0 }
};

Expand Down

0 comments on commit f6baf60

Please sign in to comment.