mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
RUBY-29825 add a separate Makefile.cross for easier cross-compilation to other platforms.
By default, we cross-compile for `aarch64`, but that could be adjusted via `HOST` variable. Also cleaned up the `Makefile` and updated README. Reviewed-by: IJ-CR-102814 GitOrigin-RevId: b65519b2ab6a3461f0e621d5dcc832b083948fef
This commit is contained in:
committed by
intellij-monorepo-bot
parent
8ace063b3b
commit
c688145a99
@@ -1,5 +1,6 @@
|
||||
.idea
|
||||
musl
|
||||
musl-*/
|
||||
*.tgz
|
||||
*.tar.gz
|
||||
wslproxy
|
||||
|
||||
@@ -7,23 +7,23 @@ MUSL_HOME := $(HOME)/musl
|
||||
MUSL_CC := $(MUSL_HOME)/bin/musl-gcc
|
||||
|
||||
CFLAGS = -Wall -Wextra -pedantic -Werror -Os -D_POSIX_SOURCE=1 -D_BSD_SOURCE=1
|
||||
LDLIBS = -static
|
||||
LDFLAGS = -static
|
||||
CC = $(MUSL_CC)
|
||||
|
||||
all: $(MUSL_CC) wslproxy wslhash
|
||||
|
||||
musl:
|
||||
$(MUSL_DISTR):
|
||||
@echo I will now download musl. If it fails, check you have wget and see README
|
||||
wget https://musl.libc.org/releases/musl-$(MUSL_VER).tar.gz -O musl.tar.gz
|
||||
tar xfvz musl.tar.gz && mv musl-$(MUSL_VER) $(MUSL_DISTR)
|
||||
|
||||
$(MUSL_CC): musl
|
||||
$(MUSL_CC): $(MUSL_DISTR)
|
||||
cd $(MUSL_DISTR) && ./configure --prefix=$(MUSL_HOME) --syslibdir=$(MUSL_HOME)/lib && $(MAKE) && $(MAKE) install
|
||||
|
||||
wslproxy: $(SOURCES) | $(MUSL_CC)
|
||||
wslproxy: wslproxy.c | $(MUSL_CC)
|
||||
wslhash: wslhash.c xxhash.h xxhash.c | $(MUSL_CC)
|
||||
|
||||
.PHONY: all clean
|
||||
|
||||
clean:
|
||||
$(RM) wslproxy wslhash
|
||||
$(RM) wslproxy wslhash
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
BUILD := $(shell uname -m)
|
||||
HOST := aarch64
|
||||
|
||||
MUSL_CROSS_VER := 10
|
||||
MUSL_CROSS_DISTR := musl-$(HOST)
|
||||
MUSL_CROSS_CC := ./$(MUSL_CROSS_DISTR)/bin/$(HOST)-linux-musl-gcc
|
||||
|
||||
all: $(MUSL_CROSS_DISTR) $(MUSL_CROSS_CC)
|
||||
make CC="$(MUSL_CROSS_CC)" $(MAKECMDGOALS)
|
||||
|
||||
$(MUSL_CROSS_DISTR):
|
||||
@echo I will now download musl cross-compile toolchain. If it fails, check you have wget and see README
|
||||
wget "https://more.musl.cc/$(MUSL_CROSS_VER)/$(BUILD)-linux-musl/$(HOST)-linux-musl-cross.tgz" -O "$(MUSL_CROSS_DISTR).tgz"
|
||||
tar xfvz "$(MUSL_CROSS_DISTR).tgz"
|
||||
mv "$(HOST)-linux-musl-cross" "$(MUSL_CROSS_DISTR)"
|
||||
|
||||
.PHONY: all clean
|
||||
|
||||
clean:
|
||||
$(RM) wslproxy wslhash
|
||||
@@ -30,4 +30,14 @@ Getting musl manually:
|
||||
See https://wiki.musl-libc.org/getting-started.html for more info
|
||||
|
||||
Q: I got error opening project in CLion:
|
||||
A: Make sure you run "make". Then, tools->Makefile->Reload
|
||||
A: Make sure you run "make". Then, tools->Makefile->Reload
|
||||
|
||||
Q: How do I compile binaries for aarch64 platform?
|
||||
A: Run "make -f Makefile.cross clean all". The required musl cross-compiler will be downloaded and
|
||||
all tools will be cross-compiled for aarch64 platform.
|
||||
|
||||
Q: How do I check the target platform of the compiled binary?
|
||||
A: Check the output of "file YOUR_BINARY".
|
||||
|
||||
Q: How do I test that cross-compiled binary works on aarch64?
|
||||
A: Run "sudo apt install qemu-user-static" (adjust for your distro). Then run "qemu-aarch64-static YOUR_BINARY".
|
||||
|
||||
Reference in New Issue
Block a user