Skip to content

Commit

Permalink
Fixed Xcode compiling and drivers (OcQuirks)
Browse files Browse the repository at this point in the history
  • Loading branch information
Dids committed May 25, 2020
1 parent fc2c768 commit 0f6c9a8
Show file tree
Hide file tree
Showing 10 changed files with 174 additions and 31 deletions.
28 changes: 17 additions & 11 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ var Hiss bool
var patchBuildPkg = true

// Controls whether to patch ebuild.sh or not
// var patchEbuild = true
var patchEbuild = false // NOTE: This is no longer necessary

// Create a new logger
var log = logrus.New()
Expand Down Expand Up @@ -290,6 +290,9 @@ var rootCmd = &cobra.Command{
}
Spinner.Prefix = formatSpinnerText("Linking nasm", true)
}

// FIXME: GCC building doesn't work yet
// Build with GCC instead of XCODE
if Toolchain != "XCODE8" {
if err := runCommand("mkdir -p "+util.GetSourcePath()+"/opt/local/cross/bin", ""); err != nil {
log.Fatal("Error: Failure detected, aborting\n", err)
Expand Down Expand Up @@ -337,12 +340,13 @@ var rootCmd = &cobra.Command{
if err := runCommand("git describe --tags | tr -d '\n' > vers.txt", util.GetCloverPath()); err != nil {
log.Fatal("Error: Failure detected, aborting\n", err)
}
// NOTE: This is no longer necessary
// Patch old vers.txt logic back in to ebuild.sh
// if patchEbuild {
// if err := patches.Patch(packedPatches, "ebuild", util.GetCloverPath()+"/ebuild.sh"); err != nil {
// log.Fatal("Error: Failure detected, aborting\n", err)
// }
// }
if patchEbuild {
if err := patches.Patch(packedPatches, "ebuild", util.GetCloverPath()+"/ebuild.sh"); err != nil {
log.Fatal("Error: Failure detected, aborting\n", err)
}
}
Spinner.Prefix = formatSpinnerText("Patching Clover", true)

// Build Clover (clean & build, with extras like ApfsDriverLoader checked out and compiled)
Expand Down Expand Up @@ -400,6 +404,7 @@ var rootCmd = &cobra.Command{
if err := util.DownloadFile(getGitHubReleaseLink("https://api.github.com/repos/ReddestDream/OcQuirks/releases/latest", "browser_download_url.*.zip"), os.TempDir()+"OcQuirks.zip"); err != nil {
log.Fatal("Error: Failed to update extra EFI drivers (download OcQuirks): ", err)
}
log.Debug("Downloaded OcQuirks to ", os.TempDir()+"OcQuirks.zip")
defer os.RemoveAll(os.TempDir() + "OcQuirks.zip")

// Extract Acidanthera drivers
Expand All @@ -419,6 +424,7 @@ var rootCmd = &cobra.Command{
if err := archiver.Unarchive(os.TempDir()+"OcQuirks.zip", os.TempDir()+"OcQuirks"); err != nil {
log.Fatal("Error: Failed to update extra EFI drivers (unzip OcQuirks): ", err)
}
log.Debug("Unzipped OcQuirks to ", os.TempDir()+"OcQuirks")
defer os.RemoveAll(os.TempDir() + "OcQuirks")

// Copy ApfsDriverLoader.efi
Expand Down Expand Up @@ -454,8 +460,8 @@ var rootCmd = &cobra.Command{

// Copy everything from OcQuirks
// if err := util.CopyFile(os.TempDir()+"OcQuirks/OcQuirks/OcQuirks.efi", util.GetCloverPath()+"/CloverPackage/CloverV2/EFI/CLOVER/drivers/UEFI/OcQuirks.efi"); err != nil {
// if err := util.CopyFiles(os.TempDir()+"OcQuirks/OcQuirks", util.GetCloverPath()+"/CloverPackage/CloverV2/EFI/CLOVER/drivers/UEFI"); err != nil {
if err := util.CopyFiles(os.TempDir()+"OcQuirks", util.GetCloverPath()+"/CloverPackage/CloverV2/EFI/CLOVER/drivers/UEFI"); err != nil {
if err := util.CopyFiles(os.TempDir()+"OcQuirks/OcQuirks", util.GetCloverPath()+"/CloverPackage/CloverV2/EFI/CLOVER/drivers/UEFI"); err != nil {
// if err := util.CopyFiles(os.TempDir()+"OcQuirks", util.GetCloverPath()+"/CloverPackage/CloverV2/EFI/CLOVER/drivers/UEFI"); err != nil {
log.Fatal("Error: Failed to update extra EFI drivers (copy OcQuirks): ", err)
}

Expand Down Expand Up @@ -515,7 +521,7 @@ var rootCmd = &cobra.Command{

// Patch the Clover installer package
if patchBuildPkg {
if patchErr := patches.Patch(packedPatches, "buildpkg6", util.GetCloverPath()+"/CloverPackage/package/buildpkg.sh"); patchErr != nil {
if patchErr := patches.Patch(packedPatches, "buildpkg", util.GetCloverPath()+"/CloverPackage/package/buildpkg.sh"); patchErr != nil {
log.Fatal("Error: Failed to patch Clover installer (patch buildpkg.sh): ", patchErr)
}
}
Expand Down Expand Up @@ -601,8 +607,8 @@ func init() {
rootCmd.PersistentFlags().BoolVarP(&UpdateOnly, "update-only", "u", false, "only update (no build)")
rootCmd.PersistentFlags().BoolVarP(&InstallerOnly, "installer-only", "i", false, "only build the installer")
rootCmd.PersistentFlags().BoolVarP(&NoClean, "no-clean", "n", false, "skip cleaning of dirty files")
//rootCmd.PersistentFlags().StringVarP(&Toolchain, "toolchain", "t", "XCODE8", "toolchain to use for building")
rootCmd.PersistentFlags().StringVarP(&Toolchain, "toolchain", "t", "GCC53", "toolchain to use for building")
rootCmd.PersistentFlags().StringVarP(&Toolchain, "toolchain", "t", "XCODE8", "toolchain to use for building")
// rootCmd.PersistentFlags().StringVarP(&Toolchain, "toolchain", "t", "GCC53", "toolchain to use for building")
rootCmd.PersistentFlags().BoolVarP(&Hiss, "hiss", "", false, "that's Sir Hiss to you")
}

Expand Down
5 changes: 3 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,11 @@ require (
github.com/x-cray/logrus-prefixed-formatter v0.5.2
github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 // indirect
golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37
golang.org/x/net v0.0.0-20200513185701-a91f0712d120 // indirect
golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2 // indirect
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d // indirect
golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a // indirect
golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9 // indirect
golang.org/x/sys v0.0.0-20200523222454-059865788121 // indirect
golang.org/x/tools v0.0.0-20200522201501-cb1345f3a375 // indirect
google.golang.org/appengine v1.6.6 // indirect
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect
gopkg.in/natefinch/lumberjack.v2 v2.0.0
Expand Down
8 changes: 8 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ github.com/gobuffalo/logger v1.0.3 h1:YaXOTHNPCvkqqA7w05A4v0k2tCdpr+sgFlgINbQ6gq
github.com/gobuffalo/logger v1.0.3/go.mod h1:SoeejUwldiS7ZsyCBphOGURmWdwUFXs0J7TCjEhjKxM=
github.com/gobuffalo/packd v1.0.0 h1:6ERZvJHfe24rfFmA9OaoKBdC7+c9sydrytMg8SdFGBM=
github.com/gobuffalo/packd v1.0.0/go.mod h1:6VTc4htmJRFB7u1m/4LeMTWjFoYrUiBkU9Fdec9hrhI=
github.com/gobuffalo/packr v1.30.1 h1:hu1fuVR3fXEZR7rXNW3h8rqSML8EVAf6KNm0NKO/wKg=
github.com/gobuffalo/packr/v2 v2.8.0 h1:IULGd15bQL59ijXLxEvA5wlMxsmx/ZkQv9T282zNVIY=
github.com/gobuffalo/packr/v2 v2.8.0/go.mod h1:PDk2k3vGevNE3SwVyVRgQCCXETC9SaONCNSXT1Q8M1g=
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
Expand Down Expand Up @@ -220,6 +221,7 @@ github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 h1:nIPpBwaJSVYIxUFsDv3M8ofm
github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8/go.mod h1:HUYIGzjTL3rfEspMxjDjgmT5uz5wzYJKVo23qUhYTos=
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU=
github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q=
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0=
Expand Down Expand Up @@ -248,6 +250,8 @@ golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLL
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200513185701-a91f0712d120 h1:EZ3cVSzKOlJxAd8e8YAJ7no8nNypTxexh/YE/xW3ZEY=
golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2 h1:eDrdRpKgkcCqKZQwyZRyeFZgfqt37SL7Kv3tok06cKE=
golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20181106182150-f42d05182288 h1:JIqe8uIcRBHXDQVvZtHwp80ai3Lw3IJAeJEs55Dc1W0=
golang.org/x/oauth2 v0.0.0-20181106182150-f42d05182288/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
Expand Down Expand Up @@ -277,6 +281,8 @@ golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9 h1:YTzHMGlqJu67/uEo1lBv0n3wBXhXNeUbB1XfN2vmTm0=
golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200523222454-059865788121 h1:rITEj+UZHYC927n8GT97eC3zrpzXdb/voyeOuVKS46o=
golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
Expand All @@ -288,6 +294,8 @@ golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20200308013534-11ec41452d41 h1:9Di9iYgOt9ThCipBxChBVhgNipDoE5mxO84rQV7D0FE=
golang.org/x/tools v0.0.0-20200308013534-11ec41452d41/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw=
golang.org/x/tools v0.0.0-20200522201501-cb1345f3a375 h1:SjQ2+AKWgZLc1xej6WSzL+Dfs5Uyd5xcZH1mGC411IA=
golang.org/x/tools v0.0.0-20200522201501-cb1345f3a375/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
Expand Down
97 changes: 97 additions & 0 deletions patches/buildpkg.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
--- buildpkg.sh
+++ buildpkg.sh
@@ -12,6 +12,15 @@
# Prevent the script from doing bad things
set -u # Abort with unset variables
#set -x
+
+isDefaultPackage () {
+ local packageRefId="${1}"
+ if [[ $packageRefId =~ ^(.*)(apfsdriverloader|aptiomemoryfix|hfsplus)(.*)$ ]]; then
+ return 0
+ else
+ return 1
+ fi
+}

usage () {
printf "\n\e[1m%s\e[0m" "Usage: $0 --srcroot <path> --symroot <name> --builddir <path> [flag1 flag2...]"
@@ -530,7 +539,7 @@
--subst="INSTALLER_CHOICE=$packageRefId" MarkChoice
buildpackage "$packageRefId" "${choiceId}" "${PKG_BUILD_DIR}/${choiceId}" "/EFIROOTDIR"
if [[ ${NOEXTRAS} != *"CloverEFI"* ]]; then
- addChoice --start-visible="true" --start-selected="choicePreviouslySelected('$packageRefId')" \
+ addChoice --start-visible="true" --start-selected="cloverPackageFirstRun() || choicePreviouslySelected('$packageRefId')" \
--pkg-refs="$packageRefId" "${choiceId}"
else
addChoice --start-visible="false" --start-selected="true" \
@@ -850,12 +859,22 @@
# (i.e. Clover package never run on that target partition).
# Otherwise each single choice start selected only for legacy Clover and only if you previously selected it
buildpackage "$packageRefId" "${driverChoice}" "${PKG_BUILD_DIR}/${driverChoice}" "${driverDestDir}"
- addChoice --group="Recommended64" \
+ if isDefaultPackage "$packageRefId"; then
+ addChoice --group="Recommended64" \
--start-visible="true" \
--enabled="!choices['UEFI.only'].selected" \
- --start-selected="!choices['UEFI.only'].selected &amp;&amp; (cloverPackageFirstRun() || choicePreviouslySelected('$packageRefId'))" \
+ --start-selected="!choices['UEFI.only'].selected" \
--visible="!choices['UEFI.only'].selected" \
--pkg-refs="$packageRefId" "${driverChoice}"
+ else
+ addChoice --group="Recommended64" \
+ --start-visible="true" \
+ --enabled="!choices['UEFI.only'].selected" \
+ --start-selected="!choices['UEFI.only'].selected &amp;&amp; (choicePreviouslySelected('$packageRefId'))" \
+ --visible="!choices['UEFI.only'].selected" \
+ --pkg-refs="$packageRefId" "${driverChoice}"
+ fi
+
rm -R -f "${PKG_BUILD_DIR}/${driverChoice}"
done
fi
@@ -992,7 +1011,7 @@
addGroupChoices --title="Drivers64UEFI" --description="Drivers64UEFI" "Drivers64UEFI"
addGroupChoices --title="Recommended64UEFI" --description="Recommended64UEFI" --parent=Drivers64UEFI "Recommended64UEFI"
packagesidentity="${clover_package_identity}".drivers64UEFI.mandatory
- local drivers=($( find "${SRCROOT}/CloverV2/EFI/CLOVER/drivers/$DRIVERS_UEFI" -type f -name '*.efi' -depth 1 | sort -f ))
+ local drivers=($( find "${SRCROOT}/CloverV2/EFI/CLOVER/drivers/$DRIVERS_UEFI" -type f -name '*.efi' -o -name '*.plist' -depth 1 | sort -f ))
local driverDestDir="/EFIROOTDIR/EFI/CLOVER/drivers/$DRIVERS_UEFI"
for (( i = 0 ; i < ${#drivers[@]} ; i++ ))
do
@@ -1016,10 +1035,17 @@
fi

buildpackage "$packageRefId" "${driverChoice}" "${PKG_BUILD_DIR}/${driverChoice}" "${driverDestDir}"
- addChoice --group="Recommended64UEFI" \
+ if isDefaultPackage "$packageRefId"; then
+ addChoice --group="Recommended64UEFI" \
--start-visible="true" \
- --start-selected="cloverPackageFirstRun() || choicePreviouslySelected('$packageRefId')" \
+ --start-selected="true" \
--pkg-refs="$packageRefId" "${driverChoice}"
+ else
+ addChoice --group="Recommended64UEFI" \
+ --start-visible="true" \
+ --start-selected="choicePreviouslySelected('$packageRefId')" \
+ --pkg-refs="$packageRefId" "${driverChoice}"
+ fi
rm -R -f "${PKG_BUILD_DIR}/${driverChoice}"
done
fi
@@ -1369,7 +1395,6 @@
for (( i = 0 ; i < ${#specialThemes[@]} ; i++ )); do
local themeName=${specialThemes[$i]##*/}
# Don't add christmas and newyear themes if month < 11
- [[ $currentMonth -lt 11 ]] && [[ "$themeName" == christmas || "$themeName" == newyear ]] && continue
mkdir -p "${PKG_BUILD_DIR}/${themeName}/Root/"
rsync -r --exclude=.svn --exclude="*~" "$artwork/${specialThemes[$i]}/" "${PKG_BUILD_DIR}/${themeName}/Root/${themeName}"
packageRefId=$(getPackageRefId "${packagesidentity}" "${themeName}")
@@ -1379,7 +1404,7 @@
InstallTheme

buildpackage "$packageRefId" "${themeName}" "${PKG_BUILD_DIR}/${themeName}" "${themeDestDir}"
- addChoice --start-visible="false" --start-selected="true" --pkg-refs="$packageRefId" "${themeName}"
+ addChoice --group="Themes" --start-visible="true" --start-selected="choicePreviouslySelected('$packageRefId')" --pkg-refs="$packageRefId" "${themeName}"
done
fi
File renamed without changes.
2 changes: 1 addition & 1 deletion patches/root_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ var packedPatches = packr.New("patches", "../patches")
var packedAssets = packr.New("assets", "../assets")

func TestPackedPatches(t *testing.T) {
if _, err := packedPatches.FindString("buildpkg6.patch"); err != nil {
if _, err := packedPatches.FindString("buildpkg.patch"); err != nil {
t.Errorf("Failed to load packr asset: %s", err)
}
}
Expand Down
11 changes: 2 additions & 9 deletions vendor/golang.org/x/sys/windows/env_windows.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 15 additions & 5 deletions vendor/golang.org/x/sys/windows/security_windows.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 29 additions & 1 deletion vendor/golang.org/x/sys/windows/syscall_windows.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,13 @@ golang.org/x/crypto/openpgp/errors
golang.org/x/crypto/openpgp/packet
golang.org/x/crypto/openpgp/s2k
golang.org/x/crypto/ssh/terminal
# golang.org/x/net v0.0.0-20200513185701-a91f0712d120
# golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2
golang.org/x/net/context
golang.org/x/net/context/ctxhttp
# golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d
golang.org/x/oauth2
golang.org/x/oauth2/internal
# golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9
# golang.org/x/sys v0.0.0-20200523222454-059865788121
golang.org/x/sys/internal/unsafeheader
golang.org/x/sys/unix
golang.org/x/sys/windows
Expand Down

0 comments on commit 0f6c9a8

Please sign in to comment.