Implement mac builds with deploy and fix Linux builds

This commit is contained in:
vit9696 2018-05-03 22:15:52 +03:00
parent 17267ed4b1
commit ddecccec86
2 changed files with 108 additions and 25 deletions

View File

@ -1,28 +1,46 @@
language: cpp language: cpp
compiler: gcc matrix:
sudo: require include:
dist: trusty - os: osx
osx_image: xcode9.2
before_install: compiler: clang
- sudo add-apt-repository ppa:beineri/opt-qt58-trusty -y
- sudo apt-get update -qq
install: script:
- sudo apt-get -y install qt58base - ./macbuild.sh
- source /opt/qt58/bin/qt58-env.sh
script: deploy:
- cd UEFITool provider: releases
- qmake PREFIX=/usr skip_cleanup: true
- make -j4 file: "dist/*.zip"
- mkdir -p appdir/usr/bin ; mkdir -p appdir/usr/share/{applications,icons} ; cd appdir file_glob: true
- cp ../UEFITool usr/bin/uefitool api_key:
- cp ../uefitool.desktop . secure: "TODO"
- cp ../icons/uefitool_256x256.png uefitool.png on:
- cd .. tags: true
- wget -c "https://github.com/probonopd/linuxdeployqt/releases/download/3/linuxdeployqt-3-x86_64.AppImage"
- chmod a+x linuxdeployqt*.AppImage - os: linux
- unset QTDIR; unset QT_PLUGIN_PATH ; unset LD_LIBRARY_PATH compiler: clang
- ./linuxdeployqt*.AppImage ./appdir/usr/bin/* -bundle-non-qt-libs
- ./linuxdeployqt*.AppImage ./appdir/usr/bin/* -appimage before_install:
- curl --upload-file ./UEFITool-*.AppImage https://transfer.sh/UEFITool-git.$(git rev-parse --short HEAD)-x86_64.AppImage - sudo add-apt-repository --yes ppa:ubuntu-sdk-team/ppa
- sudo apt-get update -qq
- sudo apt-get install -qq qt5-qmake qtbase5-dev qtdeclarative5-dev libqt5webkit5-dev libsqlite3-dev
script:
- cd UEFITool
- qmake -qt=qt5 uefitool.pro
- make
- os: linux
compiler: gcc
before_install:
- sudo add-apt-repository --yes ppa:ubuntu-sdk-team/ppa
- sudo apt-get update -qq
- sudo apt-get install -qq qt5-qmake qtbase5-dev qtdeclarative5-dev libqt5webkit5-dev libsqlite3-dev
script:
- cd UEFITool
- qmake -qt=qt5 uefitool.pro
- make

65
macbuild.sh Executable file
View File

@ -0,0 +1,65 @@
#!/bin/bash
if [ ! -d /opt/qt56sm ]; then
curl -L -o /tmp/qt-5.6.3-static-mac.zip https://github.com/distdb/qtbuilds/blob/master/qt-5.6.3-static-mac.zip?raw=true || exit 1
qtsum=$(shasum -a 256 /tmp/qt-5.6.3-static-mac.zip | cut -f1 -d' ')
qtexpsum="214d22d8572ea6162753c8dd251d79275f3b22d49204718c637d722409e0cfcb"
if [ "$qtsum" != "$qtexpsum" ]; then
echo "Qt hash $qtsum does not match $qtexpsum"
exit 1
fi
sudo mkdir -p /opt || exit 1
cd /opt || exit 1
sudo unzip -q /tmp/qt-5.6.3-static-mac.zip || exit 1
cd - || exit 1
fi
export PATH="/opt/qt56sm/bin:$PATH"
echo "Attempting to build UEFITool NE for macOS..."
UEFITOOL_VER=$(cat UEFITool/uefitool.cpp | grep ^version | cut -d'"' -f2 | sed 's/NE alpha /A/')
UEFIDUMP_VER=$(cat UEFIDump/uefidump_main.cpp | grep '"UEFIDump [0-9]' | cut -d'"' -f2 | cut -d' ' -f2)
UEFIEXTRACT_VER=$(cat UEFIExtract/uefiextract_main.cpp | grep '"UEFIExtract [0-9]' | cut -d'"' -f2 | cut -d' ' -f2)
UEFIFIND_VER=$(cat UEFIFind/uefifind_main.cpp | grep '"UEFIFind [0-9]' | cut -d'"' -f2 | cut -d' ' -f2)
build_tool() {
echo "Building $1 $2"
# Check version
if [ "$(echo "$2" | grep '^[0-9]*\.[0-9]*\.[0-9]*$')" != "$2" ] && [ "$(echo "$2" | grep '^A[0-9]*$')" != "$2" ]; then
echo "Invalid $1 version!"
exit 1
fi
# Tools are in subdirectories
cd "$1" || exit 1
# Build
if [ "$3" != "" ]; then
qmake $3 QMAKE_CXXFLAGS+=-flto QMAKE_LFLAGS+=-flto CONFIG+=optimize_size || exit 1
else
cmake -G "Unix Makefiles" -DCMAKE_CXX_FLAGS="-stdlib=libc++ -flto -Os -mmacosx-version-min=10.7" -DCMAKE_C_FLAGS="-flto -Os -mmacosx-version-min=10.7" || exit 1
fi
make || exit 1
# Archive
if [ "$1" = "UEFITool" ]; then
strip -x UEFITool.app/Contents/MacOS/UEFITool || exit 1
zip -qry ../dist/"${1}_NE_${2}_mac.zip" UEFITool.app "${4}" || exit 1
else
strip -x "$1" || exit 1
zip -qry ../dist/"${1}_NE_${2}_mac.zip" "${1}" "${4}" || exit 1
fi
# Return to parent
cd - || exit 1
}
rm -rf dist
mkdir -p dist || exit 1
build_tool UEFITool "$UEFITOOL_VER" uefitool.pro
build_tool UEFIDump "$UEFIDUMP_VER" ""
build_tool UEFIExtract "$UEFIEXTRACT_VER" uefiextract.pro
build_tool UEFIFind "$UEFIFIND_VER" uefifind.pro
exit 0