Updated build scripts

This commit is contained in:
Frode Solheim 2021-10-19 18:37:44 +02:00
parent 560e3ec196
commit f2aec0684c
15 changed files with 417 additions and 45 deletions

121
.github/workflows/linux.yml vendored Normal file
View file

@ -0,0 +1,121 @@
name: Linux
on:
push:
branches:
- master
- beta
- stable
pull_request:
branches:
- master
- beta
- stable
jobs:
Linux_x86-64:
runs-on: ubuntu-18.04
env:
UPLOAD_ENABLED: ${{ secrets.DROPBOX_ACCESS_TOKEN }}
steps:
- name: Update package repositories
run: >-
sudo apt update
- name: Install deb packages
run: >-
sudo apt install
dos2unix
gettext
intltool
libao-dev
libasound2-dev
libevdev-dev
libgbm-dev
libgl-dev
libglu-dev
libopenal-dev
libpulse-dev
libudev-dev
libusb-1.0-0-dev
libx11-dev
libx11-xcb-dev
libxcb1-dev
libxcb-glx0-dev
libxcb-icccm4-dev
libxcb-image0-dev
libxcb-keysyms1-dev
libxcb-randr0-dev
libxcb-render-util0-dev
libxcb-shape0-dev
libxcb-shm0-dev
libxcb-sync0-dev
libxcb-xfixes0-dev
libxcb-xinerama0-dev
libxcursor-dev
libxext-dev
libxfixes-dev
libxi-dev
libxinerama-dev
libxrandr-dev
libxrender-dev
x11proto-dev
- name: Install pip packages
run: |
sudo python3 -m pip install -U pip setuptools
sudo python3 -m pip install -U meson ninja
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Cache dependencies
uses: actions/cache@v2
id: fsdeps_cache
with:
path: fsdeps/_prefix
key: fsdeps_${{ hashFiles('fsdeps/**/*') }}_${{ runner.os }}
- name: Build dependencies
if: steps.fsdeps_cache.outputs.cache-hit != 'true'
run: fsdeps/make
- name: Update version
run: fsbuild/version --update --auto
- name: Bootstrap
run: fsdeps/use fsbuild/bootstrap
- name: Configure
run: fsdeps/use fsbuild/configure
- name: Make
run: fsdeps/use fsbuild/make
- name: Bundle
run: fsdeps/use fsbuild/bundle
- name: Archive
run: fsbuild/archive
- uses: actions/upload-artifact@v2
with:
name: Linux_x86-64
path: fsbuild/_dist/*
- name: Upload build to Dropbox folder
if: >-
env.UPLOAD_ENABLED != null && (
github.ref == 'refs/heads/master' ||
github.ref == 'refs/heads/dev' ||
github.ref == 'refs/heads/stable'
)
run: |
python3 -m pip install dropbox
fsbuild/upload
env:
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }}
DROPBOX_ACCESS_TOKEN: ${{ secrets.DROPBOX_ACCESS_TOKEN }}

103
.github/workflows/macos.yml vendored Normal file
View file

@ -0,0 +1,103 @@
name: macOS
on:
push:
branches:
- master
- beta
- stable
pull_request:
branches:
- master
- beta
- stable
jobs:
macOS_x86-64:
runs-on: macos-10.15
env:
SIGNING_ENABLED: ${{ secrets.MACOS_CERTIFICATE_P12_DATA }}
UPLOAD_ENABLED: ${{ secrets.DROPBOX_ACCESS_TOKEN }}
steps:
- name: Install brew packages
run: brew install autoconf automake dos2unix meson
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Cache dependencies
uses: actions/cache@v2
id: fsdeps_cache
with:
path: fsdeps/_prefix
key: fsdeps_${{ hashFiles('fsdeps/**/*') }}_${{ runner.os }}
- name: Build dependencies
if: steps.fsdeps_cache.outputs.cache-hit != 'true'
run: fsdeps/make
- name: Update version
run: fsbuild/version --update --auto
- name: Bootstrap
run: fsdeps/use fsbuild/bootstrap
- name: Configure
run: fsdeps/use fsbuild/configure
- name: Make
run: fsdeps/use fsbuild/make
- name: Bundle
run: fsbuild/bundle
- name: Prepare signing certificate
if: env.SIGNING_ENABLED != null
run: |
echo $SIGNING_CERTIFICATE_P12_DATA | base64 --decode > certificate.p12
security create-keychain -p $KEYCHAIN_PASSWORD build.keychain
security default-keychain -s build.keychain
security unlock-keychain -p $KEYCHAIN_PASSWORD build.keychain
security import certificate.p12 -k build.keychain -P $SIGNING_CERTIFICATE_PASSWORD -T /usr/bin/codesign
security set-key-partition-list -S apple-tool:,apple: -s -k $KEYCHAIN_PASSWORD build.keychain
env:
KEYCHAIN_PASSWORD: ${{ secrets.MACOS_CERTIFICATE_PASSWORD }}
SIGNING_CERTIFICATE_P12_DATA: ${{ secrets.MACOS_CERTIFICATE_P12_DATA }}
SIGNING_CERTIFICATE_PASSWORD: ${{ secrets.MACOS_CERTIFICATE_PASSWORD }}
- name: Sign
if: env.SIGNING_ENABLED != null
run: fsbuild/sign
- name: Notarize
if: env.SIGNING_ENABLED != null
run: fsbuild/notarize
env:
NOTARIZATION_PASSWORD: ${{ secrets.MACOS_NOTARIZATION_PASSWORD }}
NOTARIZATION_PROVIDER: ${{ secrets.MACOS_NOTARIZATION_PROVIDER }}
NOTARIZATION_USERNAME: ${{ secrets.MACOS_NOTARIZATION_USERNAME }}
- name: Archive
run: fsbuild/archive
- uses: actions/upload-artifact@v2
with:
name: macOS_x86-64
path: fsbuild/_dist/*
- name: Upload build to Dropbox folder
if: >-
env.UPLOAD_ENABLED != null && (
github.ref == 'refs/heads/master' ||
github.ref == 'refs/heads/dev' ||
github.ref == 'refs/heads/stable'
)
run: |
python3 -m pip install dropbox
fsbuild/upload
env:
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }}
DROPBOX_ACCESS_TOKEN: ${{ secrets.DROPBOX_ACCESS_TOKEN }}

102
.github/workflows/windows.yml vendored Normal file
View file

@ -0,0 +1,102 @@
name: Windows
on:
push:
branches:
- master
- beta
- stable
pull_request:
branches:
- master
- beta
- stable
jobs:
Windows_x86-64:
runs-on: windows-2016
env:
UPLOAD_ENABLED: ${{ secrets.DROPBOX_ACCESS_TOKEN }}
defaults:
run:
shell: msys2 {0}
steps:
- uses: msys2/setup-msys2@v2
with:
update: true
install: >-
autoconf
automake
base-devel
gettext
git
libtool
make
mingw-w64-x86_64-cmake
mingw-w64-x86_64-gcc
mingw-w64-x86_64-ducible
mingw-w64-x86_64-icoutils
mingw-w64-x86_64-meson
mingw-w64-x86_64-openal
mingw-w64-x86_64-pkg-config
mingw-w64-x86_64-python
mingw-w64-x86_64-python-pip
mingw-w64-x86_64-python2
tar
unzip
zip
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Cache dependencies
uses: actions/cache@v2
id: fsdeps_cache
with:
path: fsdeps/_prefix
key: fsdeps_${{ hashFiles('fsdeps/**/*') }}_${{ runner.os }}
- name: Build dependencies
if: steps.fsdeps_cache.outputs.cache-hit != 'true'
run: fsdeps/make
- name: Update version
run: fsbuild/version --update --auto
- name: Bootstrap
run: fsdeps/use fsbuild/bootstrap
- name: Configure
run: fsdeps/use fsbuild/configure
- name: Make
run: fsdeps/use fsbuild/make
- name: Bundle
run: fsbuild/bundle
- name: Archive
run: fsbuild/archive
- uses: actions/upload-artifact@v2
with:
name: Windows_x86-64
path: fsbuild/_dist/*
- name: Upload build to Dropbox folder
if: >-
env.UPLOAD_ENABLED != null && (
github.ref == 'refs/heads/master' ||
github.ref == 'refs/heads/dev' ||
github.ref == 'refs/heads/stable'
)
run: |
python3 -m pip install dropbox
fsbuild/upload
env:
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }}
DROPBOX_ACCESS_TOKEN: ${{ secrets.DROPBOX_ACCESS_TOKEN }}

1
BASEVERSION.FS Normal file
View file

@ -0,0 +1 @@
5.1.1

View file

@ -3,8 +3,8 @@ PACKAGE_MACOS_BUNDLE_ID=dev.solheim.capsimg
PACKAGE_NAME=capsimg
PACKAGE_NAME_PRETTY=CAPSImg
PACKAGE_TYPE=fs-library-plugin
PACKAGE_VERSION=5.1.0.4-fs
PACKAGE_VERSION_MAJOR=5
PACKAGE_VERSION_MINOR=1
PACKAGE_VERSION=0.0.0
PACKAGE_VERSION_MAJOR=0
PACKAGE_VERSION_MINOR=0
PACKAGE_VERSION_REVISION=0
PACKAGE_VERSION_TAG=-fs
PACKAGE_VERSION_TAG=

View file

@ -3,6 +3,10 @@
set -e
if [ -f fsbuild/bootstrap.pre.sh ]; then
. fsbuild/bootstrap.pre.sh
fi
if [ -f fsbuild/bootstrap.sh ]; then
. fsbuild/bootstrap.sh
elif [ -f fsplugin/Makefile ]; then
@ -10,3 +14,7 @@ make -C fsplugin bootstrap
elif [ -f ./bootstrap ]; then
./bootstrap
fi
if [ -f fsbuild/bootstrap.post.sh ]; then
. fsbuild/bootstrap.post.sh
fi

View file

@ -3,7 +3,7 @@
set -e
rm -Rf fsbuild/_*
rm -Rf fsbuild/_[a-z]*
if [ -f fsbuild/clean.sh ]; then
. fsbuild/clean.sh

View file

@ -45,7 +45,7 @@ def main():
elif isMacOS():
notarizeForMacOS()
else:
print("Skipping sign step (No signatures for this platform")
print("Skipping sign step (no signatures for this platform)")
if __name__ == "__main__":

View file

@ -27,7 +27,7 @@ def main():
args.append(getBundlePath())
runCodeSign(args)
else:
print("Skipping sign step (No signatures for this platform")
print("Skipping sign step (no signatures for this platform)")
if __name__ == "__main__":

View file

@ -5,6 +5,7 @@ import os
import shutil
import subprocess
import sys
from typing import Dict, List, Set
strip = False
rpath = False
@ -14,11 +15,11 @@ no_copy = False
steam_runtime = False
excluded_libraries = {}
included_libraries = {}
excluded_libraries: Dict[str, Set[str]] = {}
included_libraries: Dict[str, Set[str]] = {}
def fix_linux_binary(path):
def fix_linux_binary(path: str):
changes = 0
if os.path.exists(path + ".standalone"):
return changes
@ -41,7 +42,7 @@ def fix_linux_binary(path):
return 0
data = p.stdout.decode("UTF-8")
print("fixing", path, "no_copy =", no_copy)
library_locations = {}
library_locations: Dict[str, str] = {}
for line in data.split("\n"):
line = line.strip()
if "=>" not in line:
@ -128,7 +129,7 @@ manylinux2014_whitelist = set(
)
def ignore_linux_library(name):
def ignore_linux_library(name: str):
if os.getenv("LIBGPG_ERROR_CHECK", "") != "0":
if name.startswith("libgpg-error.so"):
raise Exception(
@ -218,8 +219,8 @@ def ignore_linux_library(name):
return False
def linux_iteration(app):
binaries = []
def linux_iteration(app: str):
binaries: List[str] = []
binaries_dir = app
for name in sorted(os.listdir(binaries_dir)):
binaries.append(os.path.join(binaries_dir, name))
@ -251,7 +252,7 @@ def linux_main():
os.remove(os.path.join(app, name))
def fix_macos_binary(path, frameworks_dir):
def fix_macos_binary(path: str, frameworks_dir: str):
if path.endswith(".txt"):
return 0
print("fixing", path)
@ -278,7 +279,7 @@ def fix_macos_binary(path, frameworks_dir):
if "Contents" in old:
continue
print(old)
old_dir, name = os.path.split(old)
_, name = os.path.split(old)
# new = old.replace(old, "@executable_path/../Frameworks/" + name)
if rpath:
new = old.replace(old, "@rpath/" + name)
@ -311,8 +312,8 @@ def fix_macos_binary(path, frameworks_dir):
return changes
def macos_iteration(app):
binaries = []
def macos_iteration(app: str):
binaries: List[str] = []
if os.path.isdir(app):
# mac_os_dir = os.path.join(app, "Contents", "MacOS")
frameworks_dir = app
@ -331,7 +332,7 @@ def macos_iteration(app):
return changes
def fix_macos_binary_2(path, frameworks_dir):
def fix_macos_binary_2(path: str, frameworks_dir: str):
print("fixing", path)
changes = 0
if not os.path.exists(path):
@ -354,7 +355,7 @@ def fix_macos_binary_2(path, frameworks_dir):
if "Contents" in old:
continue
print(old)
old_dir, name = os.path.split(old)
_, name = os.path.split(old)
new = old.replace(old, "@executable_path/../Frameworks/" + name)
dst = os.path.join(frameworks_dir, os.path.basename(old))
if not os.path.exists(dst):
@ -373,8 +374,8 @@ def fix_macos_binary_2(path, frameworks_dir):
return changes
def macos_iteration_2(app):
binaries = []
def macos_iteration_2(app: str):
binaries: List[str] = []
mac_os_dir = os.path.join(app, "Contents", "MacOS")
frameworks_dir = os.path.join(app, "Contents", "Frameworks")
if not os.path.exists(frameworks_dir):
@ -438,8 +439,8 @@ windows_system_dlls = [
]
def fix_windows_binary(path, app_dir):
name, ext = os.path.splitext(os.path.basename(path))
def fix_windows_binary(path: str, app_dir: str):
_, ext = os.path.splitext(os.path.basename(path))
if ext.lower() not in [".dll", ".exe"]:
return 0
# if path.endswith(".txt"):
@ -502,8 +503,8 @@ def fix_windows_binary(path, app_dir):
return changes
def windows_iteration(app):
binaries = []
def windows_iteration(app: str):
binaries: List[str] = []
if os.path.isdir(app):
for name in sorted(os.listdir(app)):
binaries.append(os.path.join(app, name))

View file

@ -9,9 +9,10 @@ case "`uname`" in
esac
case "`uname -m`" in
x86_64*) SYSTEM_ARCH=x86-64;;
arm64*) SYSTEM_ARCH=ARM64;;
*) SYSTEM_ARCH=Unknown;;
x86_64*) SYSTEM_ARCH=x86-64;;
arm64*) SYSTEM_ARCH=ARM64;;
armv7l*) SYSTEM_ARCH=ARM;;
*) SYSTEM_ARCH=Unknown;;
esac
if [ $SYSTEM_OS = "Windows" ]; then
@ -25,6 +26,10 @@ fi
# FIXME: Deprecated alias
SYSTEM=$SYSTEM_OS
if [ "$FSBUILD_ARCH" != "" ]; then
SYSTEM_ARCH=$FSBUILD_ARCH
fi
if [ "$SYSTEM_OS_DIST" = "" ]; then
SYSTEM_OS_DIST=$SYSTEM_OS
fi

View file

@ -41,7 +41,7 @@ def upload_branch_name():
def upload(dbx, package, version, path):
print("Upload", path)
name = os.path.basename(path)
assert package in name
assert package.lower() in name.lower()
assert version in name
branch = upload_branch_name()
if not branch:

View file

@ -3,4 +3,12 @@
set -e
if [ -f fsbuild/version.pre.sh ]; then
. fsbuild/version.pre.sh
fi
python3 fsbuild/version.py "$@"
if [ -f fsbuild/version.post.sh ]; then
. fsbuild/version.post.sh
fi

View file

@ -151,8 +151,8 @@ def update_debian_changelog(version):
elif line.startswith(" -- ") and first_line_changed:
# Only update date if version was changed
author, date = line.split(" ")
date = datetime.datetime.now().strftime(
"%a, %e %b %Y %H:%M:%S %z"
date = datetime.datetime.utcnow().strftime(
"%a, %e %b %Y %H:%M:%S +00:00"
)
lines.append("{} {}\n".format(author, date))
else:
@ -229,16 +229,17 @@ def calculate_version(
auto_revision=False, increment_revision=False, include_commit=False
):
# with open("fsbuild/VERSION") as f:
# # with open("VERSION.FS") as f:
# version_str = f.read().strip()
with open("PACKAGE.FS") as f:
for line in f:
if line.startswith("PACKAGE_VERSION="):
version_str = line[16:].strip()
with open("BASEVERSION.FS") as f:
version_str = f.read().strip()
if version_str.startswith("BASEVERSION_FS="):
version_str = version_str[len("BASEVERSION_FS="):].strip()
# with open("PACKAGE.FS") as f:
# for line in f:
# if line.startswith("PACKAGE_VERSION="):
# version_str = line[16:].strip()
version = Version(version_str)
if auto_revision:
# version_commit = find_last_commit_for_file("VERSION.FS")
version_commit = find_last_commit_for_file("PACKAGE.FS")
version_commit = find_last_commit_for_file("BASEVERSION.FS")
increment = num_commits_since(version_commit)
if increment_revision:
increment += 1
@ -248,6 +249,25 @@ def calculate_version(
version.revision += increment
if "--commit" in sys.argv:
version.commit = find_last_commit()
if True:
branch = None
githubRef = os.environ.get("GITHUB_REF")
if githubRef is not None:
if githubRef.startswith("refs/heads/"):
branch = githubRef[len("refs/heads/"):]
if githubRef.startswith("refs/pull/"):
branch = "pull" + githubRef[len("refs/pull/"):].replace("/", "")
if not branch:
branch = subprocess.check_output(["git", "symbolic-ref", "--short", "HEAD"], encoding="UTF-8").strip()
if branch == "stable":
version.tag = ""
elif branch:
version.tag = f"-{branch}"
else:
raise Exception("Cannot calculate version tag from git ref")
return version
@ -271,9 +291,11 @@ def main():
# For date/time formatting
locale.setlocale(locale.LC_TIME, "C")
auto_revision = "--auto" in sys.argv
# auto_revision = "--auto" in sys.argv
auto_revision = True
increment_revision = "--next" in sys.argv
include_commit = "--commit" in sys.argv
# include_commit = "--commit" in sys.argv
include_commit = True
# if "--auto-next" in sys.argv:
# auto_revision = True
# increment_revision = True

View file

@ -9,9 +9,10 @@ case "`uname`" in
esac
case "`uname -m`" in
x86_64*) SYSTEM_ARCH=x86-64;;
arm64*) SYSTEM_ARCH=ARM64;;
*) SYSTEM_ARCH=Unknown;;
x86_64*) SYSTEM_ARCH=x86-64;;
arm64*) SYSTEM_ARCH=ARM64;;
armv7l*) SYSTEM_ARCH=ARM;;
*) SYSTEM_ARCH=Unknown;;
esac
# FIXME: Deprecated alias