Cross compile on minix support

* Remade patch so it works with minix patch tool.

 * New MINIX tar support -ox, so revert back to it

   In fetch scripts, tar had been replaced by bsdtar as the prebvious
   tar did not support the -o flag under minix, which is required to
   prevent usage of tar file stored user and group information.

   This introduces portability problems. As our new tar tool now
   support that flag revert back to improve portability.
This commit is contained in:
Lionel Sambuc 2012-11-01 22:55:12 +01:00 committed by Lionel Sambuc
parent 6227378147
commit b8a678ef1d
32 changed files with 21644 additions and 31161 deletions

View file

@ -763,6 +763,8 @@ nobomb_getmakevar()
"${make}" -m ${TOP}/share/mk -s -B -f- _x_ <<EOF || return 1
_x_:
echo \${$1}
# LSC FIXME: We are cross compiling, so overwrite default and build tools
USETOOLS:=yes
.include <bsd.prog.mk>
.include <bsd.kernobj.mk>
EOF
@ -1693,10 +1695,9 @@ EOF
eval cat <<EOF
MAKEWRAPPERMACHINE=${makewrappermachine:-${MACHINE}}; export MAKEWRAPPERMACHINE
USETOOLS=yes; export USETOOLS
MKGCC=yes; export MKGCC
MKGDB=no; export MKGDB
# LSC We are cross compiling, so do not install to root!
MKINSTALLBOOT=no; export MKINSTALLBOOT
MKGCC=yes; export MKGCC
EOF
} | eval sort -u "${makewrapout}"
eval cat <<EOF "${makewrapout}"

View file

@ -89,6 +89,7 @@ expand.c: arith.h
trap.c: signames.h
cd.c complete.c eval.c exec.c expand.c jobs.c main.c options.c parser.c redir.c show.c trap.c var.c: nodes.h
eval.c exec.c expand.c input.c input.h jobs.c mystring.c output.c parser.c trap.c var.c: syntax.h
cd.c eval.c exec.c histedit.cjobs.c main.c miscbltin.c options.c trap.c var.c: builtins.h
# LSC: Seems that this file is implicitly taken into account by NetBSD's make,
# still seems to be ignored / not found currently.

View file

@ -1,5 +1,3 @@
# LSC For now...
NOGCCERROR:= yes
PROG= getty
BINDIR= /bin
MAN=

File diff suppressed because it is too large Load diff

View file

@ -300,7 +300,9 @@ FILESMODE_minfree= 600
CONFIGSYMLINKS+= ${TZDIR}/${LOCALTIME} /etc/localtime \
/usr/sbin/rmt /etc/rmt
.else
CONFIGSYMLINKS+= /usr/log /var/log \
CONFIGSYMLINKS+= \
/usr/lib/cpp /lib/cpp \
/usr/log /var/log \
/usr/tmp /var/tmp \
/usr/pkg/bin/clang /usr/bin/cc \
/usr/pkg/bin/strip /usr/bin/strip \

View file

