-
Notifications
You must be signed in to change notification settings - Fork 123
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create aarch64-apple-darwin build script. #236
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like @space-r7 has noticed a similar PR from @Ishaanahuja7 which has made some similar and different changes over here: #237
It'd be cool if there's anything that needs collaborating over for that to land in this PR 🎉
build_m1.sh
Outdated
cp deps/config.sub mettle/config.sub | ||
make TARGET=aarch64-apple-darwin | ||
cd build/aarch64-apple-darwin/json-c/ && autoreconf -fiv && cd ../../.. | ||
make TARGET=aarch64-apple-darwin | ||
cp darwin_sigar.c build/aarch64-apple-darwin/libsigar/src/os/darwin/darwin_sigar.c | ||
make TARGET=aarch64-apple-darwin | ||
cd build/aarch64-apple-darwin/libdnet/ && autoreconf -fiv && cd ../../.. | ||
make TARGET=aarch64-apple-darwin |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is needed if we modify the top level ARCHES
file, which should get pulled in automagically to the Makefile + build process over here:
Lines 14 to 41 in bf5a4be
ARCHES := $(shell cat ARCHES) | |
# Create the individual build/clean/dist-clean rules for each arch... | |
define rules_for_each_arch | |
$(strip $(1)).build: $(TOOLS)/musl-cross/.unpacked $(ROOT)/mettle/configure | |
make TARGET=$(strip $(1)) | |
$(strip $(1)).install: | |
make TARGET=$(strip $(1)) install | |
$(strip $(1)).clean: | |
make TARGET=$(strip $(1)) clean | |
$(strip $(1)).distclean: | |
make TARGET=$(strip $(1)) distclean | |
endef | |
$(foreach a, $(ARCHES), $(eval $(call rules_for_each_arch, $(strip $(a))))) | |
all-parallel: $(TOOLS) $(patsubst %,%.build,$(ARCHES)) | |
clean-parallel: $(patsubst %,%.clean,$(ARCHES)) | |
distclean-parallel: $(patsubst %,%.distclean,$(ARCHES)) | |
install-parallel: $(patsubst %,%.install,$(ARCHES)) |
darwin_sigar.c
Outdated
@@ -0,0 +1,2772 @@ | |||
/* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe the sigar dependency is actually pulled in from over here https://github.com/rapid7/sigar
If this new darwin_sigar file is the same content as what's in the rapid7/sigar#1
PR, I think we'd be able to merge that in, or you could create a new pull request if there's additional changes to make 👍
Hi @adfoster-r7 @usiegl00 I have opened a PR in rapid7/sigar with the fixed changes for darwin_sigar.c and in my PR for this repo also added darwin and iphone targets in ARCHES #237, rapid7/sigar#2 |
…e-darwin This integrates Ishaanahuja7's changes with usiegl00s and enables building for the aarch64-apple-darwin target.
@Ishaanahuja7 I have incorporated your changes and separated out the cam and mic additions for a later pr. Thanks for the assist! |
@usiegl00 as noted in #237 (comment) the changes to |
make/Makefile.libsigar
Outdated
@@ -11,6 +11,7 @@ $(BUILD)/libsigar/Makefile: $(TOOLS) $(BUILD)/libsigar/configure | |||
@mkdir -p $(BUILD)/libsigar | |||
@$(SETUP_BUILDENV) cd $(BUILD)/libsigar; \ | |||
$(CONFIG_FIXUP) \ | |||
cp $(DEPS)/darwin_sigar.c src/os/darwin; \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line and the darwin_sigar.c
file should be removed since a PR was added to the sigar repository
ARCHES
Outdated
i386-apple-darwin | ||
x86_64-apple-darwin | ||
aarch64-apple-darwin |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the confusion, darwin
tuples are not currently built using the ARCHES
pattern. Currently the ARCHES
list builds only artifacts that can be cross compiled using a linux build system.
The gem build process currently calls the following in a macOS VM with Xcode available.
make TARGET=x86_64-apple-darwin
make TARGET=arm-iphone-darwin
make TARGET=aarch64-iphone-darwin
I do like the idea of having all supported tuples in the ARCHES
file however the Makefile
would need to be updated to either detect the running OS and skip darwin
when run on a linux platform or darwin
tuples need to be a separate file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note if removing is the path the other darwin
added targets for iphone
at the end of the file are also not compilable on Linux
.
Closing this as all changes here are believed to have been incorporated in #237. The framework PR referenced should be able to move forward utilizing the latest released gem for |
Thank you @Ishaanahuja7 and @jmartin-r7! |
This adds a build script and changes the required files to build mettle targeting
aarch64-apple-darwin
.Usage:
bash build_m1.sh
See: rapid7/metasploit-framework#17129