Skip to content

Commit

Permalink
Updated dependencies, fixed OcQuirks support and added initial toolch…
Browse files Browse the repository at this point in the history
…ain support
  • Loading branch information
Dids committed Dec 21, 2019
1 parent b09f0ab commit c152ee3
Show file tree
Hide file tree
Showing 119 changed files with 42,266 additions and 37,225 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ The reason for this prompt comes from building `gettext`, so it's an unfortunate
You can also install the latest development version:
> brew install clobber --HEAD
If you want to use gcc instead of Xcode as the toolchain, install clobber with the following flag:
> brew install clobber --with-gcc
### Usage

Build the latest version of Clover:
Expand All @@ -29,6 +32,9 @@ Build the latest version of Clover:
Build a specific Clover version/revision:
> clobber --revision 1234
Build Clover with a different toolchain:
> clobber --toolchain GCC53
View all the available options:
> clobber --help
Expand Down
48 changes: 38 additions & 10 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ var InstallerOnly bool
// NoClean skips cleaning of dirty files
var NoClean bool

// Toolchain to use when building Clover
var Toolchain string

// Spinner is the CLI spinner/activity indicator
var Spinner = spinner.New(spinner.CharSets[14], 100*time.Millisecond)

Expand Down Expand Up @@ -253,6 +256,7 @@ var rootCmd = &cobra.Command{
log.Fatal("Error: Failure detected, aborting\n", err)
}
if err := runCommand("ln -sf /usr/local/bin/gettext "+util.GetSourcePath()+"/opt/local/bin/gettext", ""); err != nil {
// if err := runCommand("ln -sf $(which gettext) "+util.GetSourcePath()+"/opt/local/bin/gettext", ""); err != nil {
log.Fatal("Error: Failure detected, aborting\n", err)
}
Spinner.Prefix = formatSpinnerText("Linking gettext", true)
Expand All @@ -268,7 +272,7 @@ var rootCmd = &cobra.Command{
if _, err := os.Stat(util.GetSourcePath() + "/opt/local/bin/nasm"); os.IsNotExist(err) {
log.Debug("Linking nasm..")
Spinner.Prefix = formatSpinnerText("Linking nasm", false)

// TODO: This could be done better, checking if linking/unlinking is even necessary
if err := runCommand("brew link nasm --force --overwrite", ""); err != nil {
log.Fatal("Error: Failure detected, aborting\n", err)
}
Expand All @@ -277,10 +281,32 @@ var rootCmd = &cobra.Command{
log.Fatal("Error: Failure detected, aborting\n", err)
}
if err := runCommand("ln -sf /usr/local/bin/nasm "+util.GetSourcePath()+"/opt/local/bin/nasm", ""); err != nil {
// if err := runCommand("ln -sf $(which nasm) "+util.GetSourcePath()+"/opt/local/bin/nasm", ""); err != nil {
log.Fatal("Error: Failure detected, aborting\n", err)
}
Spinner.Prefix = formatSpinnerText("Linking nasm", true)
}
if Toolchain != "XCODE8" {
if err := runCommand("mkdir -p "+util.GetSourcePath()+"/opt/local/cross/bin", ""); err != nil {
log.Fatal("Error: Failure detected, aborting\n", err)
}
if _, err := os.Stat(util.GetSourcePath() + "/opt/local/cross/bin/x86_64-clover-linux-gnu-gcc"); os.IsNotExist(err) {
log.Debug("Linking gcc..")
Spinner.Prefix = formatSpinnerText("Linking gcc", false)
if err := runCommand("ln -sf /usr/local/bin/gcc-9 "+util.GetSourcePath()+"/opt/local/cross/bin/x86_64-clover-linux-gnu-gcc", ""); err != nil {
// if err := runCommand("ln -sf $(which gcc) "+util.GetSourcePath()+"/opt/local/cross/bin/x86_64-clover-linux-gnu-gcc", ""); err != nil {
log.Fatal("Error: Failure detected, aborting\n", err)
}
Spinner.Prefix = formatSpinnerText("Linking gcc", true)
}

// TODO: Add "x86_64-clover-linux-gnu-gcc" to PATH
os.Setenv("PATH", os.Getenv("PATH")+":"+util.GetSourcePath()+"/opt/local/cross/bin")
log.Info("Path:", os.Getenv("PATH"))

// FIXME: ccache: error: Could not find compiler "x86_64-clover-linux-gnu-gcc" in PATH
os.Setenv("GCC53_BIN", "gcc")
}

// Patch Clover.dsc (eg. skip building ApfsDriverLoader)
log.Debug("Patching Clover..")
Expand Down Expand Up @@ -310,15 +336,15 @@ var rootCmd = &cobra.Command{
log.Debug("Building Clover..")
Spinner.Prefix = formatSpinnerText("Building Clover", false)
// TODO: Shouldn't this technically be ignored when using --no-clean?
if err := runCommand("source edksetup.sh BaseTools; ./ebuild.sh -cleanall || true", util.GetCloverPath()); err != nil {
if err := runCommand("source edksetup.sh BaseTools; ./ebuild.sh -cleanall -t "+Toolchain+" || true", util.GetCloverPath()); err != nil {
log.Fatal("Error: Failure detected, aborting\n", err)
}
// 64-bit (boot6, default)
if err := runCommand("source edksetup.sh BaseTools; ./ebuild.sh -fr -D NO_GRUB_DRIVERS_EMBEDDED", util.GetCloverPath()); err != nil {
if err := runCommand("source edksetup.sh BaseTools; ./ebuild.sh -fr -D NO_GRUB_DRIVERS_EMBEDDED -t "+Toolchain, util.GetCloverPath()); err != nil {
log.Fatal("Error: Failure detected, aborting\n", err)
}
// 64-bit (boot7, MCP/BiosBlockIO)
if err := runCommand("source edksetup.sh BaseTools; ./ebuild.sh -fr --x64-mcp --no-usb -D NO_GRUB_DRIVERS_EMBEDDED", util.GetCloverPath()); err != nil {
if err := runCommand("source edksetup.sh BaseTools; ./ebuild.sh -fr --x64-mcp --no-usb -D NO_GRUB_DRIVERS_EMBEDDED -t "+Toolchain, util.GetCloverPath()); err != nil {
log.Fatal("Error: Failure detected, aborting\n", err)
}
Spinner.Prefix = formatSpinnerText("Building Clover", true)
Expand Down Expand Up @@ -408,14 +434,15 @@ var rootCmd = &cobra.Command{
log.Fatal("Error: Failed to update extra EFI drivers (copy AptioMemoryFix.efi): ", err)
}

// Copy FwRuntimeServices.efi
if err := util.CopyFile(os.TempDir()+"OcQuirks/OcQuirks/FwRuntimeServices.efi", util.GetCloverPath()+"/CloverPackage/CloverV2/EFI/CLOVER/drivers/UEFI/FwRuntimeServices.efi"); err != nil {
log.Fatal("Error: Failed to update extra EFI drivers (copy FwRuntimeServices.efi): ", err)
// 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 {
log.Fatal("Error: Failed to update extra EFI drivers (copy OcQuirks): ", err)
}

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

Spinner.Prefix = formatSpinnerText("Updating extra EFI drivers", true)
Expand Down Expand Up @@ -555,6 +582,7 @@ 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().BoolVarP(&Hiss, "hiss", "", false, "that's Sir Hiss to you")
}

Expand Down
24 changes: 13 additions & 11 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,21 @@ go 1.12

require (
github.com/blang/semver v3.5.1+incompatible
github.com/briandowns/spinner v1.7.0
github.com/briandowns/spinner v1.8.0
github.com/common-nighthawk/go-figure v0.0.0-20190529165535-67e0ed34491a
github.com/dsnet/compress v0.0.1 // indirect
github.com/frankban/quicktest v1.4.0 // indirect
github.com/gobuffalo/envy v1.8.1 // indirect
github.com/gobuffalo/logger v1.0.3 // indirect
github.com/gobuffalo/packr/v2 v2.7.1
github.com/golang/protobuf v1.3.2 // indirect
github.com/golang/snappy v0.0.1 // indirect
github.com/google/go-cmp v0.3.1 // indirect
github.com/gopherjs/gopherjs v0.0.0-20190430165422-3e4dfb77656c // indirect
github.com/karrick/godirwalk v1.12.0 // indirect
github.com/mattn/go-colorable v0.1.4 // indirect
github.com/mattn/go-isatty v0.0.10 // indirect
github.com/mattn/go-runewidth v0.0.4 // indirect
github.com/mattn/go-isatty v0.0.11 // indirect
github.com/mattn/go-runewidth v0.0.7 // indirect
github.com/mcuadros/go-version v0.0.0-20190308113854-92cdf37c5b75 // indirect
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b // indirect
github.com/mholt/archiver v3.1.1+incompatible
Expand All @@ -27,9 +29,9 @@ require (
github.com/onsi/gomega v1.5.0 // indirect
github.com/otiai10/copy v1.0.1 // indirect
github.com/otiai10/curr v0.0.0-20190513014714-f5a3d24e5776 // indirect
github.com/pierrec/lz4 v2.3.0+incompatible // indirect
github.com/rhysd/go-github-selfupdate v1.1.0
github.com/rogpeppe/go-internal v1.5.0 // indirect
github.com/pierrec/lz4 v2.4.0+incompatible // indirect
github.com/rhysd/go-github-selfupdate v1.2.1
github.com/rogpeppe/go-internal v1.5.1 // indirect
github.com/sirupsen/logrus v1.4.2
github.com/smartystreets/assertions v1.0.1 // indirect
github.com/smartystreets/goconvey v0.0.0-20190731233626-505e41936337 // indirect
Expand All @@ -38,11 +40,11 @@ require (
github.com/unknwon/com v0.0.0-20190804042917-757f69c95f3e // indirect
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-20191011191535-87dc89f01550
golang.org/x/net v0.0.0-20191021144547-ec77196f6094 // indirect
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45 // indirect
golang.org/x/sys v0.0.0-20191022100944-742c48ecaeb7 // indirect
golang.org/x/tools v0.0.0-20191022213345-0bbdf54effa2 // indirect
golang.org/x/crypto v0.0.0-20191219195013-becbf705a915
golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553 // indirect
golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6 // indirect
golang.org/x/sys v0.0.0-20191220220014-0732a990476f // indirect
golang.org/x/tools v0.0.0-20191220234730-f13409bbebaf // indirect
google.golang.org/appengine v1.6.5 // indirect
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect
gopkg.in/natefinch/lumberjack.v2 v2.0.0
Expand Down
Loading

0 comments on commit c152ee3

Please sign in to comment.