@ -23,7 +23,7 @@ then
fi
fi
bsdtar -oxjf binutils-2.21.1.tar.bz2 && \
tar -oxjf binutils-2.21.1.tar.bz2 && \
mv binutils-2.21.1 dist && \
cd dist && \
cat ../patches/* | patch -p1

View file

@ -0,0 +1,11 @@
diff -rNU3 dist/binutils/dwarf.c dist.new/binutils/dwarf.c
--- dist/binutils/dwarf.c Wed Nov 7 17:24:51 2012
+++ dist.new/binutils/dwarf.c Wed Nov 7 15:50:59 2012
@@ -28,6 +28,7 @@
#include "elf/common.h"
#include "dwarf2.h"
#include "dwarf.h"
+#include "getopt.h"
static const char *regname (unsigned int regno, int row);

View file

@ -32,7 +32,7 @@ then
fi
fi
bsdtar -oxjf gcc-4.5.3.tar.bz2 && \
tar -oxjf gcc-4.5.3.tar.bz2 && \
mv gcc-4.5.3 dist && \
cd dist && \
rm -rf $DELETEDIRS && \

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,12 @@
diff -rNU3 gcc-4.5.3/configure dist/configure
--- gcc-4.5.3/configure Wed Nov 7 20:12:53 2012
+++ dist/configure Wed Nov 7 19:25:20 2012
@@ -5321,7 +5321,7 @@
# Check for GMP, MPFR and MPC
-gmplibs="-lmpc -lmpfr -lgmp"
+gmplibs="-lmpc -lmpfr -lgmp -lm"
gmpinc=
have_gmp=no

View file

@ -23,7 +23,7 @@ then
fi
fi
bsdtar -oxzf mpc-0.9.tar.gz
tar -oxzf mpc-0.9.tar.gz
mv mpc-0.9 dist
fi

View file

@ -23,7 +23,7 @@ then
fi
fi
bsdtar -oxjf gmp-5.0.2.tar.bz2
tar -oxjf gmp-5.0.2.tar.bz2
mv gmp-5.0.2 dist && \
cd dist && \
cat ../patches/* |patch -p1

View file

@ -23,7 +23,7 @@ then
fi
fi
bsdtar -oxjf mpfr-3.0.1.tar.bz2
tar -oxjf mpfr-3.0.1.tar.bz2
mv mpfr-3.0.1 dist && \
cd dist && \
cat ../patches/* |patch -p1

View file

@ -10,7 +10,7 @@ MDEC= /usr/mdec
GEN_FILES= *.bak image kernel *.iso *.iso.gz cdfdimage rootimage src
# LSC detect where were built the objects files
PROGROOT:= ../..
PROGROOT:= ..
.if "${MAKEOBJDIR:S,${.CURDIR},,}" != ""
PROGROOT:= ${MAKEOBJDIR:S,releasetools,,}
.endif

View file

@ -7,7 +7,8 @@
.if ${MKSHARE} != "no" || \
make(clean) || make(cleandir) || make(distclean) || make(obj)
SUBDIR= mk terminfo zoneinfo misc
SUBDIR= misc mk \
terminfo zoneinfo
.if ${MKNLS} != "no"
SUBDIR+=i18n locale nls
.endif

View file

@ -16,8 +16,7 @@ FILES= bsd.README bsd.clang-analyze.mk bsd.clean.mk bsd.dep.mk bsd.doc.mk \
bsd.subdir.mk bsd.sys.mk bsd.test.mk bsd.x11.mk sys.mk
# MINIX-specific files
FILES+= minix.bootprog.mk minix.service.mk \
minix.gcc.mk minix.gcov.mk pkgsrchooks.mk
FILES+= minix.bootprog.mk minix.service.mk minix.gcov.mk
FILESDIR=/usr/share/mk
.endif

View file

@ -23,4 +23,22 @@ _GCC_CRTDIR?= ${DESTDIR}/usr/lib
_GCC_LIBGCCDIR?= ${DESTDIR}/usr/lib
.endif
.if defined(__MINIX)
AFLAGS+=-D__ASSEMBLY__
CPPFLAGS+= -fno-builtin -Wall -Wno-sign-compare
.if ${MACHINE_ARCH} == "i386"
CPPFLAGS+= -march=i586
.elif ${MACHINE_ARCH} == "arm"
CPPFLAGS+= -march=armv7-a
CPPFLAGS+= -D__minix
.endif
# LSC In the current state there is too much to be done
# Some package have been identified by directly adding NOGCCERROR
# To their Makefiles
NOGCCERROR:= yes
NOCLANGERROR:= yes
.endif # defined(__MINIX)
.endif # ! defined(_BSD_GCC_MK_)

View file

@ -510,9 +510,12 @@ _INSTRANLIB=${empty(PRESERVE):?-a "${RANLIB} -t":}
__archivebuild: .USE
${_MKTARGET_BUILD}
rm -f ${.TARGET}
# LSC MINIX: We do not have yet imported tsort nor lorder
# ${AR} ${_ARFL} ${.TARGET} `NM=${NM} ${LORDER} ${.ALLSRC:M*o} | ${TSORT}`
.if defined(__MINIX)
# LSC FIXME MINIX: We do not have yet imported tsort nor lorder
${AR} ${_ARFL} ${.TARGET} ${.ALLSRC:M*o}
.else
${AR} ${_ARFL} ${.TARGET} `NM=${NM} ${LORDER} ${.ALLSRC:M*o} | ${TSORT}`
.endif # defined(__MINIX)
.endif
.if !target(__archiveinstall)
@ -566,7 +569,8 @@ DPLIBC ?= ${DESTDIR}${LIBC_SO}
.else
LDLIBC ?= -nodefaultlibs
.if ${LIB} == "c"
LDADD+= -lgcc
LDADD+= ${${ACTIVE_CC} == "gcc":?-lgcc:}
LDADD+= ${${ACTIVE_CC} == "clang":?-L/usr/pkg/compiler-rt/lib -lCompilerRT-Generic:}
.endif
.endif
.endif
@ -821,6 +825,5 @@ LINKSMODE?= ${LIBMODE}
.include <bsd.dep.mk>
.include <bsd.clang-analyze.mk>
.include <bsd.clean.mk>
.include <minix.gcc.mk>
${TARGETS}: # ensure existence

View file

@ -8,23 +8,31 @@
.if !defined(_BSD_OWN_MK_)
_BSD_OWN_MK_=1
# LSC SAVE SOME TIME...
MKCLEANVERIFY:= no
.ifndef HOSTPROG
# LSC Needed at a lot of places for MINIX
CPPFLAGS+= -isystem ${DESTDIR}/usr/include
MKDYNAMICROOT:= no
# Override MACHINE as the native host make will set it to i686
_uname_s!= uname -s
.if ${_uname_s} == "Minix" && ${MACHINE_ARCH} == "i386"
MACHINE:= i386
.endif
.if defined(__MINIX)
# LSC FIXME: Useless difference, Should use the mk.conf
MAKECONF?= /etc/make.conf
# Some Minix deviations from NetBSD
LDSTATIC?= -static
MKDYNAMICROOT?= no
BINMODE?= 755
NONBINMODE?= 644
MANDIR?= /usr/man
BINGRP?= operator
MANGRP?= operator
INFOGRP?= operator
DOCGRP?= operator
MACHINE_GNU_PLATFORM?=${MACHINE_ARCH}-elf32-minix
.endif # defined(__MINIX)
MKBINUTILS:= no
MKGDB:= no
MKGCC?= no
# LSC To check if works
#DESTDIR?= /usr/destdir.${MACHINE_ARCH}
# LSC MINIX SMP Support?
.ifdef CONFIG_SMP
@ -35,9 +43,26 @@ SMP_FLAGS += -DCONFIG_MAX_CPUS=${CONFIG_MAX_CPUS}
.endif
CPPFLAGS+= ${SMP_FLAGS}
.endif
MAKECONF?= /etc/make.conf
__uname_s!= uname -s
.if ${__uname_s:Uunknown} == "Minix"
USETOOLS?= never
. if ${USETOOLS:Uno} != "yes"
#HAVE_LLVM?=2.9
HAVE_LLVM?=3.1
. endif
. if !defined(HOSTPROG) && !defined(HOSTLIB)
# LSC FIXME: Override MACHINE as the native minix host make command will set
# it to i686.
. if ${MACHINE_ARCH} == "i386"
MACHINE:= i386
. endif
. endif # !defined(HOSTPROG) && !defined(HOSTLIB)
.endif # __uname_s == "Minix"
.else
MAKECONF?= /etc/mk.conf
.endif # defined(__MINIX)
.-include "${MAKECONF}"
#
@ -551,10 +576,10 @@ BSDSRCDIR?= /usr/src
BSDOBJDIR?= /usr/obj
NETBSDSRCDIR?= ${BSDSRCDIR}
BINGRP?= operator
BINGRP?= wheel
BINOWN?= root
BINMODE?= 755
NONBINMODE?= 644
BINMODE?= 555
NONBINMODE?= 444
# These are here mainly because we don't want suid root in case
# a Makefile defines BINMODE.
@ -563,14 +588,14 @@ RUMPBINOWN?= root
RUMPBINMODE?= 555
RUMPNONBINMODE?=444
MANDIR?= /usr/man
MANGRP?= operator
MANDIR?= /usr/share/man
MANGRP?= wheel
MANOWN?= root
MANMODE?= ${NONBINMODE}
MANINSTALL?= ${_MANINSTALL}
INFODIR?= /usr/share/info
INFOGRP?= operator
INFOGRP?= wheel
INFOOWN?= root
INFOMODE?= ${NONBINMODE}
@ -583,7 +608,7 @@ LIBMODE?= ${NONBINMODE}
DOCDIR?= /usr/share/doc
HTMLDOCDIR?= /usr/share/doc/html
DOCGRP?= operator
DOCGRP?= wheel
DOCOWN?= root
DOCMODE?= ${NONBINMODE}
@ -839,6 +864,7 @@ MKZFS?= yes
.endif
# Some tough Minix defaults
MKCOVERAGE?= no
MKPROFILE?= no
MKSTATICLIB:= yes
MKLINT:= no
@ -848,7 +874,6 @@ USE_FORT:= no
MKYP:= no
MKPF:= no
MKNLS:= no
MKCOVERAGE?= no
MKHESIOD:= no
MKPOSTFIX:= no
MKKMOD:= no
@ -868,8 +893,6 @@ MKIPFILTER:= no
MKINET6:= no
MKGROFF:= no
MKHTML:= no
MKBINUTILS:= no
MKGDB:= no
#
# MK* options which default to "yes".
@ -1033,12 +1056,12 @@ COPY?= -c
.if ${MKUPDATE} == "no"
PRESERVE?=
.else
#XXX: Not supported by MINIX install
#LSC: Not supported by MINIX install
PRESERVE?= -p
.endif
#XXX: Not supported by MINIX install
RENAME?= -r
.endif
.endif # != "Minix"
HRDLINK?= -l h
SYMLINK?= -l s

View file

@ -6,8 +6,7 @@
.include <bsd.init.mk>
.include <bsd.shlib.mk>
.include <bsd.gcc.mk>
#.include <minix.gcov.mk>
.include <minix.gcc.mk>
.include <minix.gcov.mk>
#
# Definitions and targets shared among all programs built by a single
@ -120,9 +119,6 @@ LIB${_lib:tu}= ${DESTDIR}/usr/lib/lib${_lib:S/xx/++/:S/atf_c/atf-c/}.a
.endif
.endfor
#LSC Add minix base library, required for libc to work.
LDADD+= -L=/usr/lib -lminlib
# PAM applications, if linked statically, need more libraries
.if (${MKPIC} == "no")
.if (${MKCRYPTO} != "no")

View file

@ -5,6 +5,10 @@
.if !defined(_BSD_SYS_MK_)
_BSD_SYS_MK_=1
.if ${HOST_OSTYPE:C/\-.*//:U} == "Minix"
HOST_CPP?= /usr/lib/cpp
.endif
.if ${MKREPRO:Uno} == "yes"
CPPFLAGS+= -Wp,-iremap,${NETBSDSRCDIR}:/usr/src
CPPFLAGS+= -Wp,-iremap,${DESTDIR}/:/
@ -33,7 +37,9 @@ CFLAGS+= -Wno-sign-compare
CFLAGS+= ${${ACTIVE_CC} != "clang":? -Wno-traditional :}
.if !defined(NOGCCERROR)
# Set assembler warnings to be fatal
CFLAGS+= -Wa,--fatal-warnings
#CFLAGS+= -Wa,--fatal-warnings
# LSC Clang version 2.9 those not support this flag
CFLAGS+= ${${HAVE_LLVM:U} != "2.9":? -Wa,--fatal-warnings:}
.endif
# Set linker warnings to be fatal
# XXX no proper way to avoid "FOO is a patented algorithm" warnings
@ -109,7 +115,11 @@ CPPFLAGS+= -D_FORTIFY_SOURCE=2
.if (${USE_SSP:Uno} != "no") && (${BINDIR:Ux} != "/usr/mdec")
.if ${HAS_SSP} == "yes"
COPTS+= -fstack-protector -Wstack-protector
.if defined(__MINIX)
COPTS+= ${${ACTIVE_CC} == "clang":? -mllvm -stack-protector-buffer-size=1 :}
.else
COPTS+= ${${ACTIVE_CC} == "clang":? --param ssp-buffer-size=1 :}
.endif # defined(__MINIX)
COPTS+= ${${ACTIVE_CC} == "gcc":? --param ssp-buffer-size=1 :}
.endif
.endif

