void-packages/srcpkgs/yaboot/patches/0003-build-system.patch

113 lines
4.1 KiB
Diff

This is different from what Debian does. It does several things required only
for us. We disable usage of native CFLAGS for the yaboot binary itself as that
is loaded by OF (and is 32-bit). We keep CFLAGS intact for the userland part.
Additionally, we fix various paths, and make sure a 32-bit crosscompiler is
used for yaboot itself, in order to ensure linkage against correct libgcc and
so on, which is required. We alter the flags for that too (must be synchronized
with the flags used for e2fsprogs, see the template).
Also do not strip the binaries upon install, xbps-src will take care of that.
--- a/Makefile
+++ b/Makefile
@@ -7,8 +7,8 @@ VERSION = 1.3.17
DEBUG = 0
# make install vars
ROOT =
-PREFIX = usr/local
-MANDIR = man
+PREFIX = usr
+MANDIR = share/man
# command used to get root (needed for tarball creation)
GETROOT = fakeroot
@@ -32,14 +32,18 @@ LD := $(CROSS)ld
AS := $(CROSS)as
OBJCOPY := $(CROSS)objcopy
+# The compiler to use for yaboot itself
+YBCC = $(CC)
+
# The flags for the yaboot binary.
#
-YBCFLAGS = -Os -m32 $(CFLAGS) -nostdinc -Wall -isystem `$(CC) -m32 -print-file-name=include` -fsigned-char
+YBCFLAGS = -Os -m32 -nostdinc -Wall -isystem `$(YBCC) -m32 -print-file-name=include` -fsigned-char
YBCFLAGS += -DVERSION="\"${VERSION}${VERSIONEXTRA}\""
YBCFLAGS += -DTEXTADDR=$(TEXTADDR) -DDEBUG=$(DEBUG)
YBCFLAGS += -DMALLOCADDR=$(MALLOCADDR) -DMALLOCSIZE=$(MALLOCSIZE)
YBCFLAGS += -DKERNELADDR=$(KERNELADDR)
-YBCFLAGS += -Werror -fdiagnostics-show-option
+YBCFLAGS += -fgnu89-inline -fno-builtin-malloc -fno-stack-protector -no-pie
+YBCFLAGS += -fcommon
YBCFLAGS += -I ./include
YBCFLAGS += -fno-strict-aliasing
@@ -69,12 +72,13 @@ LFLAGS = -Ttext $(TEXTADDR) -Bstatic -melf32ppclinux
# Libraries
#
-LLIBS = -lext2fs
+LLIBS = ./libext2fs.a ./libcom_err.a
# For compiling userland utils
#
UCFLAGS = -Os $(CFLAGS) -Wall -I/usr/include
-UCFLAGS += -Werror -fdiagnostics-show-option
+UCFLAGS += -fdiagnostics-show-option
+UCFLAGS += -fcommon
# For compiling build-tools that run on the host.
#
@@ -103,7 +106,7 @@ OBJS += second/fs_reiserfs.o
endif
# compilation
-lgcc = `$(CC) -m32 -print-libgcc-file-name`
+lgcc = `$(YBCC) -m32 -print-libgcc-file-name`
all: yaboot addnote mkofboot
@@ -125,10 +128,10 @@ mkofboot:
fi
%.o: %.c
- $(CC) $(YBCFLAGS) -c -o $@ $<
+ $(YBCC) $(YBCFLAGS) -c -o $@ $<
%.o: %.S
- $(CC) $(YBCFLAGS) -D__ASSEMBLY__ -c -o $@ $<
+ $(YBCC) $(YBCFLAGS) -D__ASSEMBLY__ -c -o $@ $<
dep:
makedepend -Iinclude *.c lib/*.c util/*.c gui/*.c
@@ -181,9 +184,9 @@ strip: all
strip util/addnote
strip --remove-section=.comment --remove-section=.note util/addnote
-install: all strip
+install: all
install -d -o root -g root -m 0755 ${ROOT}/etc/
- install -d -o root -g root -m 0755 ${ROOT}/${PREFIX}/sbin/
+ install -d -o root -g root -m 0755 ${ROOT}/${PREFIX}/bin/
install -d -o root -g root -m 0755 ${ROOT}/${PREFIX}/lib
install -d -o root -g root -m 0755 ${ROOT}/${PREFIX}/lib/yaboot
install -d -o root -g root -m 0755 ${ROOT}/${PREFIX}/${MANDIR}/man5/
@@ -191,11 +194,11 @@ install: all strip
install -o root -g root -m 0644 second/yaboot ${ROOT}/$(PREFIX)/lib/yaboot
install -o root -g root -m 0755 util/addnote ${ROOT}/${PREFIX}/lib/yaboot/addnote
install -o root -g root -m 0644 first/ofboot ${ROOT}/${PREFIX}/lib/yaboot/ofboot
- install -o root -g root -m 0755 ybin/ofpath ${ROOT}/${PREFIX}/sbin/ofpath
- install -o root -g root -m 0755 ybin/ybin ${ROOT}/${PREFIX}/sbin/ybin
- install -o root -g root -m 0755 ybin/yabootconfig ${ROOT}/${PREFIX}/sbin/yabootconfig
- rm -f ${ROOT}/${PREFIX}/sbin/mkofboot
- ln -s ybin ${ROOT}/${PREFIX}/sbin/mkofboot
+ install -o root -g root -m 0755 ybin/ofpath ${ROOT}/${PREFIX}/bin/ofpath
+ install -o root -g root -m 0755 ybin/ybin ${ROOT}/${PREFIX}/bin/ybin
+ install -o root -g root -m 0755 ybin/yabootconfig ${ROOT}/${PREFIX}/bin/yabootconfig
+ rm -f ${ROOT}/${PREFIX}/bin/mkofboot
+ ln -s ybin ${ROOT}/${PREFIX}/bin/mkofboot
@gzip -9 man/*.[58]
install -o root -g root -m 0644 man/bootstrap.8.gz ${ROOT}/${PREFIX}/${MANDIR}/man8/bootstrap.8.gz
install -o root -g root -m 0644 man/mkofboot.8.gz ${ROOT}/${PREFIX}/${MANDIR}/man8/mkofboot.8.gz