Skip to content

Commit

Permalink
devkit: add RHEL support to patch and fix uname
Browse files Browse the repository at this point in the history
Signed-off-by: Stewart X Addison <[email protected]>
  • Loading branch information
sxa committed Jun 28, 2024
1 parent d3d1287 commit d771cb6
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 16 deletions.
13 changes: 13 additions & 0 deletions pipelines/build/devkit/Makefile.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/make/devkit/Makefile b/make/devkit/Makefile
index c85a7c21d29..8f69d23c325 100644
--- a/make/devkit/Makefile
+++ b/make/devkit/Makefile
@@ -58,7 +58,7 @@
COMMA := ,

os := $(shell uname -o)
-cpu := $(shell uname -p)
+cpu := $(shell uname -m)

# Figure out what platform this is building on.
me := $(cpu)-$(if $(findstring Linux,$(os)),linux-gnu)
36 changes: 21 additions & 15 deletions pipelines/build/devkit/Tools.gmk.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git a/make/devkit/Tools.gmk b/make/devkit/Tools.gmk
index 187320ca2..9f1454d5e 100644
index 187320ca26e..7f334eb2834 100644
--- a/make/devkit/Tools.gmk
+++ b/make/devkit/Tools.gmk
@@ -62,6 +62,23 @@ ifeq ($(BASE_OS), OL)
Expand Down Expand Up @@ -73,22 +73,28 @@ index 187320ca2..9f1454d5e 100644
REQUIRED_MIN_MAKE_MAJOR_VERSION := 4
else ifeq ($(GCC_VER), 11.2.0)
gcc_ver := gcc-11.2.0
@@ -246,7 +286,13 @@ download-rpms:
@@ -245,8 +285,18 @@ download-rpms:
mkdir -p $(DOWNLOAD_RPMS)
# Only run this if rpm dir is empty.
ifeq ($(wildcard $(DOWNLOAD_RPMS)/*.rpm), )
cd $(DOWNLOAD_RPMS) && \
- cd $(DOWNLOAD_RPMS) && \
- wget -r -np -nd $(patsubst %, -A "*%*.rpm", $(RPM_LIST)) $(BASE_URL)
+ wget -e robots=off -r -np -nd $(patsubst %, -A "*%*.rpm", $(RPM_LIST)) $(BASE_URL)
+ gpg --keyserver keyserver.ubuntu.com --recv-keys \
+ $($(BASE_OS)_$(BASE_OS_MAJOR_VERSION)_GPG_KEY_$(ARCH))
+ rm -f $(DOWNLOAD_RPMS)/rpm.sig && gpg --armor --export \
+ $($(BASE_OS)_$(BASE_OS_MAJOR_VERSION)_GPG_KEY_$(ARCH)) > $(DOWNLOAD_RPMS)/rpm.sig
+ rpm --import $(DOWNLOAD_RPMS)/rpm.sig || true
+ rpm -K $(DOWNLOAD_RPMS)/*.rpm
+ ifeq ($(BASE_OS), RHEL)
+ yumdownloader --destdir=$(DOWNLOAD_RPMS) $(RPM_LIST)
+ else
+ cd $(DOWNLOAD_RPMS) && \
+ wget -e robots=off -r -np -nd $(patsubst %, -A "*%*.rpm", $(RPM_LIST)) $(BASE_URL)
+ gpg --keyserver keyserver.ubuntu.com --recv-keys \
+ $($(BASE_OS)_$(BASE_OS_MAJOR_VERSION)_GPG_KEY_$(ARCH))
+ rm -f $(DOWNLOAD_RPMS)/rpm.sig && gpg --armor --export \
+ $($(BASE_OS)_$(BASE_OS_MAJOR_VERSION)_GPG_KEY_$(ARCH)) > $(DOWNLOAD_RPMS)/rpm.sig
+ rpm --import $(DOWNLOAD_RPMS)/rpm.sig || true
+ rpm -K $(DOWNLOAD_RPMS)/*.rpm
+ endif
endif

##########################################################################################
@@ -271,6 +317,14 @@ define Download
@@ -271,6 +321,14 @@ define Download

$$($(1)_FILE) :
wget -P $(DOWNLOAD) $$($(1))
Expand All @@ -103,7 +109,7 @@ index 187320ca2..9f1454d5e 100644
endef

# Download and unpack all source packages
@@ -323,6 +377,9 @@ $(foreach p,$(RPM_FILE_LIST),$(eval $(call unrpm,$(p))))
@@ -323,6 +381,9 @@ $(foreach p,$(RPM_FILE_LIST),$(eval $(call unrpm,$(p))))
# have it anyway, but just to make sure...
# Patch libc.so and libpthread.so to force linking against libraries in sysroot
# and not the ones installed on the build machine.
Expand All @@ -113,15 +119,15 @@ index 187320ca2..9f1454d5e 100644
$(libs) : $(rpms)
@echo Patching libc and pthreads
@(for f in `find $(SYSROOT) -name libc.so -o -name libpthread.so`; do \
@@ -332,6 +389,7 @@ $(libs) : $(rpms)
@@ -332,6 +393,7 @@ $(libs) : $(rpms)
-e 's|/lib/||g' ) > $$f.tmp ; \
mv $$f.tmp $$f ; \
done)
+ @find $(SYSROOT) -name '*.[ao]' -exec objcopy --remove-section .comment '{}' ';'
@mkdir -p $(SYSROOT)/usr/lib
@touch $@

@@ -440,6 +498,9 @@ endif
@@ -440,6 +502,9 @@ endif

# Makefile creation. Simply run configure in build dir.
# Setting CFLAGS to -O2 generates a much faster ld.
Expand All @@ -131,7 +137,7 @@ index 187320ca2..9f1454d5e 100644
$(bfdmakes) \
$(BUILDDIR)/$(binutils_ver)/Makefile \
: $(BINUTILS_CFG)
@@ -454,6 +515,7 @@ $(BUILDDIR)/$(binutils_ver)/Makefile \
@@ -454,6 +519,7 @@ $(BUILDDIR)/$(binutils_ver)/Makefile \
--with-sysroot=$(SYSROOT) \
--disable-nls \
--program-prefix=$(TARGET)- \
Expand Down
3 changes: 2 additions & 1 deletion pipelines/build/devkit/make_devkit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,10 @@ openjdkRepo="https://github.com/openjdk/${VERSION}.git"
git clone --depth 1 ${openjdkRepo} ${VERSION}
cd ${VERSION}

# Patch to support Centos7
# Patch to support Centos7, RHEL, and uname fix
cp ../binutils-2.39.patch make/devkit/patches/${ARCH}-binutils-2.39.patch
patch -p1 < ../Tools.gmk.patch
patch -p1 < ../Makefile.patch

devkit_target="${ARCH}-linux-gnu"

Expand Down

0 comments on commit d771cb6

Please sign in to comment.