View file

@ -1,16 +0,0 @@
LDSTATIC?= -static
AFLAGS+=-D__ASSEMBLY__
CPPFLAGS+= -fno-builtin -Wall -Wno-sign-compare
.if ${MACHINE_ARCH} == "i386"
CPPFLAGS+= -march=i586
.elif ${MACHINE_ARCH} == "arm"
CPPFLAGS+= -march=armv7-a
CPPFLAGS+= -D__minix
.endif
# LSC In the current state there is too much to be done
# Some package have been identified by directly adding NOGCCERROR
# To their Makefiles
NOGCCERROR:= yes
NOCLANGERROR:= yes

View file

@ -1,5 +0,0 @@
#
.if !defined(_MINIX_PKGSRC_HOOKS_)
_MINIX_PKGSRC_HOOKS_=1
.endif # !defined(_MINIX_PKGSRC_HOOKS_)

View file

@ -1,19 +1,25 @@
# $NetBSD: sys.mk,v 1.110 2012/10/06 20:54:58 christos Exp $
# @(#)sys.mk 8.2 (Berkeley) 3/21/94
unix?= We run MINIX.
# This variable should be used to differentiate Minix builds in Makefiles.
__MINIX= yes
COMPILER_TYPE=gnu
NBSD_LIBC= yes
.if defined(MKSMALL) && ${MKSMALL} == "yes"
.if defined(__MINIX)
.if ${MKSMALL:U} == "yes"
DBG= -Os
CFLAGS+= -DNDEBUG
.endif
unix?= We run MINIX.
COMPILER_TYPE=gnu
NBSD_LIBC= yes
DBG?= -O
CPP?= /usr/lib/cpp
.endif # defined(__MINIX)
unix?= We run NetBSD.
.SUFFIXES: .a .o .ln .s .S .c .cc .cpp .cxx .C .f .F .r .p .l .y .sh
.LIBS: .a
@ -30,8 +36,7 @@ _ASM_TRADITIONAL_CPP= -x assembler-with-cpp
COMPILE.S?= ${CC} ${AFLAGS} ${AFLAGS.${<:T}} ${CPPFLAGS} ${_ASM_TRADITIONAL_CPP} -c
LINK.S?= ${CC} ${AFLAGS} ${AFLAGS.${<:T}} ${CPPFLAGS} ${LDFLAGS}
CC?= clang
CC?= cc
.if ${MACHINE_ARCH} == "sh3el" || ${MACHINE_ARCH} == "sh3eb"
# -O2 is too -falign-* zealous for low-memory sh3 machines
DBG?= -Os -freorder-blocks
@ -41,9 +46,7 @@ DBG?= -Os
.elif ${MACHINE_ARCH} == "vax"
DBG?= -O1 -fgcse -fstrength-reduce -fgcse-after-reload
.else
#MINIX: use -O for now
#DBG?= -O2
DBG?= -O
DBG?= -O2
.endif
CFLAGS?= ${DBG}
LDFLAGS?=

