tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

QNX bootstrap



Hello,

   The attached diff makes it possible to bootstrap on QNX/x86 6.5.0SP1.

   The SA_RESTART hack is (essentially) what Foundry27 does.  Historical
note: In earlier versions QNX headers did define SA_RESTART, but it
didn't actually support it.  Also, I found a forum post which hinted
that SA_RESTART is coming in QNX, so the limitation may be temporary.

   The tsort was causing problems, and it was suggested that it doesn't
really do much nowadays, so it was removed.  (Semi-relevant reading for
those who, like me, never encountered tsort before):
http://stackoverflow.com/questions/13367377/how-do-i-determine-the-fastest-link-order).

   This patch does no more than what the subject says; it allows a
bootstrap, but there's still work to be done.  Most notably, there are
some issues with regards to C++ which causes a lot of breakage.  I'm
working on it.

-- 
Kind Regards,
Jan
Index: devel/bmake/files/util.c
===================================================================
RCS file: /cvsroot/pkgsrc/devel/bmake/files/util.c,v
retrieving revision 1.13
diff -u -r1.13 util.c
--- devel/bmake/files/util.c	19 May 2015 22:01:19 -0000	1.13
+++ devel/bmake/files/util.c	3 Jul 2015 19:42:34 -0000
@@ -383,7 +383,11 @@
 
     sa.sa_handler = a;
     sigemptyset(&sa.sa_mask);
+#ifdef SA_RESTART
     sa.sa_flags = SA_RESTART;
+#else
+    sa.sa_flags = 0;
+#endif
 
     if (sigaction(s, &sa, &osa) == -1)
 	return SIG_ERR;
Index: mk/platform/QNX.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/platform/QNX.mk,v
retrieving revision 1.4
diff -u -r1.4 QNX.mk
--- mk/platform/QNX.mk	10 Jun 2014 13:52:57 -0000	1.4
+++ mk/platform/QNX.mk	3 Jul 2015 19:42:58 -0000
@@ -1,6 +1,5 @@
 # Variable definitions for the QNX operating system.
 
-CC=		gcc
 ECHO_N?=	${ECHO} -n
 IMAKE_MAKE?=	${MAKE}		# program which gets invoked by imake
 PKGLOCALEDIR?=	share
