From b1a29a1b6080e402c1555e11027aa521315f3817 Mon Sep 17 00:00:00 2001 From: Alexander Amelkin Date: Sat, 24 Apr 2021 00:00:23 +0300 Subject: [PATCH 1/2] Add github workflow Support building for ubuntu, macos catalina, and windows server 2019 Signed-off-by: Alexander Amelkin --- .github/workflows/ci.yml | 64 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..97013ed --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,64 @@ +# vi: set et ts=2 sw=2 : +name: build + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + linux: + strategy: + matrix: + os: [ ubuntu-16.04, ubuntu-18.04, ubuntu-20.04 ] + runs-on: ${{ matrix.os }} + steps: + - name: install dependencies + run: | + sudo apt install \ + libjson-c-dev \ + cmake \ + gcc \ + git \ + make \ + - uses: actions/checkout@v2 + - name: cmake + run: mkdir build && cd build && cmake .. + - name: make + run: make -C build + + macos-catalina: + runs-on: macos-10.15 + + steps: + - name: install dependencies + run: brew install cmake json-c + - uses: actions/checkout@v2 + - name: cmake + run: mkdir build && cd build && cmake .. + - name: make + run: make -C build + + win-srv-2019: + + runs-on: windows-2019 + + steps: + - name: install dependencies + run: |- + choco install cygwin -y + choco install cyg-get -y + # Line continuation in PowerShell is backtick. Weird as Windows. + cyg-get gcc-g++ ` + cmake ` + make ` + libjson-c-devel ` + dos2unix + echo "C:/tools/cygwin/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append + echo "C:/tools/cygwin/usr/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append + - uses: actions/checkout@v2 + - name: cmake + run: bash -c "mkdir build && cd build && cmake .." + - name: make + run: make -C build From 98fca3831fd3d0cd0320d096b45f9481e8b0a6d0 Mon Sep 17 00:00:00 2001 From: Alexander Amelkin Date: Sat, 24 Apr 2021 00:05:51 +0300 Subject: [PATCH 2/2] Fix build for macOS Catalina macOS doesn't provide htole32() and other functions, but has OSSwap*() functions instead. Signed-off-by: Alexander Amelkin --- fru.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/fru.c b/fru.c index db08a47..073865e 100644 --- a/fru.c +++ b/fru.c @@ -22,8 +22,28 @@ #include #include +#ifdef __APPLE__ +#include + +#define htobe16(x) OSSwapHostToBigInt16(x) +#define htole16(x) OSSwapHostToLittleInt16(x) +#define be16toh(x) OSSwapBigToHostInt16(x) +#define le16toh(x) OSSwapLittleToHostInt16(x) + +#define htobe32(x) OSSwapHostToBigInt32(x) +#define htole32(x) OSSwapHostToLittleInt32(x) +#define be32toh(x) OSSwapBigToHostInt32(x) +#define le32toh(x) OSSwapLittleToHostInt32(x) + +#define htobe64(x) OSSwapHostToBigInt64(x) +#define htole64(x) OSSwapHostToLittleInt64(x) +#define be64toh(x) OSSwapBigToHostInt64(x) +#define le64toh(x) OSSwapLittleToHostInt64(x) + +#else #define _BSD_SOURCE #include +#endif #ifdef __STANDALONE__ #include