View file

@ -77,6 +77,7 @@ GCC_CPPFLAGS= -DNETBSD_TOOLS -DTARGET_SYSTEM_ROOT=0 \
.if ${HOST_OSTYPE:C/\-.*//} == "Minix"
GCC_CPPFLAGS+= -D_NETBSD_SOURCE -D_POSIX_SOURCE -D_COMPAT_MINIX
CONFIGURE_ENV+= LDFLAGS=-lm
.endif
MAKE_ARGS= MACHINE= MAKEINFO=${TOOL_MAKEINFO:Q} \

View file

@ -13,6 +13,7 @@ PROG= passwd
SRCS= local_passwd.c passwd.c
MAN= passwd.1
# LSC No LOGIN_CAP on Minix?
CPPFLAGS+=-I${.CURDIR} #-DLOGIN_CAP
.if (${USE_YP} != "no")

View file

@ -6,6 +6,7 @@
PROG= sed
SRCS= compile.c main.c misc.c process.c
# LSC FIXME Still required?
SYMLINKS?= ${BINDIR}/sed /bin/sed
.include <bsd.prog.mk>

View file

@ -7,7 +7,7 @@ CPPFLAGS+= -I${.CURDIR}/../../lib/libterminfo
.ifndef HOSTPROG
LDADD+= -lterminfo -lutil
DPADD+= ${LIBTERMINFO} #${LIBUTIL}
DPADD+= ${LIBTERMINFO} ${LIBUTIL}
.endif
.include <bsd.prog.mk>

View file

@ -3,9 +3,6 @@
.include <bsd.own.mk>
# LSC Until it compiles cleanly...
NOGCCERROR:=yes
PROG= xinstall
SRCS= xinstall.c getid.c
MAN= install.1

View file

@ -252,8 +252,7 @@ main(int argc, char *argv[])
case 'p':
dopreserve = 1;
#ifdef __minix
errx(1,
"Minix lacks support for futimes(3)/utimes(2)");
warn("Minix lacks support for futimes(3)/utimes(2)");
#endif
break;
case 'r':

View file

@ -8,7 +8,7 @@ CPPFLAGS+= -D_MINIX
# LSC Adding this to activate the getline renaming macro
CPPFLAGS+= -D__NBSD_LIBC
.if ${HOST_OSTYPE:C/\-.*//} == "Minix" || !defined(HOSTPROGNAME)
.if ${HOST_OSTYPE:C/\-.*//:U} == "Minix" || !defined(HOSTPROGNAME)
LDADD+= -lminlib -lcompat_minix
.endif