Index: mk/tools/tools.QNX.mk
===================================================================
RCS file: mk/tools/tools.QNX.mk
diff -N mk/tools/tools.QNX.mk
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ mk/tools/tools.QNX.mk	3 Jul 2015 19:42:58 -0000
@@ -0,0 +1,109 @@
+# $NetBSD: $
+#
+# System-supplied tools for the QNX operating system.
+
+TOOLS_PLATFORM.[?=		[			# shell builtin
+TOOLS_PLATFORM.awk?=		/usr/bin/awk
+TOOLS_PLATFORM.basename?=	/usr/bin/basename
+TOOLS_PLATFORM.bison?=		${QNX_HOST}/usr/bin/bison
+TOOLS_PLATFORM.bison-yacc?=	${QNX_HOST}/usr/bin/bison -y
+TOOLS_PLATFORM.bzcat?=		/usr/bin/bzcat
+TOOLS_PLATFORM.bzip2?=		/usr/bin/bzip2
+TOOLS_PLATFORM.cat?=		/bin/cat
+TOOLS_PLATFORM.chgrp?=		/bin/chgrp
+TOOLS_PLATFORM.chmod?=		/bin/chmod
+TOOLS_PLATFORM.chown?=		/bin/chown
+TOOLS_PLATFORM.cmp?=		/usr/bin/cmp
+TOOLS_PLATFORM.cp?=		/bin/cp
+TOOLS_PLATFORM.cpp?=		${QNX_HOST}/usr/bin/cpp
+TOOLS_PLATFORM.cut?=		/usr/bin/cut
+TOOLS_PLATFORM.date?=		/usr/bin/date
+TOOLS_PLATFORM.diff?=		/usr/bin/diff
+TOOLS_PLATFORM.diff3?=		/usr/bin/diff3
+TOOLS_PLATFORM.dirname?=	/usr/bin/dirname
+TOOLS_PLATFORM.echo?=		echo			# shell builtin
+TOOLS_PLATFORM.egrep?=		/usr/bin/egrep
+TOOLS_PLATFORM.env?=		/usr/bin/env
+TOOLS_PLATFORM.expr?=		/usr/bin/expr
+TOOLS_PLATFORM.false?=		false			# shell builtin
+TOOLS_PLATFORM.fgrep?=		/usr/bin/fgrep
+TOOLS_PLATFORM.file?=		/usr/bin/file
+TOOLS_PLATFORM.find?=		/usr/bin/find
+TOOLS_PLATFORM.flex?=		${QNX_HOST}/usr/bin/flex
+TOOLS_PLATFORM.ftp?=		/usr/bin/ftp
+TOOLS_PLATFORM.gawk?=		/usr/bin/gawk
+TOOLS_PLATFORM.grep?=		/usr/bin/grep
+TOOLS_PLATFORM.groff?=		${QNX_HOST}/usr/bin/groff
+TOOLS_PLATFORM.gunzip?=		/bin/gunzip -f
+TOOLS_PLATFORM.gzcat?=		/bin/gzip -dc
+TOOLS_PLATFORM.gzip?=		/bin/gzip -nf ${GZIP}
+TOOLS_PLATFORM.head?=		/usr/bin/head
+TOOLS_PLATFORM.hostname?=	/bin/hostname
+TOOLS_PLATFORM.id?=		/usr/bin/id
+TOOLS_PLATFORM.ksh?=		/bin/ksh
+TOOLS_PLATFORM.lex?=		${QNX_HOST}/usr/bin/lex
+TOOLS_PLATFORM.ln?=		/bin/ln
+TOOLS_PLATFORM.ls?=		/bin/ls
+TOOLS_PLATFORM.m4?=		${QNX_HOST}/usr/bin/m4
+TOOLS_PLATFORM.gmake?=		${QNX_HOST}/usr/bin/make
+TOOLS_PLATFORM.mkdir?=		/bin/mkdir -p
+TOOLS_PLATFORM.mv?=		/bin/mv
+TOOLS_PLATFORM.nice?=		/usr/bin/nice
+TOOLS_PLATFORM.nroff?=		${QNX_HOST}/usr/bin/nroff
+TOOLS_PLATFORM.openssl?=	/usr/bin/openssl
+TOOLS_PLATFORM.patch?=		/usr/bin/patch
+TOOLS_PLATFORM.pax?=		/bin/pax
+TOOLS_PLATFORM.printf?=		/usr/bin/printf
+TOOLS_PLATFORM.pwd?=		/bin/pwd
+.if empty(USE_CROSS_COMPILE:M[yY][eE][sS])
+TOOLS_PLATFORM.readelf?=	${QNX_HOST}/usr/bin/readelf
+.endif
+TOOLS_PLATFORM.rm?=		/bin/rm
+TOOLS_PLATFORM.rmdir?=		/usr/bin/rmdir
+TOOLS_PLATFORM.sed?=		/usr/bin/sed
+TOOLS_PLATFORM.sh?=		/bin/sh
+TOOLS_PLATFORM.sleep?=		/usr/bin/sleep
+TOOLS_PLATFORM.soelim?=		${QNX_HOST}/usr/bin/soelim
+TOOLS_PLATFORM.sort?=		/usr/bin/sort
+.if empty(USE_CROSS_COMPILE:M[yY][eE][sS])
+TOOLS_PLATFORM.strip?=		${QNX_HOST}/usr/bin/strip
+.endif
+TOOLS_PLATFORM.tail?=		/usr/bin/tail
+TOOLS_PLATFORM.tar?=		/usr/bin/tar
+TOOLS_PLATFORM.tbl?=		${QNX_HOST}/usr/bin/tbl
+TOOLS_PLATFORM.tee?=		/usr/bin/tee
+TOOLS_PLATFORM.test?=		test			# shell builtin
+TOOLS_PLATFORM.touch?=		/usr/bin/touch
+TOOLS_PLATFORM.tr?=		/usr/bin/tr
+TOOLS_PLATFORM.true?=		true			# shell builtin
+TOOLS_PLATFORM.tsort?=		/usr/bin/tsort
+TOOLS_PLATFORM.uniq?=		/usr/bin/uniq
+TOOLS_PLATFORM.unzip?=		/usr/bin/unzip
+TOOLS_PLATFORM.wc?=		/usr/bin/wc
+TOOLS_PLATFORM.xargs?=		/usr/bin/xargs
+TOOLS_PLATFORM.yacc?=		${QNX_HOST}/usr/bin/bison -y
+
+
+
+.if !empty(USE_CROSS_COMPILE:M[yY][eE][sS])
+.  for _t_ in ar as ld nm objcopy objdump ranlib readelf strip
+TOOLS_PATH.${MACHINE_GNU_PLATFORM}-${_t_}?=	\
+	${QNX_HOST}/usr/bin/nto${MACHINE_GNU_PLATFORM}-${_t_}
+TOOLS_CREATE+=	${MACHINE_GNU_PLATFORM}-${_t_}
+.  endfor
+TOOLS_PATH.ar?=			${QNX_HOST}/usr/bin/${MACHINE_GNU_PLATFORM}-ar
+TOOLS_CREATE+=			ar
+TOOLS_PATH.ranlib?=		${QNX_HOST}/usr/bin/${MACHINE_GNU_PLATFORM}-ranlib
+TOOLS_CREATE+=			ranlib
+
+NATIVE_CC:=	${QNX_HOST}/usr/bin/qcc
+CC=		${QNX_HOST}/usr/bin/qcc -V gcc_nto${MACHINE_GNU_PLATFORM}
+
+NATIVE_CXX:=	${QNX_HOST}/usr/bin/QCC
+CXX=		${QNX_HOST}/usr/bin/QCC -V gcc_nto${MACHINE_GNU_PLATFORM}
+
+NATIVE_LD:=	${QNX_HOST}/usr/bin/ld
+LD=		${QNX_HOST}/usr/bin/nto${MACHINE_GNU_PLATFORM}-ld
+
+.endif
+
Index: pkgtools/bootstrap-mk-files/files/bsd.lib.mk
===================================================================
RCS file: /cvsroot/pkgsrc/pkgtools/bootstrap-mk-files/files/bsd.lib.mk,v
retrieving revision 1.5
diff -u -r1.5 bsd.lib.mk
--- pkgtools/bootstrap-mk-files/files/bsd.lib.mk	26 Nov 2011 15:54:44 -0000	1.5
+++ pkgtools/bootstrap-mk-files/files/bsd.lib.mk	3 Jul 2015 19:43:04 -0000
@@ -350,7 +350,7 @@
 
 __archivebuild: .USE
 	@rm -f ${.TARGET}
-	${AR} cq ${.TARGET} `NM=${NM} ${LORDER} ${.ALLSRC:M*o} | ${TSORT}`
+	${AR} cq ${.TARGET} ${.ALLSRC:M*o}
 	${RANLIB} ${.TARGET}
 
 __archiveinstall: .USE
Index: pkgtools/bootstrap-mk-files/files/mods/QNX.sys.mk
===================================================================
RCS file: pkgtools/bootstrap-mk-files/files/mods/QNX.sys.mk
diff -N pkgtools/bootstrap-mk-files/files/mods/QNX.sys.mk
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ pkgtools/bootstrap-mk-files/files/mods/QNX.sys.mk	3 Jul 2015 19:43:04 -0000
@@ -0,0 +1,208 @@
+#	$NetBSD: sys.mk,v 1.1.1.1 2006/07/14 23:13:01 jlam Exp $
+#	@(#)sys.mk	8.2 (Berkeley) 3/21/94
+
+unix?=		We run Unix
+OS!=		uname -s
+
+.SUFFIXES: .out .a .ln .o .s .S .c .cc .cpp .cxx .C .F .f .r .y .l .cl .p .h
+.SUFFIXES: .sh .m4
+
+.LIBS:		.a
+
+AR?=		ar
+ARFLAGS?=	rl
+RANLIB?=	ranlib
+
+AS?=		as
+AFLAGS?=
+.if ${MACHINE_ARCH} == "sparc64" 
+AFLAGS+= -Wa,-Av9a
+.endif
+COMPILE.s?=	${CC} ${AFLAGS} -c
+LINK.s?=	${CC} ${AFLAGS} ${LDFLAGS}
+COMPILE.S?=	${CC} ${AFLAGS} ${CPPFLAGS} -c -traditional-cpp
+LINK.S?=	${CC} ${AFLAGS} ${CPPFLAGS} ${LDFLAGS}
+
+CC?=		gcc
+.if ${MACHINE_ARCH} == "alpha" || \
+    ${MACHINE_ARCH} == "arm" || ${MACHINE_ARCH} == "arm26" || \
+		${MACHINE_ARCH} == "arm32" || \
+    ${MACHINE_ARCH} == "i386" || \
+    ${MACHINE_ARCH} == "m68k" || \
+    ${MACHINE_ARCH} == "mipsel" || ${MACHINE_ARCH} == "mipseb" || \
+    ${MACHINE_ARCH} == "sparc" || \
+    ${MACHINE_ARCH} == "vax"
+DBG?=	-O2
+.elif ${MACHINE_ARCH} == "x86_64"
+DBG?=
+.else
+DBG?=	-O
+.endif
+CFLAGS?=	${DBG}
+COMPILE.c?=	${CC} ${CFLAGS} ${CPPFLAGS} -c
+LINK.c?=	${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}
+
+CXX?=		g++
+CXXFLAGS?=	${CFLAGS}
+COMPILE.cc?=	${CXX} ${CXXFLAGS} ${CPPFLAGS} -c
+LINK.cc?=	${CXX} ${CXXFLAGS} ${CPPFLAGS} ${LDFLAGS}
+
+OBJC?=		${CC}
+OBJCFLAGS?=	${CFLAGS}
+COMPILE.m?=	${OBJC} ${OBJCFLAGS} ${CPPFLAGS} -c
+LINK.m?=	${OBJC} ${OBJCFLAGS} ${CPPFLAGS} ${LDFLAGS}
+
+CPP?=		${QNX_HOST}/usr/bin/cpp
+CPPFLAGS?=	
+
+FC?=		f77
+FFLAGS?=	-O
+RFLAGS?=
+COMPILE.f?=	${FC} ${FFLAGS} -c
+LINK.f?=	${FC} ${FFLAGS} ${LDFLAGS}
+COMPILE.F?=	${FC} ${FFLAGS} ${CPPFLAGS} -c
+LINK.F?=	${FC} ${FFLAGS} ${CPPFLAGS} ${LDFLAGS}
+COMPILE.r?=	${FC} ${FFLAGS} ${RFLAGS} -c
+LINK.r?=	${FC} ${FFLAGS} ${RFLAGS} ${LDFLAGS}
+
+INSTALL?=	install
+
+LEX?=		lex
+LFLAGS?=
+LEX.l?=		${LEX} ${LFLAGS}
+
+LD?=		ld
+LDFLAGS?=
+
+LINT?=		lint
+LINTFLAGS?=	-chapbxzF
+
+LORDER?=	echo
+
+MAKE?=		make
+
+NM?=		nm
+
+PC?=		pc
+PFLAGS?=
+COMPILE.p?=	${PC} ${PFLAGS} ${CPPFLAGS} -c
+LINK.p?=	${PC} ${PFLAGS} ${CPPFLAGS} ${LDFLAGS}
+
+SHELL?=		sh
+
+SIZE?=		size
+
+TSORT?= 	tsort -q
+
+YACC?=		yacc
+YFLAGS?=
+YACC.y?=	${YACC} ${YFLAGS}
+
+# C
+.c:
+	${LINK.c} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
+.c.o:
+	${COMPILE.c} ${.IMPSRC}
+.c.a:
+	${COMPILE.c} ${.IMPSRC}
+	${AR} ${ARFLAGS} $@ $*.o
+	rm -f $*.o
+.c.ln:
+	${LINT} ${LINTFLAGS} ${CPPFLAGS:M-[IDU]*} -i ${.IMPSRC}
+
+# C++
+.cc .cpp .cxx .C:
+	${LINK.cc} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
+.cc.o .cpp.o .cxx.o .C.o:
+	${COMPILE.cc} ${.IMPSRC}
+.cc.a .cpp.a .cxx.a .C.a:
+	${COMPILE.cc} ${.IMPSRC}
+	${AR} ${ARFLAGS} $@ $*.o
+	rm -f $*.o
+
+# Fortran/Ratfor
+.f:
+	${LINK.f} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
+.f.o:
+	${COMPILE.f} ${.IMPSRC}
+.f.a:
+	${COMPILE.f} ${.IMPSRC}
+	${AR} ${ARFLAGS} $@ $*.o
+	rm -f $*.o
+
+.F:
+	${LINK.F} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
+.F.o:
+	${COMPILE.F} ${.IMPSRC}
+.F.a:
+	${COMPILE.F} ${.IMPSRC}
+	${AR} ${ARFLAGS} $@ $*.o
+	rm -f $*.o
+
+.r:
+	${LINK.r} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
+.r.o:
+	${COMPILE.r} ${.IMPSRC}
+.r.a:
+	${COMPILE.r} ${.IMPSRC}
+	${AR} ${ARFLAGS} $@ $*.o
+	rm -f $*.o
+
+# Pascal
+.p:
+	${LINK.p} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
+.p.o:
+	${COMPILE.p} ${.IMPSRC}
+.p.a:
+	${COMPILE.p} ${.IMPSRC}
+	${AR} ${ARFLAGS} $@ $*.o
+	rm -f $*.o
+
+# Assembly
+.s:
+	${LINK.s} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
+.s.o:
+	${COMPILE.s} ${.IMPSRC}
+.s.a:
+	${COMPILE.s} ${.IMPSRC}
+	${AR} ${ARFLAGS} $@ $*.o
+	rm -f $*.o
+.S:
+	${LINK.S} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
+.S.o:
+	${COMPILE.S} ${.IMPSRC}
+.S.a:
+	${COMPILE.S} ${.IMPSRC}
+	${AR} ${ARFLAGS} $@ $*.o
+	rm -f $*.o
+
+# Lex
+.l:
+	${LEX.l} ${.IMPSRC}
+	${LINK.c} -o ${.TARGET} lex.yy.c ${LDLIBS} -ll
+	rm -f lex.yy.c
+.l.c:
+	${LEX.l} ${.IMPSRC}
+	mv lex.yy.c ${.TARGET}
+.l.o:
+	${LEX.l} ${.IMPSRC}
+	${COMPILE.c} -o ${.TARGET} lex.yy.c 
+	rm -f lex.yy.c
+
+# Yacc
+.y:
+	${YACC.y} ${.IMPSRC}
+	${LINK.c} -o ${.TARGET} y.tab.c ${LDLIBS}
+	rm -f y.tab.c
+.y.c:
+	${YACC.y} ${.IMPSRC}
+	mv y.tab.c ${.TARGET}
+.y.o:
+	${YACC.y} ${.IMPSRC}
+	${COMPILE.c} -o ${.TARGET} y.tab.c
+	rm -f y.tab.c
+
+# Shell
+.sh:
+	rm -f ${.TARGET}
+	cp ${.IMPSRC} ${.TARGET}


Home | Main Index | Thread Index | Old Index