Changes to MacOS build (#1340)
This commit is contained in:
@@ -1,98 +0,0 @@
|
||||
name: Build
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- '*'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- os: macos-12
|
||||
name: macos
|
||||
qt_ver: 5
|
||||
qt_host: mac
|
||||
qt_version: '5.15.2'
|
||||
qt_modules: ''
|
||||
qt_tools: ''
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
steps:
|
||||
##
|
||||
# PREPARE
|
||||
##
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: 'true'
|
||||
|
||||
- name: Set short version
|
||||
shell: bash
|
||||
run: |
|
||||
ver_short=`git rev-parse --short HEAD`
|
||||
ver_novelwriter=`awk '/^__version__/{print substr($NF,2,length($NF)-2)}' novelwriter/__init__.py`
|
||||
echo "VERSION=$ver_novelwriter" >> $GITHUB_ENV
|
||||
echo "VERSION_SHORT=$ver_short" >> $GITHUB_ENV
|
||||
|
||||
- name: Install Qt (Linux)
|
||||
if: runner.os == 'Linux' && matrix.qt_ver != 6
|
||||
run: |
|
||||
sudo apt-get -y install qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools libqt5core5a libqt5network5 libqt5gui5
|
||||
|
||||
- name: Install Qt (macOS, AppImage & Windows MSVC)
|
||||
if: runner.os == 'Linux' && matrix.qt_ver == 6 || runner.os == 'macOS' || (runner.os == 'Windows' && matrix.msystem == '')
|
||||
uses: jurplel/install-qt-action@v3
|
||||
with:
|
||||
version: ${{ matrix.qt_version }}
|
||||
host: ${{ matrix.qt_host }}
|
||||
target: 'desktop'
|
||||
arch: ${{ matrix.qt_arch }}
|
||||
modules: ${{ matrix.qt_modules }}
|
||||
tools: ${{ matrix.qt_tools }}
|
||||
cache: true
|
||||
|
||||
- name: Setup TeX Live
|
||||
uses: teatimeguest/setup-texlive-action@v2
|
||||
with:
|
||||
packages: >-
|
||||
scheme-basic
|
||||
collection-latexextra
|
||||
latexmk
|
||||
tex-gyre
|
||||
|
||||
- name: Install Dependencies (macOS)
|
||||
if: runner.os == 'macOS'
|
||||
run: |
|
||||
pip3 install sphinx
|
||||
|
||||
##
|
||||
# BUILD
|
||||
##
|
||||
|
||||
- name: Build (macOS)
|
||||
if: runner.os == 'macOS'
|
||||
run: |
|
||||
./setup/macos/build.sh
|
||||
|
||||
##
|
||||
# UPLOAD BUILDS
|
||||
##
|
||||
|
||||
- name: Upload binary zip (macOS)
|
||||
if: runner.os == 'macOS'
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: novelWriter-${{ env.VERSION }}-${{ matrix.name }}.app.zip
|
||||
path: dist_macos/novelWriter-${{ env.VERSION }}.app.zip
|
||||
|
||||
- name: Upload dmg (macOS)
|
||||
if: runner.os == 'macOS'
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: novelWriter-${{ env.VERSION }}-${{ matrix.name }}.dmg
|
||||
path: dist_macos/novelWriter-${{ env.VERSION }}.dmg
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
name: Packaging
|
||||
|
||||
on: workflow_dispatch
|
||||
|
||||
jobs:
|
||||
buildAssets:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Python Setup
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: 3
|
||||
architecture: x64
|
||||
|
||||
- name: Install Packages (apt)
|
||||
run: |
|
||||
sudo apt update
|
||||
sudo apt install qttools5-dev-tools python3-sphinx latexmk texlive texlive-latex-extra
|
||||
|
||||
- name: Checkout Source
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Run Build Commands
|
||||
run: python setup.py qtlrelease sample manual
|
||||
|
||||
- name: Upload Artifacts
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: nw-assets-${{ github.sha }}
|
||||
path: |
|
||||
novelwriter/assets/sample.zip
|
||||
novelwriter/assets/manual.pdf
|
||||
novelwriter/assets/i18n/*.qm
|
||||
if-no-files-found: error
|
||||
retention-days: 1
|
||||
|
||||
buildMac:
|
||||
needs: buildAssets
|
||||
strategy:
|
||||
fail-fast: false
|
||||
runs-on: macos-12
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Get Version
|
||||
shell: bash
|
||||
run: |
|
||||
NW_VERSION=`awk '/^__version__/{print substr($NF,2,length($NF)-2)}' novelwriter/__init__.py`
|
||||
echo "novelWriter Version: $NW_VERSION"
|
||||
echo "VERSION=$NW_VERSION" >> $GITHUB_ENV
|
||||
|
||||
- name: Download Artifact
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: nw-assets-${{ github.sha }}
|
||||
path: novelwriter/assets
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
./setup/macos/build.sh
|
||||
|
||||
- name: Upload ZIP
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: novelWriter-${{ env.VERSION }}-macos.app.zip
|
||||
path: dist_macos/novelWriter-${{ env.VERSION }}.app.zip
|
||||
# retention-days: 1
|
||||
|
||||
- name: Upload DMG
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: novelWriter-${{ env.VERSION }}-macos.dmg
|
||||
path: dist_macos/novelWriter-${{ env.VERSION }}.dmg
|
||||
# retention-days: 1
|
||||
@@ -9,6 +9,7 @@
|
||||
setup.iss
|
||||
/novelwriter.desktop
|
||||
/novelWriter.pyw
|
||||
/setup/macos/Info.plist
|
||||
|
||||
# Translations
|
||||
/novelwriter/assets/i18n/*.qm
|
||||
|
||||
@@ -71,25 +71,6 @@ def extractVersion():
|
||||
|
||||
return numVers, hexVers, relDate
|
||||
|
||||
def extractCopyright():
|
||||
"""Extract the novelWriter copyright notice without having to import
|
||||
anything else from the main package.
|
||||
"""
|
||||
copyright = "Unknown"
|
||||
initFile = os.path.join("novelwriter", "__init__.py")
|
||||
try:
|
||||
with open(initFile, mode="r", encoding="utf-8") as inFile:
|
||||
for aLine in inFile:
|
||||
if aLine.startswith("__copyright__"):
|
||||
copyright = (aLine).partition("=")[2].strip().strip('"')
|
||||
except Exception as exc:
|
||||
print("Could not read file: %s" % initFile)
|
||||
print(str(exc))
|
||||
|
||||
print("novelWriter copyright: %s " % (copyright))
|
||||
|
||||
return copyright
|
||||
|
||||
|
||||
def compactVersion(numVers):
|
||||
"""Make the version number more compact."""
|
||||
@@ -414,102 +395,36 @@ def buildQtI18nTS(sysArgs):
|
||||
|
||||
return
|
||||
|
||||
|
||||
##
|
||||
# Generage MacOS PList
|
||||
##
|
||||
|
||||
def genMacOSPlist():
|
||||
|
||||
# Set Up Folder
|
||||
# =============
|
||||
|
||||
"""Set necessary values for .plist file.
|
||||
"""
|
||||
numVers, _, _ = extractVersion()
|
||||
pkgVers = compactVersion(numVers)
|
||||
|
||||
outDir = "setup/macos"
|
||||
|
||||
macosBundleName = "novelWriter"
|
||||
macosBundleExeName = "novelWriter"
|
||||
macosBundleInfo = "novelWriter: A markdown-like text editor for planning and writing novels."
|
||||
macosBundleIcon = "novelwriter.icns"
|
||||
macosBundleIdent = "io.novelwriter.novelWriter"
|
||||
macosBundleSVers = pkgVers
|
||||
macosBundleVers = numVers
|
||||
macosBundleCopyright = extractCopyright()
|
||||
copyrightYear = datetime.datetime.now().year
|
||||
|
||||
# These keys are no longer used but are present for compatability
|
||||
macosBundleVersMajor, macosBundleVersMinor, _ = pkgVers.split(".")
|
||||
pkgVersMaj, pkgVersMin, _ = pkgVers.split(".")
|
||||
|
||||
|
||||
plistXML = (
|
||||
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
|
||||
"<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n"
|
||||
"<plist version=\"1.0\">\n"
|
||||
"<dict>\n"
|
||||
"<key>NSPrincipalClass</key>\n"
|
||||
"<string>NSApplication</string>\n"
|
||||
"<key>NSHighResolutionCapable</key>\n"
|
||||
"<string>True</string>\n"
|
||||
"<key>CFBundleDevelopmentRegion</key>\n"
|
||||
"<string>English</string>\n"
|
||||
"<key>CFBundleExecutable</key>\n"
|
||||
f"<string>{macosBundleExeName}</string>\n"
|
||||
"<key>CFBundleGetInfoString</key>\n"
|
||||
f"<string>{macosBundleInfo}</string>\n"
|
||||
"<key>CFBundleIconFile</key>\n"
|
||||
f"<string>{macosBundleIcon}</string>\n"
|
||||
"<key>CFBundleIdentifier</key>\n"
|
||||
f"<string>{macosBundleIdent}</string>\n"
|
||||
"<key>CFBundleName</key>\n"
|
||||
f"<string>{macosBundleName}</string>\n"
|
||||
"<key>CFBundleDisplayName</key>\n"
|
||||
f"<string>{macosBundleName}</string>\n"
|
||||
"<key>CFBundleInfoDictionaryVersion</key>\n"
|
||||
"<string>6.0</string>\n"
|
||||
"<key>CFBundleShortVersionString</key>\n"
|
||||
f"<string>{macosBundleSVers}</string>\n"
|
||||
"<key>CFBundleSignature</key>\n"
|
||||
"<string>????</string>\n"
|
||||
"<key>CFBundleVersion</key>\n"
|
||||
f"<string>{macosBundleVers}</string>\n"
|
||||
"<key>CFBundlePackageType</key>\n"
|
||||
"<string>APPL</string>\n"
|
||||
"<key>NSHumanReadableCopyright</key>\n"
|
||||
f"<string>{macosBundleCopyright}</string>\n"
|
||||
"<key>IFMajorVersion</key>\n"
|
||||
f"<integer>{macosBundleVersMajor}</integer>\n"
|
||||
"<key>IFMinorVersion</key>\n"
|
||||
f"<integer>{macosBundleVersMinor}</integer>\n"
|
||||
"<key>CFBundleDocumentTypes</key>\n"
|
||||
" <array>\n"
|
||||
" <dict>\n"
|
||||
" <key>CFBundleTypeExtensions</key>\n"
|
||||
" <array>\n"
|
||||
" <string>nwx</string>\n"
|
||||
" </array>\n"
|
||||
" <key>CFBundleTypeName</key>\n"
|
||||
" <string>novelWriter Project</string>\n"
|
||||
" <key>CFBundleTypeOSTypes</key>\n"
|
||||
" <array>\n"
|
||||
" <string>TEXT</string>\n"
|
||||
" <string>utxt</string>\n"
|
||||
" <string>TUTX</string>\n"
|
||||
" <string>****</string>\n"
|
||||
" </array>\n"
|
||||
" <key>CFBundleTypeRole</key>\n"
|
||||
" <string>Viewer</string>\n"
|
||||
" <key>LSHandlerRank</key>\n"
|
||||
" <string>Alternate</string>\n"
|
||||
" </dict>\n"
|
||||
" </array>\n"
|
||||
"</dict>\n"
|
||||
"</plist>\n"
|
||||
plistXML = readFile(f"{outDir}/Info.plist.template").format(
|
||||
macosBundleSVers=pkgVers,
|
||||
macosBundleVers=numVers,
|
||||
macosBundleVersMajor=pkgVersMaj,
|
||||
macosBundleVersMinor=pkgVersMin,
|
||||
macosBundleCopyright=f"Copyright 2018–{copyrightYear}, Veronica Berglyd Olsen",
|
||||
)
|
||||
|
||||
print(f"Writing Info.plist to {outDir}/Info.plist")
|
||||
|
||||
writeFile(f"{outDir}/Info.plist", plistXML)
|
||||
|
||||
return
|
||||
|
||||
|
||||
##
|
||||
# Sample Project ZIP File Builder (sample)
|
||||
@@ -2059,7 +1974,7 @@ if __name__ == "__main__":
|
||||
if "clean-assets" in sys.argv:
|
||||
sys.argv.remove("clean-assets")
|
||||
cleanBuiltAssets()
|
||||
|
||||
|
||||
if "gen-plist" in sys.argv:
|
||||
sys.argv.remove("gen-plist")
|
||||
genMacOSPlist()
|
||||
|
||||
@@ -7,4 +7,4 @@
|
||||
<key>com.apple.security.cs.allow-dyld-environment-variables</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
||||
</plist>
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string>NSApplication</string>
|
||||
<key>NSHighResolutionCapable</key>
|
||||
<string>True</string>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>English</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>novelWriter</string>
|
||||
<key>CFBundleGetInfoString</key>
|
||||
<string>novelWriter: A markdown-like text editor for planning and writing novels.</string>
|
||||
<key>CFBundleIconFile</key>
|
||||
<string>novelwriter.icns</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>io.novelwriter.novelWriter</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>novelWriter</string>
|
||||
<key>CFBundleDisplayName</key>
|
||||
<string>novelWriter</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>{macosBundleSVers}</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>{macosBundleVers}</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string>{macosBundleCopyright}</string>
|
||||
<key>IFMajorVersion</key>
|
||||
<integer>{macosBundleVersMajor}</integer>
|
||||
<key>IFMinorVersion</key>
|
||||
<integer>{macosBundleVersMinor}</integer>
|
||||
<key>CFBundleDocumentTypes</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>CFBundleTypeExtensions</key>
|
||||
<array>
|
||||
<string>nwx</string>
|
||||
</array>
|
||||
<key>CFBundleTypeName</key>
|
||||
<string>novelWriter Project</string>
|
||||
<key>CFBundleTypeOSTypes</key>
|
||||
<array>
|
||||
<string>TEXT</string>
|
||||
<string>utxt</string>
|
||||
<string>TUTX</string>
|
||||
<string>****</string>
|
||||
</array>
|
||||
<key>CFBundleTypeRole</key>
|
||||
<string>Viewer</string>
|
||||
<key>LSHandlerRank</key>
|
||||
<string>Alternate</string>
|
||||
</dict>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
||||
+32
-6
@@ -33,7 +33,33 @@ VERSION="$(awk '/^__version__/{print substr($NF,2,length($NF)-2)}' $SRC_DIR/nove
|
||||
|
||||
pushd "$SRC_DIR" || exit 1
|
||||
|
||||
python3 setup.py manual qtlrelease sample gen-plist
|
||||
python3 setup.py gen-plist
|
||||
if [ -f $SRC_DIR/setup/macos/Info.plist ]; then
|
||||
echo "Found: setup/macos/Info.plist"
|
||||
else
|
||||
echo "Missing: setup/macos/Info.plist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check that other assets are present
|
||||
if [ -f $SRC_DIR/novelwriter/assets/sample.zip ]; then
|
||||
echo "Found: novelwriter/assets/sample.zip"
|
||||
else
|
||||
echo "Missing: novelwriter/assets/sample.zip"
|
||||
exit 1
|
||||
fi
|
||||
if [ -f $SRC_DIR/novelwriter/assets/manual.pdf ]; then
|
||||
echo "Found: novelwriter/assets/manual.pdf"
|
||||
else
|
||||
echo "Missing: novelwriter/assets/manual.pdf"
|
||||
exit 1
|
||||
fi
|
||||
if [ -f $SRC_DIR/novelwriter/assets/i18n/nw_en_US.qm ]; then
|
||||
echo "Found: novelwriter/assets/i18n/nw_en_US.qm"
|
||||
else
|
||||
echo "Missing: novelwriter/assets/i18n/nw_en_US.qm"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
ls -lah .
|
||||
|
||||
@@ -70,15 +96,12 @@ mkdir novelWriter.app/Contents/MacOS novelWriter.app/Contents/Resources novelWri
|
||||
cp $SRC_DIR/setup/macos/Info.plist novelWriter.app/Contents/Info.plist
|
||||
|
||||
echo "Copying miniconda env to bundle ..."
|
||||
# copy Miniconda env
|
||||
cp -R ~/miniconda/envs/novelWriter/* novelWriter.app/Contents/Resources/
|
||||
|
||||
echo "Copying novelWriter to bundle ..."
|
||||
# copy novelWriter
|
||||
|
||||
FILES_COPY=(
|
||||
"CHANGELOG.md" "MANIFEST.in" "CREDITS.md" "LICENSE.md"
|
||||
"CONTRIBUTING.md" "CODE_OF_CONDUCT.md" "i18n" "novelwriter"
|
||||
"CONTRIBUTING.md" "CODE_OF_CONDUCT.md" "novelwriter"
|
||||
"novelWriter.py"
|
||||
)
|
||||
|
||||
@@ -114,7 +137,10 @@ rm -rf pkgs
|
||||
rm -rf cmake
|
||||
rm -rf share/{gtk-,}doc
|
||||
|
||||
#remove web engine
|
||||
# Remove the files from the 3.1 symlink
|
||||
rm -rf lib/python3.1
|
||||
|
||||
# remove web engine
|
||||
rm lib/python3.*/site-packages/PyQt5/QtWebEngine* || true
|
||||
rm -r lib/python3.*/site-packages/PyQt5/Qt/translations/qtwebengine* || true
|
||||
rm lib/python3.*/site-packages/PyQt5/Qt/resources/qtwebengine* || true
|
||||
|
||||
Reference in New Issue
Block a user