From ccef439f53b1f0a6ff860e74ccd29b2702cd6172 Mon Sep 17 00:00:00 2001
From: Howard Wu <40033067+Howard20181@users.noreply.github.com>
Date: Wed, 7 Feb 2024 20:56:41 +0800
Subject: [PATCH] Fix arm64 build
---
scripts/build.sh | 4 +-
scripts/extractMagisk.py | 14 +-----
scripts/fixGappsProp.py | 93 ------------------------------------
scripts/generateGappsLink.py | 2 +-
4 files changed, 4 insertions(+), 109 deletions(-)
delete mode 100644 scripts/fixGappsProp.py
diff --git a/scripts/build.sh b/scripts/build.sh
index dbeb0e4..e3b9310 100755
--- a/scripts/build.sh
+++ b/scripts/build.sh
@@ -15,7 +15,7 @@
# You should have received a copy of the GNU Affero General Public License
# along with MagiskOnWSALocal. If not, see .
#
-# Copyright (C) 2023 LSPosed Contributors
+# Copyright (C) 2024 LSPosed Contributors
#
if [ ! "$BASH_VERSION" ]; then
@@ -420,8 +420,6 @@ if [ "$ROOT_SOL" = "magisk" ]; then
abort "Please install Magisk 26.0+"
fi
sudo chmod +x "../linker/$HOST_ARCH/linker64" || abort
- sudo patchelf --set-interpreter "../linker/$HOST_ARCH/linker64" "$WORK_DIR/magisk/magiskpolicy" || abort
- chmod +x "$WORK_DIR/magisk/magiskpolicy" || abort
chmod +x "$WORK_DIR/magisk/magiskboot" || abort
elif [ -z "${CUSTOM_MAGISK+x}" ]; then
echo "The Magisk zip package does not exist, is the download incomplete?"
diff --git a/scripts/extractMagisk.py b/scripts/extractMagisk.py
index 82e0430..b5a80df 100644
--- a/scripts/extractMagisk.py
+++ b/scripts/extractMagisk.py
@@ -15,7 +15,7 @@
# You should have received a copy of the GNU Affero General Public License
# along with MagiskOnWSALocal. If not, see .
#
-# Copyright (C) 2023 LSPosed Contributors
+# Copyright (C) 2024 LSPosed Contributors
#
import sys
@@ -73,15 +73,5 @@ with zipfile.ZipFile(magisk_zip) as zip:
environ_file.write(str(env))
extract_as(zip, f"lib/{ abi_map[arch][0] }/libmagisk64.so", "magisk64", "magisk")
extract_as(zip, f"lib/{ abi_map[arch][1] }/libmagisk32.so", "magisk32", "magisk")
- standalone_policy = False
- try:
- zip.getinfo(f"lib/{ abi_map[arch][0] }/libmagiskpolicy.so")
- standalone_policy = True
- except:
- pass
- if standalone_policy:
- extract_as(zip, f"lib/{ abi_map[arch][0] }/libmagiskpolicy.so", "magiskpolicy", "magisk")
- else:
- extract_as(zip, f"lib/{ abi_map[arch][0] }/libmagiskinit.so", "magiskpolicy", "magisk")
extract_as(zip, f"lib/{ abi_map[arch][0] }/libmagiskinit.so", "magiskinit", "magisk")
- extract_as(zip, f"lib/{ abi_map[arch][0] }/libmagiskboot.so", "magiskboot", "magisk")
+ extract_as(zip, f"lib/{ abi_map[host_abi][0] }/libmagiskboot.so", "magiskboot", "magisk")
diff --git a/scripts/fixGappsProp.py b/scripts/fixGappsProp.py
deleted file mode 100644
index 300b7e2..0000000
--- a/scripts/fixGappsProp.py
+++ /dev/null
@@ -1,93 +0,0 @@
-#!/usr/bin/python3
-#
-# This file is part of MagiskOnWSALocal.
-#
-# MagiskOnWSALocal is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# MagiskOnWSALocal is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with MagiskOnWSALocal. If not, see .
-#
-# Copyright (C) 2023 LSPosed Contributors
-#
-
-from __future__ import annotations
-from io import TextIOWrapper
-from typing import OrderedDict
-from pathlib import Path
-import sys
-class Prop(OrderedDict):
- def __init__(self, file: TextIOWrapper) -> None:
- super().__init__()
- for i, line in enumerate(file.read().splitlines(False)):
- if '=' in line:
- k, v = line.split('=', 1)
- self[k] = v
- else:
- self[f".{i}"] = line
-
- def __str__(self) -> str:
- return '\n'.join([v if k.startswith('.') else f"{k}={v}" for k, v in self.items()])
-
- def __iadd__(self, other: str) -> Prop:
- self[f".{len(self)}"] = other
- return self
-
-
-new_props = {
- ("product", "brand"): "google",
- ("product", "manufacturer"): "Google",
- ("build", "product"): "redfin",
- ("product", "name"): "redfin",
- ("product", "device"): "redfin",
- ("product", "model"): "Pixel 5",
- ("build", "flavor"): "redfin-user"
-}
-
-
-def description(sec: str, p: Prop) -> str:
- return f"{p[f'ro.{sec}.build.flavor']} {p[f'ro.{sec}.build.version.release_or_codename']} {p[f'ro.{sec}.build.id']} {p[f'ro.{sec}.build.version.incremental']} {p[f'ro.{sec}.build.tags']}"
-
-
-def fingerprint(sec: str, p: Prop) -> str:
- return f"""{p[f"ro.product.{sec}.brand"]}/{p[f"ro.product.{sec}.name"]}/{p[f"ro.product.{sec}.device"]}:{p[f"ro.{sec}.build.version.release"]}/{p[f"ro.{sec}.build.id"]}/{p[f"ro.{sec}.build.version.incremental"]}:{p[f"ro.{sec}.build.type"]}/{p[f"ro.{sec}.build.tags"]}"""
-
-
-def fix_prop(sec, prop):
- if not Path(prop).is_file():
- return
-
- print(f"fixing {prop}", flush=True)
- with open(prop, 'r') as f:
- p = Prop(f)
-
- p += "# extra prop added by MagiskOnWSA"
-
- for k, v in new_props.items():
- p[f"ro.{k[0]}.{k[1]}"] = v
-
- if k[0] == "build":
- p[f"ro.{sec}.{k[0]}.{k[1]}"] = v
- elif k[0] == "product":
- p[f"ro.{k[0]}.{sec}.{k[1]}"] = v
-
- p["ro.build.description"] = description(sec, p)
- p[f"ro.build.fingerprint"] = fingerprint(sec, p)
- p[f"ro.{sec}.build.description"] = description(sec, p)
- p[f"ro.{sec}.build.fingerprint"] = fingerprint(sec, p)
- p[f"ro.bootimage.build.fingerprint"] = fingerprint(sec, p)
-
- with open(prop, 'w') as f:
- f.write(str(p))
-
-
-sys_path = sys.argv[1]
-for sec, prop in {"system": sys_path+"/system/build.prop", "product": sys_path+"/product/build.prop", "system_ext": sys_path+"/system_ext/build.prop", "vendor": sys_path+"/vendor/build.prop", "odm": sys_path+"/vendor/odm/etc/build.prop"}.items():
- fix_prop(sec, prop)
diff --git a/scripts/generateGappsLink.py b/scripts/generateGappsLink.py
index 3116ed3..97239e2 100644
--- a/scripts/generateGappsLink.py
+++ b/scripts/generateGappsLink.py
@@ -15,7 +15,7 @@
# You should have received a copy of the GNU Affero General Public License
# along with MagiskOnWSALocal. If not, see .
#
-# Copyright (C) 2023 LSPosed Contributors
+# Copyright (C) 2024 LSPosed Contributors
#
from datetime import datetime