Skip to content

Commit

Permalink
Build: Add Linux userspace utility bundling
Browse files Browse the repository at this point in the history
  • Loading branch information
vit9696 committed Apr 28, 2021
1 parent 53b0312 commit e7e3a5c
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 10 deletions.
9 changes: 9 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,15 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: Add Linux Toolchain
run: brew tap MarioSchwalbe/gcc-musl-cross

- name: Install Linux Toolchain
run: brew install gcc-8-musl-cross --without-armhf --without-aarch64
env:
HOMEBREW_NO_INSTALL_CLEANUP: 1
HOMEBREW_NO_AUTO_UPDATE: 1

- name: Install Dependencies
run: brew install openssl mingw-w64
env:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ xcshareddata
xcuserdata
project.xcworkspace
*.dSYM
*.linux
Utilities/AppleEfiSignTool/AppleEfiSignTool
Utilities/ACPIe/ACPIe
Utilities/acdtinfo/acdtinfo
Expand Down
1 change: 1 addition & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ OpenCore Changelog
- Added vector acceleration of SHA-512 and SHA-384 hashing algorithms, thx @MikhailKrichanov
- Fixed wraparound when using arrow keys in OpenCanopy
- Updated builtin firmware versions for SMBIOS and the rest
- Added bundled Linux versions for userspace utilities

#### v0.6.8
- Switched to VS2019 toolchain for Windows builds
Expand Down
18 changes: 11 additions & 7 deletions User/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,24 +38,28 @@ UDK_ARCH ?= X64
#
CFLAGS := -c -fshort-wchar -Wall -Wextra -D EFIUSER

ifeq ($(STATIC),1)
LDFLAGS += -static
endif

ifeq ($(WERROR),1)
CFLAGS += -Werror
CFLAGS += -Werror
endif

ifeq ($(shell echo 'int a;' | "${CC}" -Wno-unused-parameter -x c -c - -o /dev/null 2>&1),)
CFLAGS += -Wno-unused-parameter
CFLAGS += -Wno-unused-parameter
endif

ifeq ($(shell echo 'int a;' | "${CC}" -Wno-implicit-fallthrough -x c -c - -o /dev/null 2>&1),)
CFLAGS += -Wno-implicit-fallthrough
CFLAGS += -Wno-implicit-fallthrough
endif

ifeq ($(shell echo 'int a;' | "${CC}" -Wno-strict-aliasing -x c -c - -o /dev/null 2>&1),)
CFLAGS += -Wno-strict-aliasing
CFLAGS += -Wno-strict-aliasing
endif

ifeq ($(shell echo 'int a;' | "${CC}" -Wno-address -x c -c - -o /dev/null 2>&1),)
CFLAGS += -Wno-address
CFLAGS += -Wno-address
endif

ifeq ($(DIST),Darwin)
Expand All @@ -66,8 +70,8 @@ ifeq ($(DIST),Darwin)
endif

ifeq ($(DIST),Windows)
SUFFIX := .exe
CFLAGS += -D_ISOC99_SOURCE=1
SUFFIX := .exe
CFLAGS += -D_ISOC99_SOURCE=1
endif

ifeq ($(SANITIZE),1)
Expand Down
13 changes: 10 additions & 3 deletions build_oc.tool
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ buildutil() {
UDK_ARCH=Ia32 CC=i686-w64-mingw32-gcc STRIP=i686-w64-mingw32-strip DIST=Windows make clean || exit 1
UDK_ARCH=Ia32 CC=i686-w64-mingw32-gcc STRIP=i686-w64-mingw32-strip DIST=Windows make -j "$cores" || exit 1
fi
if [ "$(which x86_64-linux-musl-gcc-8)" != "" ]; then
echo "Building ${util} for Linux..."
STATIC=1 SUFFIX=.linux UDK_ARCH=X64 CC=x86_64-linux-musl-gcc-8 STRIP=x86_64-linux-musl-strip-8 DIST=Linux make clean || exit 1
STATIC=1 SUFFIX=.linux UDK_ARCH=X64 CC=x86_64-linux-musl-gcc-8 STRIP=x86_64-linux-musl-strip-8 DIST=Linux make -j "$cores" || exit 1
fi
cd - || exit 1
done
popd || exit
Expand Down Expand Up @@ -233,9 +238,11 @@ package() {
mkdir -p "${dest}" || exit 1
bin="${selfdir}/Utilities/${util}/${util}"
cp "${bin}" "${dest}" || exit 1
binEXE="${bin}.exe"
if [ -f "${binEXE}" ]; then
cp "${binEXE}" "${dest}" || exit 1
if [ -f "${bin}.exe" ]; then
cp "${bin}.exe" "${dest}" || exit 1
fi
if [ -f "${bin}.linux" ]; then
cp "${bin}.linux" "${dest}" || exit 1
fi
done
# additional docs for macserial.
Expand Down

0 comments on commit e7e3a5c

Please sign in to comment.