Import NetBSD tools and build.sh
This commit finalizes support for cross compilation. The tools directory are all links to the actual tools and are built on the host system to build Minix. build.sh is the work horse that takes care of all environment settings. It's slightly adjusted for Minix. The /usr/src/Makefile has additional targets needed for cross compilation.
This commit is contained in:
parent
2ed11343a6
commit
c8a0e2f4c6
140 changed files with 26869 additions and 0 deletions
8
Makefile
8
Makefile
|
@ -27,7 +27,15 @@ usage:
|
|||
# etcfiles also creates a directory hierarchy in its
|
||||
# 'make install' target.
|
||||
#
|
||||
|
||||
# etcfiles has to be done first.
|
||||
|
||||
distribution: etcfiles includes mkfiles libraries do-libgcc .WAIT dep-all install etcforce
|
||||
|
||||
do-libgcc: .PHONY .MAKE
|
||||
${MAKEDIRTARGET} external/gpl3/gcc/lib/libgcc/libgcc all
|
||||
${MAKEDIRTARGET} external/gpl3/gcc/lib/libgcc/libgcc install
|
||||
|
||||
world: mkfiles etcfiles includes libraries dep-all install etcforce
|
||||
|
||||
# subdirs where userland utilities and other executables live
|
||||
|
|
110
tools/Makefile
Normal file
110
tools/Makefile
Normal file
|
@ -0,0 +1,110 @@
|
|||
# $NetBSD: Makefile,v 1.155 2011/11/03 07:42:56 joerg Exp $
|
||||
|
||||
.include <bsd.own.mk>
|
||||
|
||||
HAVE_GCC= 45
|
||||
|
||||
# Dependencies in SUBDIR below ordered to maximize parallel ability.
|
||||
SUBDIR= host-mkdep .WAIT compat .WAIT \
|
||||
binstall .WAIT mktemp .WAIT sed .WAIT \
|
||||
genassym \
|
||||
makewhatis mkdep \
|
||||
m4 \
|
||||
.WAIT yacc \
|
||||
.WAIT awk \
|
||||
.WAIT tic \
|
||||
.WAIT lex \
|
||||
.WAIT gmake .WAIT binutils .WAIT gcc \
|
||||
cat pwd_mkdb stat zic \
|
||||
|
||||
|
||||
|
||||
.if ${MKTOOLS:Uyes} == "no" || ${USETOOLS} != "yes" # {
|
||||
realall realdepend install: check_MKTOOLS
|
||||
|
||||
.for dir in ${SUBDIR:N.WAIT}
|
||||
all-${dir} depend-${dir} dependall-${dir} install-${dir}:
|
||||
@true
|
||||
.endfor
|
||||
.endif # }
|
||||
|
||||
.include <bsd.subdir.mk>
|
||||
.include <bsd.obj.mk>
|
||||
|
||||
.if !defined(PREVIOUSTOOLDIR)
|
||||
. if exists(PREVIOUSTOOLDIR)
|
||||
PREVIOUSTOOLDIR!= cat PREVIOUSTOOLDIR
|
||||
. else
|
||||
PREVIOUSTOOLDIR=
|
||||
. endif
|
||||
.endif
|
||||
|
||||
CLEANFILES+= PREVIOUSTOOLDIR
|
||||
|
||||
realall realdepend: .MAKE
|
||||
.if !empty(PREVIOUSTOOLDIR) && "${PREVIOUSTOOLDIR}" != "${TOOLDIR}"
|
||||
@echo "*** WARNING: TOOLDIR has moved?"
|
||||
@echo "*** PREVIOUSTOOLDIR '${PREVIOUSTOOLDIR}'"
|
||||
@echo "*** != TOOLDIR '${TOOLDIR}'"
|
||||
@echo "*** Cleaning mis-matched tools"
|
||||
rm -f PREVIOUSTOOLDIR
|
||||
(cd ${.CURDIR} && ${MAKE} PREVIOUSTOOLDIR=${TOOLDIR} cleandir)
|
||||
.endif
|
||||
echo ${TOOLDIR} >PREVIOUSTOOLDIR
|
||||
|
||||
# For each .WAIT point, make sure the immediately preceding target is
|
||||
# installed before building anything after that point.
|
||||
# (dsl: which means that with: 'a b .WAIT c' the build of 'c' waits for the
|
||||
# install of 'b', but not the install of 'a'.)
|
||||
#
|
||||
# We use the "internal" targets and dependencies generated by <bsd.subdir.mk>
|
||||
# to achieve this. These targets look like:
|
||||
# subdir-all: all-dir1 [.WAIT] all-dir2 etc..
|
||||
# subdir-install: install-dir1 [.WAIT] install-dir2 etc..
|
||||
# and so on for each element in ${TARGETS}, with .WAIT sources inserted at
|
||||
# places corresponding to the .WAITs in our $SUBDIR variable.
|
||||
#
|
||||
# Also, since we're now mixing `install' with `all' and `depend' targets
|
||||
# an order relationship between those in each individual subdirectory
|
||||
# must be established.
|
||||
#
|
||||
_deps:=
|
||||
_prev:=
|
||||
|
||||
.for d in ${SUBDIR} # {
|
||||
_this:= ${d}
|
||||
|
||||
.if ${_this} == ".WAIT" # {
|
||||
|
||||
# setup dependency to apply to all/depend targets in the next group
|
||||
_deps:= ${_deps} ${_prev:S/^/install-/}
|
||||
|
||||
# if we're building *only* individual targets (i.e. "dependall-yacc"),
|
||||
# make sure prerequisite tools build before installing
|
||||
# XXX: dsl: this is likely to generate a dependency loop since there is
|
||||
# a .ORDER releation between the nodes as well.
|
||||
.if !make(all) && !make(dependall) && !make(install)
|
||||
install-${_prev}: dependall-${_prev}
|
||||
.endif
|
||||
|
||||
.else # ${_this} != ".WAIT" # } {
|
||||
|
||||
# order depend/all/install targets for ${d} subdir.
|
||||
.ORDER: depend-${d} all-${d} dependall-${d} install-${d}
|
||||
|
||||
# prevent cleandir in real{all,depend} from interfering with subdir makes
|
||||
.ORDER: realdepend dependall-${d}
|
||||
.ORDER: realdepend depend-${d}
|
||||
.ORDER: realall all-${d}
|
||||
|
||||
# make all/depend-${d} dependent on list of install targets
|
||||
depend-${d} all-${d} dependall-${d}: ${_deps}
|
||||
|
||||
.endif # ${_this} != ".WAIT" # }
|
||||
|
||||
# stash current name in case the next entry is .WAIT
|
||||
_prev:= ${d}
|
||||
.endfor # }
|
||||
|
||||
cleandir:
|
||||
rm -f ${CLEANFILES}
|
21
tools/Makefile.gmakehost
Normal file
21
tools/Makefile.gmakehost
Normal file
|
@ -0,0 +1,21 @@
|
|||
# $NetBSD: Makefile.gmakehost,v 1.7 2012/01/20 23:01:05 christos Exp $
|
||||
#
|
||||
# Rules used when building a GNU host package. Expects MODULE to be set.
|
||||
# This version runs ${TOOL_GMAKE} instead of ${MAKE}
|
||||
#
|
||||
# There's not a lot we can do to build reliably in the face of many
|
||||
# available configuration options. To be as low-overhead as possible,
|
||||
# we follow the following scheme:
|
||||
#
|
||||
# * Configuration is only re-run when an autoconf source file (such as
|
||||
# "configure" or "config.sub") is changed.
|
||||
#
|
||||
# * "config.status" is run to rebuild Makefiles and .h files if an
|
||||
# autoconf-parsed file (such as Makefile.in) is changed.
|
||||
#
|
||||
# * If MKUPDATE != "no", "make install" is only run if a build has happened
|
||||
# since the last install in the current directory.
|
||||
|
||||
.include <bsd.own.mk>
|
||||
MAKE_PROGRAM=${TOOL_GMAKE}
|
||||
.include "Makefile.gnuhost"
|
144
tools/Makefile.gnuhost
Normal file
144
tools/Makefile.gnuhost
Normal file
|
@ -0,0 +1,144 @@
|
|||
# $NetBSD: Makefile.gnuhost,v 1.37 2012/01/21 22:31:15 christos Exp $
|
||||
#
|
||||
# Rules used when building a GNU host package. Expects MODULE to be set.
|
||||
#
|
||||
# There's not a lot we can do to build reliably in the face of many
|
||||
# available configuration options. To be as low-overhead as possible,
|
||||
# we follow the following scheme:
|
||||
#
|
||||
# * Configuration is only re-run when an autoconf source file (such as
|
||||
# "configure" or "config.sub") is changed.
|
||||
#
|
||||
# * "config.status" is run to rebuild Makefiles and .h files if an
|
||||
# autoconf-parsed file (such as Makefile.in) is changed.
|
||||
#
|
||||
# * If MKUPDATE != "no", "make install" is only run if a build has happened
|
||||
# since the last install in the current directory.
|
||||
|
||||
.include <bsd.own.mk>
|
||||
|
||||
# Disable use of pre-compiled headers on Darwin.
|
||||
BUILD_OSTYPE!= uname -s
|
||||
.if ${BUILD_OSTYPE} == "Darwin"
|
||||
HOST_CFLAGS+=-O2 -no-cpp-precomp
|
||||
.endif
|
||||
MAKE_PROGRAM?= ${MAKE}
|
||||
|
||||
GNUHOSTDIST?= ${.CURDIR}/../../external/gpl3/gcc/dist/
|
||||
|
||||
FIND_ARGS+= \! \( -type d \( \
|
||||
-name 'CVS' -o \
|
||||
-name 'config' -o \
|
||||
-name 'doc' -o \
|
||||
-name 'po' -o \
|
||||
-name 'nbsd.mt' -o \
|
||||
-name 'tests*' \
|
||||
\) -prune \)
|
||||
|
||||
|
||||
_GNU_GET_SRC!= ${HOST_SH} ${.CURDIR}/../../external/gpl3/gcc/fetch.sh && \
|
||||
${HOST_SH} ${.CURDIR}/../../external/gpl3/binutils/fetch.sh && \
|
||||
${HOST_SH} ${.CURDIR}/../../gnu/dist/fetch.sh
|
||||
|
||||
# Do this "find" only if actually building something.
|
||||
.if (${USETOOLS} == "yes") && empty(.MAKEFLAGS:M-V*) && \
|
||||
(make(all) || make(realall) || (!make(clean) && !make(cleandir) && !make(obj))) && \
|
||||
!defined(_GNU_CFGSRC)
|
||||
|
||||
_GNU_CFGSRC!= find ${GNUHOSTDIST} ${FIND_ARGS} \
|
||||
-type f \( -name 'config*' -o -name '*.in' \) -print
|
||||
.MAKEOVERRIDES+= _GNU_CFGSRC
|
||||
.endif
|
||||
|
||||
CONFIGURE_ENV+= \
|
||||
AR=${HOST_AR:Q} \
|
||||
AWK=${TOOL_AWK:Q} \
|
||||
CC=${HOST_CC:Q} \
|
||||
CFLAGS=${HOST_CFLAGS:Q} \
|
||||
CPPFLAGS=${HOST_CPPFLAGS:Q} \
|
||||
CXX=${HOST_CXX:Q} \
|
||||
CXXFLAGS=${HOST_CXXFLAGS:Q} \
|
||||
INSTALL=${HOST_INSTALL_FILE:Q} \
|
||||
LDFLAGS=${HOST_LDFLAGS:Q} \
|
||||
LEX=${LEX:Q} \
|
||||
M4=${TOOL_M4:Q} \
|
||||
MAKE=${MAKE_PROGRAM:Q} \
|
||||
PATH="${TOOLDIR}/bin:$$PATH" \
|
||||
RANLIB=${HOST_RANLIB:Q} \
|
||||
YACC=${YACC:Q}
|
||||
|
||||
BUILD_ENV+= ${CONFIGURE_ENV}
|
||||
|
||||
CONFIGURE_ARGS+=--prefix=${TOOLDIR}
|
||||
.if ${MKPIC} == "no"
|
||||
CONFIGURE_ARGS+=--disable-shared
|
||||
.endif
|
||||
|
||||
.if ${MAKE_PROGRAM} == ${MAKE}
|
||||
.ifndef _NOWRAPPER
|
||||
# Some systems have a small ARG_MAX. On such systems, prevent Make
|
||||
# variables set on the command line from being exported in the
|
||||
# environment (they will still be set in MAKEOVERRIDES).
|
||||
.if ${BUILD_OSTYPE} == "Darwin" || ${BUILD_OSTYPE} == "FreeBSD"
|
||||
__noenvexport= -X
|
||||
.endif
|
||||
MAKE_ARGS:= ${__noenvexport} -f ${.PARSEDIR}/Makefile.gnuwrap ${MAKE_ARGS}
|
||||
.else
|
||||
MAKE_ARGS+= _NOWRAPPER=1
|
||||
.endif
|
||||
BUILD_COMMAND= ${BUILD_ENV} ${MAKE} ${MAKE_ARGS}
|
||||
.else
|
||||
|
||||
# gmake version of this puts MAKE_ARGS in the environment to be sure that
|
||||
# sub-gmake's get them, otherwise tools/gcc tries to build libgcc and
|
||||
# fails. it also uses "env -i" to entirely clear out MAKEFLAGS.
|
||||
GMAKE_J_ARGS?= ${MAKEFLAGS:[*]:M*-j*:C/.*(-j ?[0-9]*).*/\1/W}
|
||||
BUILD_COMMAND= /usr/bin/env -i ${BUILD_ENV} ${MAKE_ARGS} ${TOOL_GMAKE} ${GMAKE_J_ARGS} -e ${MAKE_ARGS}
|
||||
|
||||
.endif
|
||||
|
||||
MAKE_ARGS+= BISON=true DESTDIR= INSTALL=${HOST_INSTALL_FILE:Q}
|
||||
|
||||
ALL_TARGET?= all
|
||||
INSTALL_TARGET?=install
|
||||
|
||||
BUILD_PLATFORM!= uname -srm | tr ' ' '-'
|
||||
CONFIGURE_PLATFORM!= if [ -s .configure_done ]; then cat .configure_done; else echo none; fi
|
||||
.if "${BUILD_PLATFORM}" != "${CONFIGURE_PLATFORM}"
|
||||
configure_cleanup:
|
||||
@mkdir build 2>/dev/null || true
|
||||
@(echo "Cleaning stale cache files ${BUILD_PLATFORM} != ${CONFIGURE_PLATFORM}")
|
||||
@(cd build && find . -name config.cache -print0 | xargs -0 rm -f)
|
||||
configure_cleanup=configure_cleanup
|
||||
.endif
|
||||
|
||||
.configure_done: ${_GNU_CFGSRC} ${.CURDIR}/Makefile ${configure_cleanup}
|
||||
@mkdir build 2>/dev/null || true
|
||||
@(cd build && ${CONFIGURE_ENV} ${HOST_SH} ${GNUHOSTDIST}/configure ${CONFIGURE_ARGS})
|
||||
@echo ${BUILD_PLATFORM} > $@
|
||||
|
||||
# The .build_done timestamp is only updated if a file actually changes
|
||||
# in the build tree during "make all". This way, if nothing has changed,
|
||||
# a "make install MKUPDATE=yes" will do nothing.
|
||||
|
||||
.build_done: .configure_done
|
||||
@(cd build && ${BUILD_COMMAND} ${ALL_TARGET})
|
||||
@if [ ! -f $@ ] || [ -n "$$(find build -type f -newer .build_done -print)" ]; \
|
||||
then touch $@; fi
|
||||
|
||||
.install_done! ${BUILD:D.build_done}
|
||||
@(cd ${.OBJDIR}/build && ${BUILD_COMMAND} ${INSTALL_TARGET})
|
||||
@touch $@
|
||||
|
||||
# Mapping to standard targets.
|
||||
|
||||
.if ${USETOOLS} == "yes"
|
||||
realall: .build_done
|
||||
realinstall: .install_done
|
||||
.endif
|
||||
|
||||
clean: clean.gnu
|
||||
clean.gnu:
|
||||
-rm -r -f .*_done build
|
||||
|
||||
.include <bsd.hostprog.mk>
|
33
tools/Makefile.gnuwrap
Normal file
33
tools/Makefile.gnuwrap
Normal file
|
@ -0,0 +1,33 @@
|
|||
# $NetBSD: Makefile.gnuwrap,v 1.9 2003/03/14 05:22:51 thorpej Exp $
|
||||
#
|
||||
# Wrapper for GNU Makefiles.
|
||||
|
||||
.ifndef _WRAPPER_INCLUDED
|
||||
_WRAPPER_INCLUDED=1
|
||||
|
||||
.ifndef _NOWRAPPER
|
||||
.include "${.CURDIR}/Makefile"
|
||||
.endif
|
||||
|
||||
# Prevent targets in source directories from being rebuilt.
|
||||
|
||||
_srcdir:= ${srcdir}
|
||||
.MADE: ${.ALLTARGETS:M${_srcdir}/*} Makefile
|
||||
|
||||
# Don't rebuild .gmo files, or lex/yacc (which GNU puts in the source tree).
|
||||
.po.gmo .l.c .y.c .y.h .x.1:
|
||||
@true
|
||||
|
||||
# Make sure this file gets re-loaded recursively.
|
||||
.ifndef _NOWRAPPER
|
||||
# Some systems have a small ARG_MAX. On such systems, prevent Make
|
||||
# variables set on the command line from being exported in the
|
||||
# environment (they will still be set in MAKEOVERRIDES).
|
||||
BUILD_OSTYPE!= uname -s
|
||||
.if ${BUILD_OSTYPE} == "Darwin" || ${BUILD_OSTYPE} == "FreeBSD"
|
||||
__noenvexport= -X
|
||||
.endif
|
||||
_GNUWRAPPER:= ${.PARSEDIR}/${.PARSEFILE}
|
||||
MAKE:= ${MAKE} ${__noenvexport} -f ${_GNUWRAPPER}
|
||||
.endif
|
||||
.endif
|
78
tools/Makefile.host
Normal file
78
tools/Makefile.host
Normal file
|
@ -0,0 +1,78 @@
|
|||
# $NetBSD: Makefile.host,v 1.28 2011/04/10 16:52:36 joerg Exp $
|
||||
|
||||
NOINFO= # defined
|
||||
NOLINT= # defined
|
||||
NOMAN= # defined
|
||||
|
||||
.include <bsd.own.mk>
|
||||
|
||||
.ifndef NOCOMPATLIB
|
||||
COMPATOBJ!= cd ${.CURDIR}/../compat && ${PRINTOBJDIR}
|
||||
.-include "${COMPATOBJ}/defs.mk"
|
||||
.endif
|
||||
|
||||
# Resolve pathnames in variables.
|
||||
_RESOLVE_VARS= CFLAGS CPPFLAGS DPADD HOST_CPPFLAGS LDADD
|
||||
.for var in ${_RESOLVE_VARS}
|
||||
${var}:= ${${var}}
|
||||
.endfor
|
||||
|
||||
# Switch over to the "real" Makefile.
|
||||
.PROGDIR:= ${.CURDIR}/../../${HOST_SRCDIR}
|
||||
_CURDIR:= ${.CURDIR}
|
||||
HOSTPROG?= ${PROG}
|
||||
|
||||
.CURDIR:= ${.PROGDIR}
|
||||
.PATH: ${.CURDIR}
|
||||
.include "${.CURDIR}/Makefile"
|
||||
.-include "${.CURDIR}/../Makefile.inc"
|
||||
|
||||
# Resolve pathnames from "real" Makefile, and switch .CURDIR back.
|
||||
.for var in ${_RESOLVE_VARS}
|
||||
${var}:= ${${var}}
|
||||
.endfor
|
||||
.CURDIR:= ${_CURDIR}
|
||||
.undef _CURDIR
|
||||
|
||||
# Set up the environment for <bsd.hostprog.mk>.
|
||||
.if ${USETOOLS} != "yes"
|
||||
.undef HOSTPROG
|
||||
.endif
|
||||
|
||||
HOSTPROGNAME?= ${HOSTPROG}
|
||||
HOST_BINDIR?= ${TOOLDIR}/bin
|
||||
HOST_CPPFLAGS:= ${HOST_CPPFLAGS} ${CPPFLAGS}
|
||||
HOST_CPPFLAGS:= ${HOST_CPPFLAGS:N-Wp,-iremap,*:N--sysroot=*}
|
||||
.undef LINKS
|
||||
|
||||
SRCS?= ${HOSTPROG}.c
|
||||
SRCS+= ${HOST_SRCS}
|
||||
|
||||
.PATH: ${.PROGDIR}
|
||||
|
||||
# Install rule.
|
||||
realinstall: install.host install.files
|
||||
install.host: ${HOST_BINDIR}/${HOSTPROGNAME}
|
||||
${HOST_BINDIR}/${HOSTPROGNAME}:: ${HOSTPROG}
|
||||
${_MKTARGET_INSTALL}
|
||||
mkdir -p ${HOST_BINDIR}
|
||||
${HOST_INSTALL_FILE} -m ${BINMODE} ${HOSTPROG}${HOSTEXEEXT} ${.TARGET}
|
||||
|
||||
.if ${MKUPDATE} == "no"
|
||||
.PHONY: ${HOST_BINDIR}/${HOSTPROGNAME}
|
||||
.endif
|
||||
|
||||
install.files:
|
||||
.for F in ${HOSTFILES}
|
||||
install.files: ${HOST_FILESDIR}/${F}
|
||||
${HOST_FILESDIR}/${F}: ${F}
|
||||
${_MKTARGET_INSTALL}
|
||||
mkdir -p ${HOST_FILESDIR}
|
||||
${HOST_INSTALL_FILE} -m ${NONBINMODE} ${.ALLSRC} ${.TARGET}
|
||||
|
||||
.if ${MKUPDATE} == "no"
|
||||
.PHONY: ${HOST_FILESDIR}/${F}
|
||||
.endif
|
||||
.endfor
|
||||
|
||||
.include <bsd.hostprog.mk>
|
7
tools/awk/Makefile
Normal file
7
tools/awk/Makefile
Normal file
|
@ -0,0 +1,7 @@
|
|||
# $NetBSD: Makefile,v 1.3 2010/12/12 04:06:19 christos Exp $
|
||||
|
||||
HOSTPROGNAME= ${_TOOL_PREFIX}awk
|
||||
HOST_SRCDIR= external/historical/nawk/bin
|
||||
HOST_CPPFLAGS+= -D__EXTENSIONS__ # for isblank
|
||||
|
||||
.include "${.CURDIR}/../Makefile.host"
|
10
tools/binstall/Makefile
Normal file
10
tools/binstall/Makefile
Normal file
|
@ -0,0 +1,10 @@
|
|||
# $NetBSD: Makefile,v 1.7 2007/07/03 16:29:24 joerg Exp $
|
||||
|
||||
HOSTPROGNAME= ${MACHINE_GNU_PLATFORM}-install
|
||||
HOST_SRCDIR= usr.bin/xinstall
|
||||
CPPFLAGS+= -I${.CURDIR}/../compat/sys
|
||||
CPPFLAGS+= -DTARGET_STRIP=\"${STRIP}\"
|
||||
|
||||
.include "${.CURDIR}/../Makefile.host"
|
||||
|
||||
INSTALL= ./xinstall
|
74
tools/binutils/Makefile
Normal file
74
tools/binutils/Makefile
Normal file
|
@ -0,0 +1,74 @@
|
|||
# $NetBSD: Makefile,v 1.22 2012/04/15 08:37:32 mrg Exp $
|
||||
|
||||
.include <bsd.own.mk>
|
||||
|
||||
MODULE= binutils
|
||||
|
||||
GNUHOSTDIST= ${.CURDIR}/../../external/gpl3/binutils/dist
|
||||
|
||||
BRANDING?= \
|
||||
--with-pkgversion="NetBSD Binutils nb1" \
|
||||
--with-bugurl="http://www.NetBSD.org/support/send-pr.html" \
|
||||
--with-lib-path="=/usr/lib" --with-sysroot
|
||||
|
||||
CONFIGURE_ARGS= --target=${MACHINE_GNU_PLATFORM} --disable-nls \
|
||||
--program-transform-name="s,^,${MACHINE_GNU_PLATFORM}-," \
|
||||
--disable-werror \
|
||||
--target=i386-elf-minix \
|
||||
${BRANDING}
|
||||
|
||||
MAKE_ARGS= MACHINE= MAKEINFO=${TOOL_MAKEINFO:Q}
|
||||
|
||||
ALL_TARGET= all-binutils all-gas all-ld
|
||||
INSTALL_TARGET= install-binutils install-gas install-ld
|
||||
.if ${MKCROSSGPROF:Uno} != "no"
|
||||
ALL_TARGET+= all-gprof
|
||||
INSTALL_TARGET+=install-gprof
|
||||
.endif
|
||||
|
||||
.include "${.CURDIR}/../Makefile.gnuhost"
|
||||
|
||||
CCADDFLAGS= -I${DESTDIR}/usr/include -L${DESTDIR}/lib -L${DESTDIR}/usr/lib -B${DESTDIR}/usr/lib/
|
||||
|
||||
# Force avoiding possibly non-executable install-sh.
|
||||
CONFIGURE_ENV+= ac_cv_path_mkdir="${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-install -d"
|
||||
|
||||
NEWCONFIGDIR?= ${.CURDIR}/../..
|
||||
MKNATIVE?= ${.CURDIR}/mknative-binutils
|
||||
|
||||
native-binutils: .native/.configure_done
|
||||
@echo 'Extracting GNU binutils configury for a native toolchain.'
|
||||
MAKE=${MAKE:Q} ${HOST_SH} ${MKNATIVE} binutils \
|
||||
${.OBJDIR}/.native ${NEWCONFIGDIR} ${MACHINE_GNU_PLATFORM}
|
||||
|
||||
.native/.configure_done: ${_GNU_CFGSRC} ${.CURDIR}/Makefile
|
||||
mkdir .native 2>/dev/null || true
|
||||
PATH=${TOOLDIR}/bin:$$PATH; export PATH; \
|
||||
(cd .native && ${CONFIGURE_ENV:NC*:NLD*} \
|
||||
CC_FOR_BUILD=${HOST_CC:Q} \
|
||||
CC=${CC:Q}' '${CCADDFLAGS:Q} \
|
||||
CXX=${CXX:Q}' '${CCADDFLAGS:Q} \
|
||||
CPP=${CPP:Q}' '-I${DESTDIR}/usr/include \
|
||||
CFLAGS= CPPFLAGS= CXXFLAGS= LDFLAGS= \
|
||||
MSGFMT=${TOOLDIR}/bin/${_TOOL_PREFIX}msgfmt \
|
||||
XGETTEXT=${TOOLDIR}/bin/${_TOOL_PREFIX}xgettext \
|
||||
LIBS=-lintl \
|
||||
ac_cv_prog_cc_cross=yes \
|
||||
ac_cv_func_strcoll_works=yes \
|
||||
${HOST_SH} ${GNUHOSTDIST}/configure \
|
||||
--build=`${GNUHOSTDIST}/config.guess` \
|
||||
--host=${MACHINE_GNU_PLATFORM} \
|
||||
--target=${MACHINE_GNU_PLATFORM} \
|
||||
${BRANDING} \
|
||||
)
|
||||
PATH=${TOOLDIR}/bin:$$PATH; export PATH; \
|
||||
(cd .native && ${MAKE} configure-host)
|
||||
PATH=${TOOLDIR}/bin:$$PATH; export PATH; \
|
||||
(cd .native/bfd && ${MAKE} bfd.h bfdver.h)
|
||||
PATH=${TOOLDIR}/bin:$$PATH; export PATH; \
|
||||
(cd .native/ld && ${MAKE} ldemul-list.h)
|
||||
@touch $@
|
||||
|
||||
clean: clean.native
|
||||
clean.native:
|
||||
-rm -r -f .native
|
144
tools/binutils/mknative-binutils
Executable file
144
tools/binutils/mknative-binutils
Executable file
|
@ -0,0 +1,144 @@
|
|||
#!/bin/sh
|
||||
# $NetBSD: mknative-binutils,v 1.8 2011/09/25 04:00:58 christos Exp $
|
||||
#
|
||||
# Shell script for generating all the constants needed for a native
|
||||
# platform build of src/external/gpl3/binutils
|
||||
#
|
||||
|
||||
# initialise
|
||||
|
||||
_TMPDIR=$2
|
||||
_TOP=$3
|
||||
_PLATFORM=$4
|
||||
_VPATH=`grep VPATH ${_TMPDIR}/Makefile | sed 's,^.*=[ ]*,,'`
|
||||
|
||||
. $_TOP/tools/gcc/mknative.common
|
||||
|
||||
##### external/gpl3/binutils/lib/libbfd #####
|
||||
|
||||
get_libbfd () {
|
||||
mkdir -p $_TOP/external/gpl3/binutils/lib/libbfd/arch/$MACHINE_ARCH
|
||||
|
||||
{
|
||||
getvars bfd/Makefile \
|
||||
libbfd_la_DEPENDENCIES libbfd_la_OBJECTS DEFS \
|
||||
INCLUDES TDEFAULTS
|
||||
} | write_mk external/gpl3/binutils/lib/libbfd/arch/$MACHINE_ARCH/defs.mk
|
||||
|
||||
write_c external/gpl3/binutils/lib/libbfd/arch/$MACHINE_ARCH/bfd.h <$_TMPDIR/bfd/bfd.h
|
||||
write_c external/gpl3/binutils/lib/libbfd/arch/$MACHINE_ARCH/bfdver.h <$_TMPDIR/bfd/bfdver.h
|
||||
write_c external/gpl3/binutils/lib/libbfd/arch/$MACHINE_ARCH/bfd_stdint.h <$_TMPDIR/bfd/bfd_stdint.h
|
||||
|
||||
{
|
||||
cat $_TMPDIR/bfd/config.h
|
||||
} | write_c external/gpl3/binutils/lib/libbfd/arch/$MACHINE_ARCH/config.h
|
||||
}
|
||||
|
||||
##### external/gpl3/binutils/lib/libopcodes #####
|
||||
|
||||
get_libopcodes () {
|
||||
mkdir -p $_TOP/external/gpl3/binutils/lib/libopcodes/arch/$MACHINE_ARCH
|
||||
|
||||
{
|
||||
getvars opcodes/Makefile \
|
||||
archdefs BFD_MACHINES libopcodes_la_SOURCES
|
||||
} | write_mk external/gpl3/binutils/lib/libopcodes/arch/$MACHINE_ARCH/defs.mk
|
||||
|
||||
{
|
||||
cat $_TMPDIR/opcodes/config.h
|
||||
} | write_c external/gpl3/binutils/lib/libopcodes/arch/$MACHINE_ARCH/config.h
|
||||
}
|
||||
|
||||
##### external/gpl3/binutils/lib/libiberty #####
|
||||
|
||||
get_libiberty () {
|
||||
mkdir -p $_TOP/external/gpl3/binutils/lib/libiberty/arch/$MACHINE_ARCH
|
||||
|
||||
getvars libiberty/Makefile \
|
||||
ALLOCA EXTRA_OFILES LIBOBJS REQUIRED_OFILES \
|
||||
| write_mk external/gpl3/binutils/lib/libiberty/arch/$MACHINE_ARCH/defs.mk
|
||||
|
||||
write_c external/gpl3/binutils/lib/libiberty/arch/$MACHINE_ARCH/config.h \
|
||||
<$_TMPDIR/libiberty/config.h
|
||||
}
|
||||
|
||||
##### external/gpl3/binutils/usr.bin #####
|
||||
|
||||
get_binutils () {
|
||||
### common
|
||||
|
||||
mkdir -p $_TOP/external/gpl3/binutils/usr.bin/common/arch/$MACHINE_ARCH
|
||||
|
||||
{
|
||||
getvars binutils/Makefile \
|
||||
VERSION DEFS INCLUDES PROGRAMS
|
||||
getvars binutils/doc/Makefile \
|
||||
man_MANS TEXINFOS
|
||||
getvars bfd/doc/Makefile \
|
||||
PKGVERSION | sed 's,\\\(.\),\1,'
|
||||
getvars bfd/doc/Makefile \
|
||||
REPORT_BUGS_TEXI
|
||||
|
||||
for f in `getvars binutils/Makefile PROGRAMS | sed 'y,-,_,;s,^[^=]*=,,'`; do
|
||||
getvars binutils/Makefile ${f}_OBJECTS ${f}_DEPENDENCIES
|
||||
done
|
||||
} | write_mk external/gpl3/binutils/usr.bin/common/arch/$MACHINE_ARCH/defs.mk
|
||||
|
||||
write_c external/gpl3/binutils/usr.bin/common/arch/$MACHINE_ARCH/config.h \
|
||||
<$_TMPDIR/binutils/config.h
|
||||
|
||||
### gas
|
||||
|
||||
mkdir -p $_TOP/external/gpl3/binutils/usr.bin/gas/arch/$MACHINE_ARCH
|
||||
|
||||
grep -v DEPDIR "$_TMPDIR/gas/Makefile" > "$_TMPDIR/gas/Makefile.nodeps"
|
||||
getvars gas/Makefile.nodeps \
|
||||
DEFS INCLUDES as_new_OBJECTS as_new_LDADD |
|
||||
sed -e s/G_as_new_OBJECTS/G_OBJS/ \
|
||||
-e s/G_as_new_LDADD=/G_OBJS+=/ \
|
||||
-e 's/\.\..*a//' |
|
||||
write_mk external/gpl3/binutils/usr.bin/gas/arch/$MACHINE_ARCH/defs.mk
|
||||
|
||||
for f in config itbl-cpu obj-format targ-cpu targ-env; do
|
||||
write_c external/gpl3/binutils/usr.bin/gas/arch/$MACHINE_ARCH/$f.h <$_TMPDIR/gas/$f.h
|
||||
done
|
||||
|
||||
### gprof
|
||||
|
||||
mkdir -p $_TOP/external/gpl3/binutils/usr.bin/gprof/arch/$MACHINE_ARCH
|
||||
|
||||
getvars gprof/Makefile \
|
||||
DEFS gprof_OBJECTS INCLUDES TEXINFOS \
|
||||
| write_mk external/gpl3/binutils/usr.bin/gprof/arch/$MACHINE_ARCH/defs.mk
|
||||
|
||||
write_c external/gpl3/binutils/usr.bin/gprof/arch/$MACHINE_ARCH/gconfig.h <$_TMPDIR/gprof/gconfig.h
|
||||
|
||||
### ld
|
||||
|
||||
mkdir -p $_TOP/external/gpl3/binutils/usr.bin/ld/arch/$MACHINE_ARCH
|
||||
|
||||
{
|
||||
getvars ld/Makefile \
|
||||
DEFS EMUL EMULATION_OFILES INCLUDES OFILES STRINGIFY TEXINFOS
|
||||
getvars ld/Makefile \
|
||||
target_alias | sed 's,[\._0-9A-Z]*$,,'
|
||||
} | write_mk external/gpl3/binutils/usr.bin/ld/arch/$MACHINE_ARCH/defs.mk
|
||||
|
||||
for f in config ldemul-list; do
|
||||
write_c external/gpl3/binutils/usr.bin/ld/arch/$MACHINE_ARCH/$f.h <$_TMPDIR/ld/$f.h
|
||||
done
|
||||
}
|
||||
|
||||
##### main #####
|
||||
|
||||
case $1 in
|
||||
all|binutils) # everything (uses "canadian cross" temp environment)
|
||||
get_binutils
|
||||
get_libbfd
|
||||
get_libopcodes
|
||||
get_libiberty
|
||||
exit 0
|
||||
;;
|
||||
|
||||
*) echo invalid arguments; exit 1;;
|
||||
esac
|
13
tools/binutils/patches/patch-aa
Normal file
13
tools/binutils/patches/patch-aa
Normal file
|
@ -0,0 +1,13 @@
|
|||
$NetBSD: patch-aa,v 1.3 2006/01/07 23:59:46 wiz Exp $
|
||||
|
||||
--- configure.orig Thu Apr 6 21:49:25 2006
|
||||
+++ configure
|
||||
@@ -899,7 +899,7 @@ host_libs="intl mmalloc libiberty opcodes bfd readline
|
||||
# know that we are building the simulator.
|
||||
# binutils, gas and ld appear in that order because it makes sense to run
|
||||
# "make check" in that particular order.
|
||||
-host_tools="texinfo byacc flex bison binutils gas ld fixincludes gcc sid sim gdb make patch prms send-pr gprof etc expect dejagnu ash bash bzip2 m4 autoconf automake libtool diff rcs fileutils shellutils time textutils wdiff find uudecode hello tar gzip indent recode release sed utils guile perl gawk findutils gettext zip fastjar gnattools"
|
||||
+host_tools="texinfo byacc flex bison binutils gas ld fixincludes gcc sid sim gdb make patch prms send-pr gprof expect dejagnu ash bash bzip2 m4 autoconf automake libtool diff rcs fileutils shellutils time textutils wdiff find uudecode hello tar gzip indent recode release sed utils guile perl gawk findutils gettext zip fastjar gnattools"
|
||||
|
||||
# libgcj represents the runtime libraries only used by gcj.
|
||||
libgcj="target-libffi \
|
34
tools/binutils/patches/patch-ab
Normal file
34
tools/binutils/patches/patch-ab
Normal file
|
@ -0,0 +1,34 @@
|
|||
$NetBSD: patch-ab,v 1.1 2006/02/26 23:59:41 joerg Exp $
|
||||
|
||||
--- bfd/configure.orig Fri Jun 23 18:17:03 2006
|
||||
+++ bfd/configure
|
||||
@@ -11499,7 +11499,7 @@ if test "${target}" = "${host}"; then
|
||||
COREFILE=trad-core.lo
|
||||
TRAD_HEADER='"hosts/i386bsd.h"'
|
||||
;;
|
||||
- i[3-7]86-*-freebsd* | i[3-7]86-*-kfreebsd*-gnu)
|
||||
+ i[3-7]86-*-freebsd* | i[3-7]86-*-kfreebsd*-gnu | i[3-7]86-*-dragonfly*)
|
||||
COREFILE=''
|
||||
TRAD_HEADER='"hosts/i386bsd.h"'
|
||||
;;
|
||||
@@ -13097,6 +13097,7 @@ do
|
||||
bfd_elf32_hppa_vec) tb="$tb elf32-hppa.lo elf32.lo $elf" ;;
|
||||
bfd_elf32_i370_vec) tb="$tb elf32-i370.lo elf32.lo $elf" ;;
|
||||
bfd_elf32_i386_freebsd_vec) tb="$tb elf32-i386.lo elf-vxworks.lo elf32.lo $elf" ;;
|
||||
+ bfd_elf32_i386_dragonfly_vec) tb="$tb elf32-i386.lo elf-vxworks.lo elf32.lo $elf" ;;
|
||||
bfd_elf32_i386_vxworks_vec) tb="$tb elf32-i386.lo elf-vxworks.lo elf32.lo $elf" ;;
|
||||
bfd_elf32_i386_vec) tb="$tb elf32-i386.lo elf-vxworks.lo elf32.lo $elf" ;;
|
||||
bfd_elf32_i860_little_vec) tb="$tb elf32-i860.lo elf32.lo $elf" ;;
|
||||
@@ -13218,10 +13219,12 @@ do
|
||||
i386coff_vec) tb="$tb coff-i386.lo cofflink.lo" ;;
|
||||
i386dynix_vec) tb="$tb i386dynix.lo aout32.lo" ;;
|
||||
i386freebsd_vec) tb="$tb i386freebsd.lo aout32.lo" ;;
|
||||
+ i386dragonfly_vec) tb="$tb i386freebsd.lo aout32.lo" ;;
|
||||
i386linux_vec) tb="$tb i386linux.lo aout32.lo" ;;
|
||||
i386lynx_aout_vec) tb="$tb i386lynx.lo lynx-core.lo aout32.lo" ;;
|
||||
i386lynx_coff_vec) tb="$tb cf-i386lynx.lo cofflink.lo lynx-core.lo" ;;
|
||||
i386mach3_vec) tb="$tb i386mach3.lo aout32.lo" ;;
|
||||
+ bfd_elf32_i386_minix_vec) tb="$tb elf32-i386.lo elf-vxworks.lo elf32.lo $elf" ;;
|
||||
i386msdos_vec) tb="$tb i386msdos.lo" ;;
|
||||
i386netbsd_vec) tb="$tb i386netbsd.lo aout32.lo" ;;
|
||||
i386os9k_vec) tb="$tb i386os9k.lo aout32.lo" ;;
|
23
tools/binutils/patches/patch-ac
Normal file
23
tools/binutils/patches/patch-ac
Normal file
|
@ -0,0 +1,23 @@
|
|||
$NetBSD: patch-ac,v 1.1 2006/02/26 23:59:41 joerg Exp $
|
||||
|
||||
--- bfd/config.bfd.orig Wed Apr 5 12:41:57 2006
|
||||
+++ bfd/config.bfd
|
||||
@@ -503,7 +503,7 @@ case "${targ}" in
|
||||
targ_selvecs=i386bsd_vec
|
||||
targ_underscore=yes
|
||||
;;
|
||||
- i[3-7]86-*-freebsd* | i[3-7]86-*-kfreebsd*-gnu)
|
||||
+ i[3-7]86-*-freebsd* | i[3-7]86-*-kfreebsd*-gnu | i[3-7]86-*-dragonfly*)
|
||||
targ_defvec=bfd_elf32_i386_freebsd_vec
|
||||
targ_selvecs=i386coff_vec
|
||||
# FreeBSD <= 4.0 supports only the old nonstandard way of ABI labelling.
|
||||
@@ -611,6 +611,9 @@ case "${targ}" in
|
||||
;;
|
||||
i[3-7]86-none-*)
|
||||
targ_defvec=i386coff_vec
|
||||
+ ;;
|
||||
+ i[3-7]86-*-minix)
|
||||
+ targ_defvec=bfd_elf32_i386_minix_vec
|
||||
;;
|
||||
i[3-7]86-*-aout* | i[3-7]86*-*-vsta*)
|
||||
targ_defvec=i386aout_vec
|
29
tools/binutils/patches/patch-ad
Normal file
29
tools/binutils/patches/patch-ad
Normal file
|
@ -0,0 +1,29 @@
|
|||
$NetBSD: patch-ad,v 1.1 2006/02/26 23:59:41 joerg Exp $
|
||||
|
||||
--- gas/configure.tgt.orig Wed Apr 5 12:41:57 2006
|
||||
+++ gas/configure.tgt
|
||||
@@ -191,7 +191,7 @@ case ${generic_target} in
|
||||
i386-*-freebsdaout*) fmt=aout em=386bsd ;;
|
||||
i386-*-freebsd[12].*) fmt=aout em=386bsd ;;
|
||||
i386-*-freebsd[12]) fmt=aout em=386bsd ;;
|
||||
- i386-*-freebsd* | i386-*-kfreebsd*-gnu)
|
||||
+ i386-*-freebsd* | i386-*-kfreebsd*-gnu | i386-*-dragonfly*)
|
||||
fmt=elf em=freebsd ;;
|
||||
i386-*-sysv*) fmt=coff ;;
|
||||
i386-*-sco3.2v5*coff) fmt=coff ;;
|
||||
@@ -213,6 +213,7 @@ case ${generic_target} in
|
||||
i386-*-nto-qnx*) fmt=elf ;;
|
||||
i386-*-*nt*) fmt=coff em=pe ;;
|
||||
i386-*-chaos) fmt=elf ;;
|
||||
+ i386-*-minix*) fmt=elf em=minix ;;
|
||||
i386-*-rdos*) fmt=elf ;;
|
||||
|
||||
i860-*-*) fmt=elf endian=little ;;
|
||||
@@ -382,6 +384,7 @@ case ${generic_target} in
|
||||
|
||||
*-*-aout | *-*-scout) fmt=aout ;;
|
||||
*-*-freebsd* | *-*-kfreebsd*-gnu) fmt=elf em=freebsd ;;
|
||||
+ *-*-dragonfly*) fmt=elf em=freebsd ;;
|
||||
*-*-bsd*) fmt=aout em=sun3 ;;
|
||||
*-*-generic) fmt=generic ;;
|
||||
*-*-xray | *-*-hms) fmt=coff ;;
|
33
tools/binutils/patches/patch-ae
Normal file
33
tools/binutils/patches/patch-ae
Normal file
|
@ -0,0 +1,33 @@
|
|||
$NetBSD: patch-ae,v 1.1 2006/02/26 23:59:41 joerg Exp $
|
||||
|
||||
--- ld/configure.tgt.orig Wed Apr 5 12:41:57 2006
|
||||
+++ ld/configure.tgt
|
||||
@@ -145,6 +145,8 @@ i[3-7]86-*-bsd) targ_emul=i386bsd ;;
|
||||
i[3-7]86-*-bsd386) targ_emul=i386bsd ;;
|
||||
i[3-7]86-*-bsdi*) targ_emul=i386bsd ;;
|
||||
i[3-7]86-*-aout) targ_emul=i386aout ;;
|
||||
+i[3-7]86-*-minix) targ_emul=elf_i386_minix
|
||||
+ targ_extra_emuls="elf_i386" ;;
|
||||
i[3-7]86-*-linux*aout*) targ_emul=i386linux
|
||||
targ_extra_emuls=elf_i386
|
||||
tdir_elf_i386=`echo ${targ_alias} | sed -e 's/aout//'` ;;
|
||||
@@ -194,7 +197,7 @@ x86_64-*-elf*) targ_emul=elf_x86_64
|
||||
i[3-7]86-*-kaos*) targ_emul=elf_i386 ;;
|
||||
i[3-7]86-*-freebsdaout* | i[3-7]86-*-freebsd[12].* | i[3-7]86-*-freebsd[12])
|
||||
targ_emul=i386bsd ;;
|
||||
-i[3-7]86-*-freebsd* | i[3-7]86-*-kfreebsd*-gnu)
|
||||
+i[3-7]86-*-freebsd* | i[3-7]86-*-kfreebsd*-gnu | i[3-7]86-*-dragonfly*)
|
||||
targ_emul=elf_i386_fbsd
|
||||
targ_extra_emuls="elf_i386 i386bsd" ;;
|
||||
x86_64-*-freebsd* | x86_64-*-kfreebsd*-gnu)
|
||||
@@ -583,6 +586,10 @@ case "${target}" in
|
||||
|
||||
*-*-freebsd*)
|
||||
NATIVE_LIB_DIRS='/lib /usr/lib /usr/local/lib'
|
||||
+ ;;
|
||||
+
|
||||
+*-*-dragonfly*)
|
||||
+ NATIVE_LIB_DIRS='/lib /usr/lib'
|
||||
;;
|
||||
|
||||
hppa*64*-*-hpux11*)
|
94
tools/binutils/patches/patch-af
Normal file
94
tools/binutils/patches/patch-af
Normal file
|
@ -0,0 +1,94 @@
|
|||
$NetBSD: patch-af,v 1.1 2007/08/14 09:08:07 rillig Exp $
|
||||
|
||||
--- gas/read.c.orig 2005-11-17 07:29:28.000000000 +0000
|
||||
+++ gas/read.c
|
||||
@@ -1279,7 +1279,7 @@ s_align (int arg, int bytes_p)
|
||||
unsigned int align_limit = ALIGN_LIMIT;
|
||||
unsigned int align;
|
||||
char *stop = NULL;
|
||||
- char stopc;
|
||||
+ char stopc = '\0';
|
||||
offsetT fill = 0;
|
||||
int max;
|
||||
int fill_p;
|
||||
@@ -1423,7 +1423,7 @@ s_comm_internal (int param,
|
||||
offsetT temp, size;
|
||||
symbolS *symbolP = NULL;
|
||||
char *stop = NULL;
|
||||
- char stopc;
|
||||
+ char stopc = '\0'; /* XXX: gcc -Wuninitialized */
|
||||
expressionS exp;
|
||||
|
||||
if (flag_mri)
|
||||
@@ -1538,7 +1538,7 @@ s_mri_common (int small ATTRIBUTE_UNUSED
|
||||
symbolS *sym;
|
||||
offsetT align;
|
||||
char *stop = NULL;
|
||||
- char stopc;
|
||||
+ char stopc = '\0';
|
||||
|
||||
if (!flag_mri)
|
||||
{
|
||||
@@ -1807,7 +1807,7 @@ s_fail (int ignore ATTRIBUTE_UNUSED)
|
||||
{
|
||||
offsetT temp;
|
||||
char *stop = NULL;
|
||||
- char stopc;
|
||||
+ char stopc = '\0';
|
||||
|
||||
if (flag_mri)
|
||||
stop = mri_comment_field (&stopc);
|
||||
@@ -1929,7 +1929,7 @@ s_globl (int ignore ATTRIBUTE_UNUSED)
|
||||
int c;
|
||||
symbolS *symbolP;
|
||||
char *stop = NULL;
|
||||
- char stopc;
|
||||
+ char stopc = '\0';
|
||||
|
||||
if (flag_mri)
|
||||
stop = mri_comment_field (&stopc);
|
||||
@@ -2881,7 +2881,7 @@ s_space (int mult)
|
||||
expressionS val;
|
||||
char *p = 0;
|
||||
char *stop = NULL;
|
||||
- char stopc;
|
||||
+ char stopc = '\0';
|
||||
int bytes;
|
||||
|
||||
#ifdef md_flush_pending_output
|
||||
@@ -3057,7 +3057,7 @@ s_float_space (int float_type)
|
||||
int flen;
|
||||
char temp[MAXIMUM_NUMBER_OF_CHARS_FOR_FLOAT];
|
||||
char *stop = NULL;
|
||||
- char stopc;
|
||||
+ char stopc = '\0';
|
||||
|
||||
if (flag_mri)
|
||||
stop = mri_comment_field (&stopc);
|
||||
@@ -3134,7 +3134,7 @@ void
|
||||
s_struct (int ignore ATTRIBUTE_UNUSED)
|
||||
{
|
||||
char *stop = NULL;
|
||||
- char stopc;
|
||||
+ char stopc = '\0';
|
||||
|
||||
if (flag_mri)
|
||||
stop = mri_comment_field (&stopc);
|
||||
@@ -3514,7 +3514,7 @@ cons_worker (register int nbytes, /* 1=.
|
||||
int c;
|
||||
expressionS exp;
|
||||
char *stop = NULL;
|
||||
- char stopc;
|
||||
+ char stopc = '\0';
|
||||
|
||||
#ifdef md_flush_pending_output
|
||||
md_flush_pending_output ();
|
||||
@@ -5010,7 +5010,7 @@ void
|
||||
equals (char *sym_name, int reassign)
|
||||
{
|
||||
char *stop = NULL;
|
||||
- char stopc;
|
||||
+ char stopc = '\0';
|
||||
|
||||
input_line_pointer++;
|
||||
if (*input_line_pointer == '=')
|
21
tools/binutils/patches/patch-ag
Normal file
21
tools/binutils/patches/patch-ag
Normal file
|
@ -0,0 +1,21 @@
|
|||
$NetBSD$
|
||||
|
||||
--- bfd/aoutx.h.orig Thu Mar 16 12:20:15 2006
|
||||
+++ bfd/aoutx.h
|
||||
@@ -383,6 +383,7 @@ DESCRIPTION
|
||||
Swap the information in an internal exec header structure
|
||||
@var{execp} into the buffer @var{raw_bytes} ready for writing to disk.
|
||||
*/
|
||||
+#ifndef NAME_swap_exec_header_out
|
||||
void
|
||||
NAME (aout, swap_exec_header_out) (bfd *abfd,
|
||||
struct internal_exec *execp,
|
||||
@@ -398,6 +399,8 @@ NAME (aout, swap_exec_header_out) (bfd *abfd,
|
||||
PUT_WORD (abfd, execp->a_trsize, bytes->e_trsize);
|
||||
PUT_WORD (abfd, execp->a_drsize, bytes->e_drsize);
|
||||
}
|
||||
+#define NAME_swap_exec_header_out NAME(aout,swap_exec_header_out)
|
||||
+#endif
|
||||
|
||||
/* Make all the section for an a.out file. */
|
||||
|
28
tools/binutils/patches/patch-ah
Normal file
28
tools/binutils/patches/patch-ah
Normal file
|
@ -0,0 +1,28 @@
|
|||
$NetBSD$
|
||||
|
||||
--- bfd/elf32-i386.c.orig Sat Apr 8 22:57:22 2006
|
||||
+++ bfd/elf32-i386.c
|
||||
@@ -3922,6 +3922,11 @@ elf_i386_plt_sym_val (bfd_vma i, const asection *plt,
|
||||
#undef TARGET_LITTLE_NAME
|
||||
#define TARGET_LITTLE_NAME "elf32-i386-freebsd"
|
||||
|
||||
+#undef TARGET_LITTLE_SYM
|
||||
+#define TARGET_LITTLE_SYM bfd_elf32_i386_minix_vec
|
||||
+#undef TARGET_LITTLE_NAME
|
||||
+#define TARGET_LITTLE_NAME "elf32-i386-minix"
|
||||
+
|
||||
/* The kernel recognizes executables as valid only if they carry a
|
||||
"FreeBSD" label in the ELF header. So we put this label on all
|
||||
executables and (for simplicity) also all other object files. */
|
||||
@@ -3946,6 +3951,11 @@ elf_i386_post_process_headers (bfd *abfd,
|
||||
#define elf_backend_post_process_headers elf_i386_post_process_headers
|
||||
#undef elf32_bed
|
||||
#define elf32_bed elf32_i386_fbsd_bed
|
||||
+
|
||||
+#undef elf_backend_post_process_headers
|
||||
+#define elf_backend_post_process_headers elf_i386_post_process_headers
|
||||
+#undef elf32_bed
|
||||
+#define elf32_bed elf32_i386_minix_bed
|
||||
|
||||
#include "elf32-target.h"
|
||||
|
330
tools/binutils/patches/patch-ai
Normal file
330
tools/binutils/patches/patch-ai
Normal file
|
@ -0,0 +1,330 @@
|
|||
$NetBSD$
|
||||
|
||||
--- bfd/i386minix.c.orig Sat Feb 26 00:58:30 2011
|
||||
+++ bfd/i386minix.c
|
||||
@@ -0,0 +1,325 @@
|
||||
+/* BFD back-end for i386 minix a.out binaries.
|
||||
+ Copyright 1990, 1991, 1992, 1994, 1996, 1997, 2001, 2002, 2003
|
||||
+ Free Software Foundation, Inc.
|
||||
+
|
||||
+This file is part of BFD, the Binary File Descriptor library.
|
||||
+
|
||||
+This program is free software; you can redistribute it and/or modify
|
||||
+it under the terms of the GNU General Public License as published by
|
||||
+the Free Software Foundation; either version 2 of the License, or
|
||||
+(at your option) any later version.
|
||||
+
|
||||
+This program is distributed in the hope that it will be useful,
|
||||
+but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+GNU General Public License for more details.
|
||||
+
|
||||
+You should have received a copy of the GNU General Public License
|
||||
+along with this program; if not, write to the Free Software
|
||||
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
+
|
||||
+/***************/
|
||||
+/* EXEC FORMAT */
|
||||
+/***************/
|
||||
+#include <a.out.h>
|
||||
+
|
||||
+#define external_exec exec
|
||||
+#define EXEC_BYTES_SIZE sizeof( struct exec )
|
||||
+
|
||||
+#define OMAGIC 0407 /* Object file or impure executable. */
|
||||
+#define NMAGIC 0410 /* Code indicating pure executable. */
|
||||
+#define ZMAGIC 0x0301 /* Code indicating demand-paged executable. */
|
||||
+#define BMAGIC 0415 /* Used by a b.out object. */
|
||||
+
|
||||
+#ifndef QMAGIC
|
||||
+#define QMAGIC 0314
|
||||
+#endif
|
||||
+# ifndef N_BADMAG
|
||||
+# define N_BADMAG(x) (N_MAGIC(x) != OMAGIC \
|
||||
+ && N_MAGIC(x) != NMAGIC \
|
||||
+ && N_MAGIC(x) != ZMAGIC \
|
||||
+ && N_MAGIC(x) != QMAGIC)
|
||||
+# endif /* N_BADMAG */
|
||||
+
|
||||
+#define N_HEADER_IN_TEXT(x) 0
|
||||
+
|
||||
+#define N_TXTOFF(x) EXEC_BYTES_SIZE
|
||||
+#define N_TXTADDR(x) 0
|
||||
+
|
||||
+#define N_TXTSIZE(x) ((x).a_text)
|
||||
+#ifdef SUPPORT_SEP
|
||||
+#define MINIX_IS_SEP(x) 0 /*-> gcv.c HCLICK STUFF*/
|
||||
+#define N_DATADDR(x) (MINIX_IS_SEP(x) ? align((x).a_text,HCLICK) : (x).a_text )
|
||||
+#else
|
||||
+#define N_DATADDR(x) ((x).a_text)
|
||||
+#endif
|
||||
+
|
||||
+/* Are these values correct? */
|
||||
+#define TARGET_PAGE_SIZE 1
|
||||
+#define SEGMENT_SIZE 1
|
||||
+
|
||||
+#define DEFAULT_STACK 5 * 1024 * 1024 /* 5 MB stack */
|
||||
+
|
||||
+#define DEFAULT_ARCH bfd_arch_i386
|
||||
+
|
||||
+/* Do not "beautify" the CONCAT* macro args. Traditional C will not
|
||||
+ remove whitespace added here, and thus will fail to concatenate
|
||||
+ the tokens. */
|
||||
+#define MY(OP) CONCAT2 (i386minix_,OP)
|
||||
+#define NAME(a,b) i386minix_32_##b
|
||||
+#define TARGETNAME "a.out-i386-minix"
|
||||
+#define NO_WRITE_HEADER_KLUDGE 1
|
||||
+
|
||||
+#define ARCH_SIZE 32
|
||||
+
|
||||
+#include "bfd.h"
|
||||
+#include "sysdep.h"
|
||||
+/*#include "libbfd.h"*/
|
||||
+#include "aout/aout64.h"
|
||||
+#include "libaout.h"
|
||||
+
|
||||
+
|
||||
+#define i386minix_32_get_section_contents _bfd_generic_get_section_contents
|
||||
+
|
||||
+#define SET_ARCH_MACH(abfd, exec) \
|
||||
+ bfd_set_arch_mach(abfd, DEFAULT_ARCH, 0)
|
||||
+
|
||||
+static bfd_boolean i386minix_write_object_contents PARAMS ((bfd *));
|
||||
+#define MY_write_object_contents i386minix_write_object_contents
|
||||
+
|
||||
+static int MY(swap_exec_header_in) PARAMS ((bfd *, struct external_exec *, struct internal_exec *));
|
||||
+static void MY(swap_exec_header_out) PARAMS ((bfd *, struct internal_exec *, struct external_exec *));
|
||||
+
|
||||
+#define NAME_swap_exec_header_in MY(swap_exec_header_in)
|
||||
+#define NAME_swap_exec_header_out MY(swap_exec_header_out)
|
||||
+
|
||||
+#define MY_object_p MY(object_p)
|
||||
+static const bfd_target * MY(object_p) (bfd *);
|
||||
+
|
||||
+
|
||||
+static bfd_boolean MY (set_sizes) PARAMS ((bfd *));
|
||||
+
|
||||
+#define MY_backend_data &MY(backend_data)
|
||||
+static const struct aout_backend_data MY(backend_data) = {
|
||||
+ 0, /* zmagic contiguous */
|
||||
+ 1, /* text incl header */
|
||||
+ 0, /* entry is text address */
|
||||
+ 0, /* exec_hdr_flags */
|
||||
+ 0, /* text vma? */
|
||||
+ MY(set_sizes),
|
||||
+ 1, /* exec header not counted */
|
||||
+ 0, /* add_dynamic_symbols */
|
||||
+ 0, /* add_one_symbol */
|
||||
+ 0, /* link_dynamic_object */
|
||||
+ 0, /* write_dynamic_symbol */
|
||||
+ 0, /* check_dynamic_reloc */
|
||||
+ 0 /* finish_dynamic_link */
|
||||
+};
|
||||
+
|
||||
+#include "aoutx.h"
|
||||
+
|
||||
+#include "aout-target.h"
|
||||
+
|
||||
+/****************/
|
||||
+/* WRITE HEADER */
|
||||
+/****************/
|
||||
+static void
|
||||
+MY(swap_exec_header_out) (abfd, execp, bytes)
|
||||
+ bfd *abfd;
|
||||
+ struct internal_exec *execp;
|
||||
+ struct external_exec *bytes;
|
||||
+{
|
||||
+ int total;
|
||||
+ int stack;
|
||||
+
|
||||
+ /* Now fill in fields in the raw data, from the fields in the exec struct. */
|
||||
+ H_PUT_16 (abfd, N_MAGIC(*execp), bytes->a_magic);
|
||||
+
|
||||
+ bytes->a_flags = 0;
|
||||
+ if ( bytes->a_syms )
|
||||
+ bytes->a_flags |= A_NSYM;
|
||||
+
|
||||
+ bytes->a_cpu = A_I80386;
|
||||
+
|
||||
+ bytes->a_hdrlen = EXEC_BYTES_SIZE;
|
||||
+
|
||||
+ bytes->a_unused = 0;
|
||||
+ bytes->a_version = 0;
|
||||
+
|
||||
+ PUT_WORD (abfd, execp->a_text , &bytes->a_text);
|
||||
+ PUT_WORD (abfd, execp->a_data , &bytes->a_data);
|
||||
+ PUT_WORD (abfd, execp->a_bss , &bytes->a_bss);
|
||||
+ PUT_WORD (abfd, execp->a_entry , &bytes->a_entry);
|
||||
+
|
||||
+ stack = DEFAULT_STACK;
|
||||
+ total = execp->a_data + execp->a_bss + stack;
|
||||
+#if 0
|
||||
+ if ( MINIX_IS_SEP( abfd ) )
|
||||
+ bytes->a_flags |= A_SEP;
|
||||
+ else
|
||||
+#endif
|
||||
+ total += execp->a_text;
|
||||
+
|
||||
+ PUT_WORD (abfd, total , &bytes->a_total);
|
||||
+ PUT_WORD (abfd, execp->a_syms , &bytes->a_syms);
|
||||
+ PUT_WORD (abfd, execp->a_trsize, &bytes->a_trsize);
|
||||
+ PUT_WORD (abfd, execp->a_drsize, &bytes->a_drsize);
|
||||
+
|
||||
+ bytes->a_tbase = bytes->a_dbase = 0;
|
||||
+}
|
||||
+
|
||||
+#define i386minix_32_swap_exec_header_out MY(swap_exec_header_out)
|
||||
+/* WRITE_HEADERS calls NAME(aout,swap_exec_header_out)
|
||||
+ which I need to overwrite. Unfortunately aoutx.h doesn't have a
|
||||
+ NAME_swap_exec_header_out like it does for -_in.
|
||||
+ So I have to redefine the outcome of NAME(aout,swap_exec_header_out) to
|
||||
+ my own function before using WRITE_HEADERS */
|
||||
+
|
||||
+/* Set the machine type correctly. */
|
||||
+static bfd_boolean
|
||||
+i386minix_write_object_contents (abfd)
|
||||
+ bfd *abfd;
|
||||
+{
|
||||
+ struct external_exec exec_bytes;
|
||||
+ struct internal_exec *execp = exec_hdr (abfd);
|
||||
+
|
||||
+ N_SET_MACHTYPE (*execp, M_386);
|
||||
+
|
||||
+ obj_reloc_entry_size (abfd) = RELOC_STD_SIZE;
|
||||
+
|
||||
+ WRITE_HEADERS (abfd, execp);
|
||||
+
|
||||
+ return TRUE;
|
||||
+}
|
||||
+/* undo renaming to be able to include aoutx.h */
|
||||
+#undef i386minix_32_swap_exec_header_out
|
||||
+
|
||||
+/***************/
|
||||
+/* READ HEADER */
|
||||
+/***************/
|
||||
+/* define if aoutx.h is included: */
|
||||
+/* UNTRUE: but including it generates a conflict with swap_exe_header_out, so don't include it */
|
||||
+
|
||||
+/* return -1 if header is wrong
|
||||
+ * otherwise return the bytes left to read */
|
||||
+static int
|
||||
+MY(swap_exec_header_in) (abfd, bytes, execp)
|
||||
+ bfd *abfd;
|
||||
+ struct external_exec *bytes;
|
||||
+ struct internal_exec *execp;
|
||||
+{
|
||||
+ /* The internal_exec structure has some fields that are unused in this
|
||||
+ configuration (IE for i960), so ensure that all such uninitialized
|
||||
+ fields are zero'd out. There are places where two of these structs
|
||||
+ are memcmp'd, and thus the contents do matter. */
|
||||
+ memset ((PTR) execp, 0, sizeof (struct internal_exec));
|
||||
+ /* Now fill in fields in the execp, from the bytes in the raw data. */
|
||||
+
|
||||
+ /*fill a_info*/
|
||||
+ N_SET_MAGIC(*execp, H_GET_16 (abfd, bytes->a_magic));
|
||||
+ N_SET_MACHTYPE(*execp, M_386);
|
||||
+ N_SET_FLAGS(*execp, 0);
|
||||
+
|
||||
+ /*check integrity*/
|
||||
+ if ( N_BADMAG( *execp ) )
|
||||
+ return -1;
|
||||
+
|
||||
+ if ( bytes->a_cpu != A_I80386 )
|
||||
+ return -1;
|
||||
+
|
||||
+ if ( bytes->a_hdrlen < A_MINHDR )
|
||||
+ return -1;
|
||||
+
|
||||
+#if 0
|
||||
+ if ( bytes->a_flags & A_SEP )
|
||||
+ dosomething();
|
||||
+#endif
|
||||
+
|
||||
+ /*fill the rest*/
|
||||
+ execp->a_text = GET_WORD (abfd, &bytes->a_text);
|
||||
+ execp->a_data = GET_WORD (abfd, &bytes->a_data);
|
||||
+ execp->a_bss = GET_WORD (abfd, &bytes->a_bss);
|
||||
+ execp->a_syms = GET_WORD (abfd, &bytes->a_syms);
|
||||
+ execp->a_entry = GET_WORD (abfd, &bytes->a_entry);
|
||||
+
|
||||
+ if ( bytes->a_hdrlen < A_MINHDR + 2 * sizeof(long) )
|
||||
+ return bytes->a_hdrlen - A_MINHDR;
|
||||
+
|
||||
+ if (bfd_bread (&bytes->a_trsize, 2 * sizeof(long), abfd) != 2 * sizeof(long))
|
||||
+ return -1;
|
||||
+
|
||||
+ execp->a_trsize = GET_WORD (abfd, &bytes->a_trsize);
|
||||
+ execp->a_drsize = GET_WORD (abfd, &bytes->a_drsize);
|
||||
+
|
||||
+ bfd_seek (abfd, -2 * sizeof(long), SEEK_CUR);
|
||||
+
|
||||
+ /*store other fields of external_exec?*/
|
||||
+ return bytes->a_hdrlen - A_MINHDR;
|
||||
+}
|
||||
+
|
||||
+static const bfd_target *
|
||||
+MY(object_p) (abfd)
|
||||
+ bfd *abfd;
|
||||
+{
|
||||
+ struct external_exec exec_bytes; /* Raw exec header from file */
|
||||
+ struct internal_exec exec; /* Cleaned-up exec header */
|
||||
+ const bfd_target *target;
|
||||
+ int left;
|
||||
+ bfd_size_type amt = A_MINHDR;
|
||||
+
|
||||
+ if (bfd_bread ((PTR) &exec_bytes, amt, abfd) != amt)
|
||||
+ {
|
||||
+ if (bfd_get_error () != bfd_error_system_call)
|
||||
+ bfd_set_error (bfd_error_wrong_format);
|
||||
+
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ /* let MY(swap_exec_header_in) check the header */
|
||||
+ if ( (left = MY(swap_exec_header_in) (abfd, &exec_bytes, &exec)) == -1 )
|
||||
+ {
|
||||
+ /* incorrect header */
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ /* skip rest of header */
|
||||
+ if ( bfd_seek( abfd, left, SEEK_CUR ) )
|
||||
+ return 0;
|
||||
+
|
||||
+ target = NAME(aout,some_aout_object_p) (abfd, &exec, MY(callback));
|
||||
+
|
||||
+ int adjust = (A_MINHDR + left) - EXEC_BYTES_SIZE;
|
||||
+
|
||||
+ /* adjust file positions with the bytes left to be read from the header */
|
||||
+ obj_textsec (abfd)->filepos += adjust;
|
||||
+ obj_datasec (abfd)->filepos += adjust;
|
||||
+
|
||||
+ obj_textsec (abfd)->rel_filepos += adjust;
|
||||
+ obj_datasec (abfd)->rel_filepos += adjust;
|
||||
+
|
||||
+ obj_sym_filepos (abfd) += adjust;
|
||||
+ obj_str_filepos (abfd) += adjust;
|
||||
+
|
||||
+ adata(abfd).exec_bytes_size = A_MINHDR + left;
|
||||
+
|
||||
+#ifdef ENTRY_CAN_BE_ZERO
|
||||
+ /* The NEWSOS3 entry-point is/was 0, which (amongst other lossage)
|
||||
+ * means that it isn't obvious if EXEC_P should be set.
|
||||
+ * All of the following must be true for an executable:
|
||||
+ * There must be no relocations, the bfd can be neither an
|
||||
+ * archive nor an archive element, and the file must be executable. */
|
||||
+
|
||||
+ if (exec.a_trsize + exec.a_drsize == 0
|
||||
+ && bfd_get_format(abfd) == bfd_object && abfd->my_archive == NULL)
|
||||
+ {
|
||||
+ struct stat buf;
|
||||
+#ifndef S_IXUSR
|
||||
+#define S_IXUSR 0100 /* Execute by owner. */
|
||||
+#endif
|
||||
+ if (stat(abfd->filename, &buf) == 0 && (buf.st_mode & S_IXUSR))
|
||||
+ abfd->flags |= EXEC_P;
|
||||
+ }
|
||||
+#endif /* ENTRY_CAN_BE_ZERO */
|
||||
+
|
||||
+ return target;
|
||||
+}
|
12
tools/binutils/patches/patch-aj
Normal file
12
tools/binutils/patches/patch-aj
Normal file
|
@ -0,0 +1,12 @@
|
|||
$NetBSD$
|
||||
|
||||
--- bfd/targets.c.orig Wed Apr 5 12:41:57 2006
|
||||
+++ bfd/targets.c
|
||||
@@ -696,6 +696,7 @@ extern const bfd_target i386linux_vec;
|
||||
extern const bfd_target i386lynx_aout_vec;
|
||||
extern const bfd_target i386lynx_coff_vec;
|
||||
extern const bfd_target i386mach3_vec;
|
||||
+extern const bfd_target bfd_elf32_i386_minix_vec;
|
||||
extern const bfd_target i386msdos_vec;
|
||||
extern const bfd_target i386netbsd_vec;
|
||||
extern const bfd_target i386os9k_vec;
|
13
tools/binutils/patches/patch-am
Normal file
13
tools/binutils/patches/patch-am
Normal file
|
@ -0,0 +1,13 @@
|
|||
$NetBSD$
|
||||
|
||||
--- config.guess.orig Mon Jan 16 17:34:37 2006
|
||||
+++ config.guess
|
||||
@@ -820,7 +820,7 @@ EOF
|
||||
echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
|
||||
exit ;;
|
||||
i*86:Minix:*:*)
|
||||
- echo ${UNAME_MACHINE}-pc-minix
|
||||
+ echo i386-pc-minix
|
||||
exit ;;
|
||||
arm*:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
15
tools/binutils/patches/patch-an
Normal file
15
tools/binutils/patches/patch-an
Normal file
|
@ -0,0 +1,15 @@
|
|||
$NetBSD$
|
||||
|
||||
--- gas/config/tc-i386.h.orig Mon Feb 27 15:35:37 2006
|
||||
+++ gas/config/tc-i386.h
|
||||
@@ -59,6 +59,10 @@ extern unsigned long i386_mach (void);
|
||||
#define ELF_TARGET_FORMAT "elf32-i386-vxworks"
|
||||
#endif
|
||||
|
||||
+#ifdef TE_MINIX
|
||||
+#define ELF_TARGET_FORMAT "elf32-i386-minix"
|
||||
+#endif
|
||||
+
|
||||
#ifndef ELF_TARGET_FORMAT
|
||||
#define ELF_TARGET_FORMAT "elf32-i386"
|
||||
#endif
|
16
tools/binutils/patches/patch-ao
Normal file
16
tools/binutils/patches/patch-ao
Normal file
|
@ -0,0 +1,16 @@
|
|||
$NetBSD$
|
||||
|
||||
--- gas/config/te-minix.h.orig Sat Feb 26 00:58:30 2011
|
||||
+++ gas/config/te-minix.h
|
||||
@@ -0,0 +1,11 @@
|
||||
+#define TE_MINIX 1
|
||||
+
|
||||
+/* Added these, because if we don't know what we're targeting we may
|
||||
+ need an assembler version of libgcc, and that will use local
|
||||
+ labels. */
|
||||
+#define LOCAL_LABELS_DOLLAR 1
|
||||
+#define LOCAL_LABELS_FB 1
|
||||
+
|
||||
+#define ELF_TARGET_FORMAT "elf32-i386-minix"
|
||||
+
|
||||
+#include "obj-format.h"
|
15
tools/binutils/patches/patch-ap
Normal file
15
tools/binutils/patches/patch-ap
Normal file
|
@ -0,0 +1,15 @@
|
|||
$NetBSD$
|
||||
|
||||
--- gas/configure.orig Thu Apr 6 21:49:31 2006
|
||||
+++ gas/configure
|
||||
@@ -3370,6 +3370,10 @@ freebsd* | kfreebsd*-gnu)
|
||||
fi
|
||||
;;
|
||||
|
||||
+minix*)
|
||||
+ lt_cv_deplibs_check_method=pass_all
|
||||
+ ;;
|
||||
+
|
||||
gnu*)
|
||||
lt_cv_deplibs_check_method=pass_all
|
||||
;;
|
23
tools/binutils/patches/patch-ar
Normal file
23
tools/binutils/patches/patch-ar
Normal file
|
@ -0,0 +1,23 @@
|
|||
$NetBSD$
|
||||
|
||||
--- ld/Makefile.in.orig Sat Jun 3 04:45:50 2006
|
||||
+++ ld/Makefile.in
|
||||
@@ -458,6 +458,7 @@ ALL_EMULATIONS = \
|
||||
ei386linux.o \
|
||||
ei386lynx.o \
|
||||
ei386mach.o \
|
||||
+ eelf_i386_minix.o \
|
||||
ei386moss.o \
|
||||
ei386msdos.o \
|
||||
ei386nbsd.o \
|
||||
@@ -1862,6 +1864,10 @@ ei386lynx.c: $(srcdir)/emulparams/i386lynx.sh \
|
||||
ei386mach.c: $(srcdir)/emulparams/i386mach.sh \
|
||||
$(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
|
||||
${GENSCRIPTS} i386mach "$(tdir_i386mach)"
|
||||
+eelf_i386_minix.c: $(srcdir)/emulparams/elf_i386_minix.sh \
|
||||
+ $(srcdir)/emulparams/elf_i386.sh \
|
||||
+ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
|
||||
+ ${GENSCRIPTS} elf_i386_minix "$(tdir_elf_i386_minix)"
|
||||
ei386moss.c: $(srcdir)/emulparams/i386moss.sh \
|
||||
$(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
|
||||
${GENSCRIPTS} i386moss "$(tdir_i386moss)"
|
8
tools/binutils/patches/patch-as
Normal file
8
tools/binutils/patches/patch-as
Normal file
|
@ -0,0 +1,8 @@
|
|||
$NetBSD$
|
||||
|
||||
--- ld/emulparams/elf_i386_minix.sh.orig Sat Feb 26 00:58:30 2011
|
||||
+++ ld/emulparams/elf_i386_minix.sh
|
||||
@@ -0,0 +1,3 @@
|
||||
+. ${srcdir}/emulparams/elf_i386.sh
|
||||
+. ${srcdir}/emulparams/elf_minix.sh
|
||||
+OUTPUT_FORMAT="elf32-i386-minix"
|
6
tools/binutils/patches/patch-at
Normal file
6
tools/binutils/patches/patch-at
Normal file
|
@ -0,0 +1,6 @@
|
|||
$NetBSD$
|
||||
|
||||
--- ld/emulparams/elf_minix.sh.orig Sat Feb 26 00:58:30 2011
|
||||
+++ ld/emulparams/elf_minix.sh
|
||||
@@ -0,0 +1 @@
|
||||
+ELF_INTERPRETER_NAME=\"/usr/libexec/ld-elf.so.1\"
|
11
tools/binutils/patches/patch-au
Normal file
11
tools/binutils/patches/patch-au
Normal file
|
@ -0,0 +1,11 @@
|
|||
$NetBSD$
|
||||
|
||||
--- ld/emulparams/i386minix.sh.orig Sat Feb 26 00:58:30 2011
|
||||
+++ ld/emulparams/i386minix.sh
|
||||
@@ -0,0 +1,6 @@
|
||||
+SCRIPT_NAME=aout
|
||||
+OUTPUT_FORMAT="a.out-i386-minix"
|
||||
+TARGET_PAGE_SIZE=1
|
||||
+TEXT_START_ADDR=0
|
||||
+NONPAGED_TEXT_START_ADDR=0
|
||||
+ARCH=i386
|
16
tools/binutils/patches/patch-gas_app.c
Normal file
16
tools/binutils/patches/patch-gas_app.c
Normal file
|
@ -0,0 +1,16 @@
|
|||
$NetBSD$
|
||||
|
||||
Fix build with gcc-4.5.
|
||||
|
||||
--- gas/app.c.orig 2006-03-10 10:57:18.000000000 +0000
|
||||
+++ gas/app.c
|
||||
@@ -563,7 +563,8 @@ do_scrub_chars (int (*get) (char *, int)
|
||||
{
|
||||
as_warn (_("end of file in string; '%c' inserted"), quotechar);
|
||||
state = old_state;
|
||||
- UNGET ('\n');
|
||||
+ if (from > input_buffer)
|
||||
+ UNGET ('\n');
|
||||
PUT (quotechar);
|
||||
}
|
||||
else if (ch == quotechar)
|
6
tools/cat/Makefile
Normal file
6
tools/cat/Makefile
Normal file
|
@ -0,0 +1,6 @@
|
|||
# $NetBSD: Makefile,v 1.2 2002/12/08 20:19:58 thorpej Exp $
|
||||
|
||||
HOSTPROGNAME= ${_TOOL_PREFIX}cat
|
||||
HOST_SRCDIR= bin/cat
|
||||
|
||||
.include "${.CURDIR}/../Makefile.host"
|
91
tools/compat/Makefile
Normal file
91
tools/compat/Makefile
Normal file
|
@ -0,0 +1,91 @@
|
|||
# $NetBSD: Makefile,v 1.56 2012/02/18 17:51:21 njoly Exp $
|
||||
|
||||
HOSTLIB= nbcompat
|
||||
|
||||
SRCS= atoll.c basename.c dirname.c fgetln.c flock.c fparseln.c \
|
||||
fpurge.c getline.c getmode.c getopt_long.c gettemp.c \
|
||||
heapsort.c \
|
||||
issetugid.c lchflags.c lchmod.c lchown.c libyywrap.c \
|
||||
md2.c md2hl.c md4c.c md4hl.c md5c.c md5hl.c \
|
||||
mi_vector_hash.c mkdtemp.c \
|
||||
mkstemp.c pread.c putc_unlocked.c pwcache.c pwrite.c \
|
||||
pw_scan.c \
|
||||
raise_default_signal.c rmd160.c rmd160hl.c \
|
||||
setenv.c setgroupent.c \
|
||||
setpassent.c setprogname.c sha1.c sha1hl.c sha2.c \
|
||||
sha256hl.c sha384hl.c sha512hl.c snprintf.c stat_flags.c \
|
||||
strlcat.c strlcpy.c strmode.c strndup.c strsep.c strsuftoll.c \
|
||||
strtoll.c unvis.c vis.c err.c errx.c verr.c verrx.c \
|
||||
vwarn.c vwarnx.c warn.c warnx.c fts.c glob.c efun.c
|
||||
|
||||
BUILD_OSTYPE!= uname -s
|
||||
|
||||
# Disable use of pre-compiled headers on Darwin.
|
||||
.if ${BUILD_OSTYPE} == "Darwin"
|
||||
CPPFLAGS+= -no-cpp-precomp
|
||||
.endif
|
||||
|
||||
# -D_FILE_OFFSET_BITS=64 produces a much more amenable `struct stat', and
|
||||
# other file ops, on many systems, without changing function names.
|
||||
|
||||
CPPFLAGS+= -I. -I./include -I${.CURDIR} -I${.CURDIR}/sys \
|
||||
-DHAVE_NBTOOL_CONFIG_H=1 -D_FILE_OFFSET_BITS=64
|
||||
|
||||
.PATH: ${.CURDIR}/../../lib/libc/gen \
|
||||
${.CURDIR}/../../lib/libc/hash \
|
||||
${.CURDIR}/../../lib/libc/hash/md2 \
|
||||
${.CURDIR}/../../lib/libc/hash/md5 \
|
||||
${.CURDIR}/../../lib/libc/hash/rmd160 \
|
||||
${.CURDIR}/../../lib/libc/hash/sha1 \
|
||||
${.CURDIR}/../../lib/libc/hash/sha2 \
|
||||
${.CURDIR}/../../lib/libc/md \
|
||||
${.CURDIR}/../../lib/libc/stdio \
|
||||
${.CURDIR}/../../lib/libc/stdlib \
|
||||
${.CURDIR}/../../lib/libc/string \
|
||||
${.CURDIR}/../../lib/libutil \
|
||||
${.CURDIR}/../../common/lib/libc/string \
|
||||
${.CURDIR}/../../common/lib/libc/hash/rmd160 \
|
||||
${.CURDIR}/../../common/lib/libc/hash/sha1 \
|
||||
${.CURDIR}/../../common/lib/libc/hash/sha2 \
|
||||
${.CURDIR}/../../common/lib/libc/md \
|
||||
${.CURDIR}/../../common/lib/libc/stdlib \
|
||||
${.CURDIR}/../../external/bsd/flex/dist
|
||||
|
||||
DPSRCS+= defs.mk
|
||||
CLEANFILES+= config.log config.status configure.lineno *.stamp
|
||||
|
||||
# Get components of Berkeley DB.
|
||||
_CURDIR:= ${.CURDIR}
|
||||
.CURDIR:= ${_CURDIR}/../../lib/libc
|
||||
.include "${.CURDIR}/db/Makefile.inc"
|
||||
.CURDIR:= ${_CURDIR}
|
||||
|
||||
SRCS:= ${SRCS:M*.c}
|
||||
|
||||
config.cache: include/.stamp configure nbtool_config.h.in defs.mk.in
|
||||
rm -f ${.TARGET}
|
||||
CC=${HOST_CC:Q} CFLAGS=${HOST_CFLAGS:Q} LDFLAGS=${HOST_LDFLAGS:Q} \
|
||||
${HOST_SH} ${.CURDIR}/configure --cache-file=config.cache
|
||||
|
||||
defs.mk: config.cache
|
||||
@touch ${.TARGET}
|
||||
|
||||
# Run "${TOOLDIR}/bin/nbmake-${MACHINE} regen" by hand after editing
|
||||
# configure.ac. See more detailed instructions in configure.ac.
|
||||
regen:
|
||||
cd ${.CURDIR} && ${TOOLDIR}/bin/${_TOOL_PREFIX}autoconf
|
||||
cd ${.CURDIR} && ${TOOLDIR}/bin/${_TOOL_PREFIX}autoheader
|
||||
|
||||
include/.stamp:
|
||||
mkdir -p include/sys include/machine include/rpc include/arpa
|
||||
@touch ${.TARGET}
|
||||
|
||||
cleandir:
|
||||
-rm -f nbtool_config.h confdefs.h defs.mk
|
||||
-rm -r -f include
|
||||
-rm -f config.cache
|
||||
|
||||
HOST_CPPFLAGS:= ${CPPFLAGS}
|
||||
CPPFLAGS:= # empty
|
||||
|
||||
.include <bsd.hostlib.mk>
|
87
tools/compat/README
Normal file
87
tools/compat/README
Normal file
|
@ -0,0 +1,87 @@
|
|||
$NetBSD: README,v 1.12 2005/04/05 00:21:22 jmc Exp $
|
||||
|
||||
Special notes for cross-hosting a NetBSD build on certain platforms.
|
||||
Only those platforms which have been tested to complete a "build.sh" run
|
||||
are listed.
|
||||
|
||||
All hosts must have a POSIX compatible sh. /bin/sh is assumed unless
|
||||
otherwise set. This can be overridden by setting HOST_SH in the environment.
|
||||
|
||||
In addition all hosts must provide the following local tools:
|
||||
|
||||
gzip
|
||||
|
||||
=====
|
||||
|
||||
NetBSD:
|
||||
|
||||
* _NETBSD_SOURCE is *not* to be defined/pulled in during compat/tools builds.
|
||||
compat_defs.h will error out if it finds it defined.
|
||||
|
||||
HP-UX:
|
||||
|
||||
* zlib must be available.
|
||||
This will be fixed in the future to include zlib in libnbcompat.
|
||||
|
||||
=====
|
||||
|
||||
LINUX:
|
||||
|
||||
* Tested on RedHat Linux 7.1 (i386).
|
||||
Tested on RedHat Linux 7.3 (i686) on 16 Sep 2002. Requires "LANG=C"
|
||||
in the environment.
|
||||
|
||||
* Tested on Redhat Linux 8.0 (i686) in Fall 2003. Requires no special settings.
|
||||
|
||||
* Tested on Redhat ES3 and AS3 in spring of 2004. Requires no special settings.
|
||||
|
||||
* The gcc (and libstdc++, if needed) package must be installed, along
|
||||
with the typical system development packages (glibc-devel, etc.).
|
||||
|
||||
* The ncurses-devel package must be installed (for nbinfo).
|
||||
|
||||
* The zlib and zlib-devel packages must be installed. This will be
|
||||
fixed in the future to include zlib in libnbcompat.
|
||||
|
||||
=====
|
||||
|
||||
MACOS
|
||||
Requires a case sensitive filesystem such as UFS
|
||||
|
||||
* Tested on 10.2.8 with Dec 2002 Developer Tools
|
||||
- may require a fix to /usr/bin/join, netbsd's join should work fine
|
||||
* Tested on 10.3 with xcode 1.5
|
||||
- compiles fine out of the box
|
||||
|
||||
=====
|
||||
|
||||
NETBSD (earlier releases):
|
||||
|
||||
* Tested on NetBSD 1.5.2 (machine-independently).
|
||||
|
||||
* Should need no special setup.
|
||||
|
||||
=====
|
||||
|
||||
SOLARIS:
|
||||
|
||||
* Tested on Solaris/x86 8 (5.8) with gcc 2.95.2 and Solaris/sparc 8 (5.8)
|
||||
with gcc 3.2 (not yet tested with SUNWspro).
|
||||
|
||||
* $HOST_CC needs to be set properly (for gcc, it should be set to "gcc",
|
||||
otherwise the improper /usr/ucb/cc may be invoked by accident).
|
||||
|
||||
* The SUNWzlib package (or a built version of zlib visible to $HOST_CC,
|
||||
such as SMCzlib from sunfreeware.com) must be installed. This will be
|
||||
fixed in the future to include zlib in libnbcompat.
|
||||
|
||||
* Needs the following paths, in this order, in $PATH:
|
||||
|
||||
/usr/xpg4/bin
|
||||
/usr/ccs/bin
|
||||
<path to host C and C++ compilers>
|
||||
/usr/bin
|
||||
|
||||
/usr/ucb may optionally be placed before /usr/bin, per your preference,
|
||||
but /usr/ucb *MUST NOT* be before /usr/ccs/bin or before the path to
|
||||
the host C and C++ compilers.
|
1196
tools/compat/compat_defs.h
Normal file
1196
tools/compat/compat_defs.h
Normal file
File diff suppressed because it is too large
Load diff
17
tools/compat/compat_getopt.h
Normal file
17
tools/compat/compat_getopt.h
Normal file
|
@ -0,0 +1,17 @@
|
|||
/* $NetBSD: compat_getopt.h,v 1.2 2007/11/08 20:30:59 christos Exp $ */
|
||||
|
||||
/* We unconditionally use the NetBSD getopt.h in libnbcompat. */
|
||||
|
||||
#if HAVE_GETOPT_H
|
||||
#include <getopt.h>
|
||||
#endif
|
||||
|
||||
#define option __nbcompat_option
|
||||
#define getopt_long __nbcompat_getopt_long
|
||||
|
||||
#undef no_argument
|
||||
#undef required_argument
|
||||
#undef optional_argument
|
||||
#undef _GETOPT_H_
|
||||
|
||||
#include "../../include/getopt.h"
|
63
tools/compat/compat_pwd.h
Normal file
63
tools/compat/compat_pwd.h
Normal file
|
@ -0,0 +1,63 @@
|
|||
/* $NetBSD: compat_pwd.h,v 1.6 2009/01/18 01:44:09 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Todd Vierling.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef _COMPAT_PWD_H_
|
||||
#define _COMPAT_PWD_H_
|
||||
|
||||
/* A very special version of <pwd.h> for pwd_mkdb(8) and __nbcompat_pwscan(3). */
|
||||
|
||||
#include "../../include/pwd.h"
|
||||
|
||||
#define passwd __nbcompat_passwd
|
||||
#define pw_scan __nbcompat_pw_scan
|
||||
#ifdef LOGIN_NAME_MAX
|
||||
#undef LOGIN_NAME_MAX
|
||||
#endif
|
||||
/* Taken from syslimits.h. Need the NetBSD def, not the local system def */
|
||||
#define LOGIN_NAME_MAX 17
|
||||
|
||||
/* All elements exactly sized: */
|
||||
struct passwd {
|
||||
char *pw_name;
|
||||
char *pw_passwd;
|
||||
int32_t pw_uid;
|
||||
int32_t pw_gid;
|
||||
int64_t pw_change;
|
||||
char *pw_class;
|
||||
char *pw_gecos;
|
||||
char *pw_dir;
|
||||
char *pw_shell;
|
||||
int64_t pw_expire;
|
||||
};
|
||||
|
||||
int pw_scan(char *, struct passwd *, int *);
|
||||
|
||||
#endif /* !_PWD_H_ */
|
8442
tools/compat/configure
vendored
Executable file
8442
tools/compat/configure
vendored
Executable file
File diff suppressed because it is too large
Load diff
236
tools/compat/configure.ac
Normal file
236
tools/compat/configure.ac
Normal file
|
@ -0,0 +1,236 @@
|
|||
# $NetBSD: configure.ac,v 1.74 2011/11/03 14:13:53 joerg Exp $
|
||||
#
|
||||
# Autoconf definition file for libnbcompat.
|
||||
#
|
||||
# When you edit configure.ac:
|
||||
# 0. Create the tools versions of autoconf and autoheader:
|
||||
# cd ${SRCDIR} && build.sh -V MKMAINTAINERTOOLS=yes tools
|
||||
# (This might not work if you try it after editing configure.ac.)
|
||||
# 1. edit configure.ac
|
||||
# 2. Regenerate "configure" and "nbtool_config.h.in" from "configure.ac":
|
||||
# cd ${SRCDIR}/tools/compat && ${TOOLDIR}/bin/nbmake-${MACHINE} regen
|
||||
# (Please don't use a non-tools version of autoconf or autoheader.)
|
||||
# 3. Test that the tools still build:
|
||||
# mv ${TOOLDIR} ${TOOLDIR}.bak
|
||||
# cd ${SRCDIR} && build.sh -V MKMAINTAINERTOOLS=yes tools
|
||||
# 4. cvs commit files that you edited.
|
||||
# 5. Regen again, to pick up changed RCS IDs from the above commit:
|
||||
# cd ${SRCDIR}/tools/compat && ${TOOLDIR}/bin/nbmake-${MACHINE} regen
|
||||
# 6. cvs commit files that were generated.
|
||||
#
|
||||
|
||||
AC_INIT([libnbcompat], [noversion], [lib-bug-people@NetBSD.org])
|
||||
AC_CONFIG_HEADERS(nbtool_config.h)
|
||||
AC_CONFIG_FILES(defs.mk)
|
||||
|
||||
# Autoheader header and footer
|
||||
AH_TOP([/* $][NetBSD$ */
|
||||
|
||||
#ifndef __NETBSD_NBTOOL_CONFIG_H__
|
||||
#define __NETBSD_NBTOOL_CONFIG_H__])
|
||||
|
||||
AH_BOTTOM([#include "compat_defs.h"
|
||||
#endif /* !__NETBSD_NBTOOL_CONFIG_H__ */])
|
||||
|
||||
AC_DEFUN([AC_NETBSD],
|
||||
[AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl
|
||||
AC_BEFORE([$0], [AC_RUN_IFELSE])dnl
|
||||
AC_MSG_CHECKING([for NetBSD])
|
||||
AC_EGREP_CPP(yes,
|
||||
[#ifdef __NetBSD__
|
||||
yes
|
||||
#endif
|
||||
],
|
||||
[AC_MSG_RESULT([yes])
|
||||
AC_DEFINE([_POSIX_SOURCE], 1, [Define for NetBSD headers.])
|
||||
AC_DEFINE([_POSIX_C_SOURCE], 200112L, [Define for NetBSD headers.])
|
||||
AC_DEFINE([_XOPEN_SOURCE], 600, [Define for NetBSD headers.])],
|
||||
[AC_MSG_RESULT([no])])
|
||||
])# AC_NETBSD
|
||||
|
||||
AC_NETBSD
|
||||
AC_PATH_PROG(BSHELL, sh, )
|
||||
if test x"$BSHELL" = x; then
|
||||
AC_MSG_ERROR([sh must be somewhere on \$PATH])
|
||||
fi
|
||||
AC_DEFINE_UNQUOTED([PATH_BSHELL], "$BSHELL", [Path to sh(1).])
|
||||
|
||||
AC_C_BIGENDIAN
|
||||
AC_HEADER_STDC
|
||||
|
||||
# Confirm existence of zlib. (This is available as a default install
|
||||
# option on many OS's; this could be added as a reachover build in the
|
||||
# future.)
|
||||
AC_CHECK_HEADER(zlib.h,,
|
||||
AC_MSG_ERROR([zlib must be installed in a compiler-visible path]))
|
||||
AC_CHECK_LIB(z, gzdopen,,
|
||||
AC_MSG_ERROR([zlib must be installed in a compiler-visible path]))
|
||||
|
||||
# Make sure certain required headers are available.
|
||||
# These are not necessarily required by the code, but they are not
|
||||
# currently conditionalized.
|
||||
AC_CHECK_HEADERS(sys/ioctl.h sys/mman.h sys/param.h \
|
||||
sys/socket.h sys/stat.h sys/time.h sys/types.h sys/utsname.h \
|
||||
sys/wait.h assert.h ctype.h errno.h fcntl.h grp.h limits.h locale.h \
|
||||
netdb.h pwd.h signal.h stdarg.h stdio.h stdlib.h string.h \
|
||||
termios.h unistd.h,,
|
||||
AC_MSG_ERROR([standard system header file not found]))
|
||||
|
||||
# Find headers that may not be available.
|
||||
AC_HEADER_DIRENT
|
||||
AC_CHECK_HEADERS(sys/mtio.h sys/sysmacros.h sys/syslimits.h \
|
||||
getopt.h features.h malloc.h sys/poll.h pthread.h stddef.h)
|
||||
AC_CHECK_HEADERS(sys/bswap.h machine/bswap.h sys/cdefs.h machine/endian.h \
|
||||
sys/endian.h sys/featuretest.h err.h inttypes.h libgen.h paths.h \
|
||||
stdint.h util.h resolv.h arpa/nameser.h,,
|
||||
[test -f include/$ac_header || touch include/$ac_header])
|
||||
AC_CHECK_HEADERS(rpc/types.h netconfig.h,,
|
||||
[echo '#include "nbtool_config.h"' >include/$ac_header.new
|
||||
echo '#include "'$srcdir/../../include/$ac_header'"' \
|
||||
>>include/$ac_header.new
|
||||
if cmp include/$ac_header.new include/$ac_header >/dev/null 2>&1; then
|
||||
rm -f include/$ac_header.new
|
||||
else
|
||||
mv -f include/$ac_header.new include/$ac_header
|
||||
fi])
|
||||
|
||||
# Typedefs.
|
||||
AC_TYPE_SIZE_T
|
||||
AC_CHECK_TYPES([id_t, long long, u_long, u_char, u_short, u_int, u_quad_t])
|
||||
AC_CHECK_TYPE(socklen_t, [AC_DEFINE([HAVE_SOCKLEN_T], 1,
|
||||
[Define if you have the socklen_t type.])],,
|
||||
[#include <sys/types.h>
|
||||
#include <sys/socket.h>])
|
||||
|
||||
dnl XXX - This is UGLY. Need a better way to homogenize the bitsized types,
|
||||
dnl including use of compiler primitive types via AC_CHECK_SIZEOF.
|
||||
dnl
|
||||
define([NB_CHECK_INTTYPE], [
|
||||
AC_CHECK_TYPE(uint][$1][_t,, [
|
||||
AC_CHECK_TYPE(u_int][$1][_t,
|
||||
AC_DEFINE(uint][$1][_t, u_int][$1][_t, \
|
||||
[Define if you have u_int][$1][_t, but not uint][$1][_t.]),
|
||||
AC_MSG_ERROR([cannot find a suitable type for uint][$1][_t]))
|
||||
])
|
||||
AC_CHECK_TYPE(u_int][$1][_t,, [
|
||||
AC_CHECK_TYPE(uint][$1][_t,
|
||||
AC_DEFINE(u_int][$1][_t, uint][$1][_t, \
|
||||
[Define if you have uint][$1][_t, but not u_int][$1][_t.]),
|
||||
AC_MSG_ERROR([cannot find a suitable type for u_int][$1][_t]))
|
||||
])
|
||||
])
|
||||
|
||||
NB_CHECK_INTTYPE(8)
|
||||
NB_CHECK_INTTYPE(16)
|
||||
NB_CHECK_INTTYPE(32)
|
||||
NB_CHECK_INTTYPE(64)
|
||||
|
||||
# Struct members.
|
||||
AC_CHECK_MEMBERS([DIR.dd_fd, DIR.__dd_fd, struct dirent.d_namlen],,,
|
||||
[#include <sys/types.h>
|
||||
#include <dirent.h>])
|
||||
AC_CHECK_MEMBERS([struct stat.st_flags, struct stat.st_gen,
|
||||
struct stat.st_birthtime, struct stat.st_birthtimensec,
|
||||
struct stat.st_atim, struct stat.st_mtimensec],,,
|
||||
[#include <sys/stat.h>])
|
||||
AC_CHECK_MEMBERS(struct statvfs.f_iosize,,, [#include <sys/statvfs.h>])
|
||||
|
||||
# Global variable decls.
|
||||
AC_CHECK_DECLS([optind, optreset],,, [
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
])
|
||||
AC_CHECK_DECLS(sys_signame,,, [#include <signal.h>])
|
||||
|
||||
# Library functions (where a .h check isn't enough).
|
||||
AC_FUNC_ALLOCA
|
||||
AC_CHECK_FUNCS(atoll asprintf asnprintf basename devname dirfd dirname \
|
||||
esetfunc fgetln flock fpurge __fpurge futimes getline \
|
||||
getopt getopt_long group_from_gid gid_from_group \
|
||||
heapsort isblank issetugid lchflags lchmod lchown lutimes mkstemp \
|
||||
mkdtemp poll pread putc_unlocked pwcache_userdb pwcache_groupdb \
|
||||
pwrite raise_default_signal random setenv \
|
||||
setgroupent setprogname setpassent snprintf strlcat strlcpy strmode \
|
||||
strndup strsep strsuftoll strtoll \
|
||||
user_from_uid uid_from_user vasprintf vasnprintf vsnprintf)
|
||||
|
||||
AC_CHECK_DECLS([user_from_uid, uid_from_user, pwcache_userdb],,,[
|
||||
#include <pwd.h>
|
||||
])
|
||||
AC_CHECK_DECLS([group_from_gid, gid_from_group, pwcache_groupdb],,,[
|
||||
#include <grp.h>
|
||||
])
|
||||
AC_CHECK_DECLS([strndup],,,[#include <string.h>])
|
||||
AC_CHECK_DECLS([strsuftoll],,,[#include <stdlib.h>])
|
||||
AC_CHECK_DECLS([lchflags, lchmod, lchown],,,[
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
])
|
||||
|
||||
AC_CHECK_DECLS([htobe16, htobe32, htobe64, htole16, htole32, htole64,
|
||||
be16toh, be32toh, be64toh, le16toh, le32toh, le64toh],,,
|
||||
[#include <sys/types.h>])
|
||||
|
||||
AC_CHECK_DECLS([bswap16, bswap32, bswap64],,, [#include <machine/bswap.h>])
|
||||
|
||||
AC_CHECK_DECLS([be16enc, le16enc, be16dec, le16dec, be32enc, le32enc,
|
||||
be32dec, le32dec, be64enc, le64enc, be64dec, le64dec],,,
|
||||
[#include <sys/endian.h>])
|
||||
|
||||
AC_CHECK_DECLS([fstatvfs],,, [#include <sys/statvfs.h>])
|
||||
|
||||
AC_CHECK_DECLS([setgroupent, setpassent],,, [
|
||||
#include <sys/types.h>
|
||||
#include <grp.h>
|
||||
#include <pwd.h>
|
||||
])
|
||||
|
||||
# regcomp() and regexec() are also names of functions in the old V8
|
||||
# regexp package. To avoid them, we need to find out who has regfree().
|
||||
|
||||
dnl # Cygwin: We *MUST* look at -lregex *before* the "no libs" condition.
|
||||
dnl # Thus AC_CHECK_LIB(regex...) comes first, and AC_SEARCHLIBS next.
|
||||
AC_CHECK_LIB(regex, regfree)
|
||||
AC_SEARCH_LIBS(regfree, rx posix)
|
||||
|
||||
AC_CHECK_FUNCS(fparseln, [
|
||||
AC_MSG_CHECKING(if fparseln seems to work)
|
||||
AC_RUN_IFELSE(
|
||||
[AC_LANG_SOURCE([[
|
||||
#define _NETBSD_SOURCE
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#define CONFTEST "conftest.fparseln"
|
||||
#define COMMENT '#'
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
static const char delim[3] = { '\0', '\0', COMMENT };
|
||||
FILE *fp;
|
||||
char *ptr;
|
||||
fp = fopen(CONFTEST, "w+");
|
||||
if (fp != NULL) {
|
||||
unlink(CONFTEST);
|
||||
ungetc(COMMENT, fp);
|
||||
ptr = fparseln(fp, NULL, NULL, delim,
|
||||
FPARSELN_UNESCALL);
|
||||
fclose(fp);
|
||||
if (ptr == NULL)
|
||||
exit(0);
|
||||
}
|
||||
exit(1);
|
||||
}
|
||||
]])],
|
||||
[AC_MSG_RESULT(yes)],
|
||||
[AC_MSG_RESULT(no)
|
||||
AC_DEFINE(BROKEN_FPARSELN, 1,
|
||||
[Define to 1 if your `fparseln' function is broken.])],
|
||||
[AC_MSG_WARN([cross compiling: not checking farseln])]
|
||||
)
|
||||
])
|
||||
|
||||
# Variables substituted via @VARNAME@ in defs.mk.in
|
||||
AC_SUBST(HAVE_PTHREAD_H, $ac_cv_header_pthread_h)
|
||||
|
||||
AC_OUTPUT
|
5
tools/compat/crypto/rmd160.h
Normal file
5
tools/compat/crypto/rmd160.h
Normal file
|
@ -0,0 +1,5 @@
|
|||
/* $NetBSD: rmd160.h,v 1.2 2006/10/27 22:32:45 mrg Exp $ */
|
||||
|
||||
/* We unconditionally use the NetBSD RMD160 in libnbcompat. */
|
||||
#include "nbtool_config.h"
|
||||
#include "../../sys/sys/rmd160.h"
|
5
tools/compat/crypto/sha2.h
Normal file
5
tools/compat/crypto/sha2.h
Normal file
|
@ -0,0 +1,5 @@
|
|||
/* $NetBSD: sha2.h,v 1.2 2006/10/27 22:32:45 mrg Exp $ */
|
||||
|
||||
/* We unconditionally use the NetBSD SHA2 in libnbcompat. */
|
||||
#include "nbtool_config.h"
|
||||
#include "../../../sys/sys/sha2.h"
|
7
tools/compat/db.h
Normal file
7
tools/compat/db.h
Normal file
|
@ -0,0 +1,7 @@
|
|||
/* $NetBSD: db.h,v 1.4 2006/10/16 19:44:23 apb Exp $ */
|
||||
|
||||
#include "nbtool_config.h"
|
||||
#ifndef __BIT_TYPES_DEFINED__
|
||||
#define __BIT_TYPES_DEFINED__
|
||||
#endif
|
||||
#include "../../include/db.h"
|
22
tools/compat/defs.mk.in
Normal file
22
tools/compat/defs.mk.in
Normal file
|
@ -0,0 +1,22 @@
|
|||
# $NetBSD: defs.mk.in,v 1.10 2011/08/14 20:22:42 apb Exp $
|
||||
|
||||
COMPATOBJ:= ${.PARSEDIR}
|
||||
HOSTEXEEXT= @EXEEXT@
|
||||
|
||||
HOST_BSHELL= @BSHELL@
|
||||
|
||||
BUILD_OSTYPE!= uname -s
|
||||
|
||||
# Disable use of pre-compiled headers on Darwin.
|
||||
.if ${BUILD_OSTYPE} == "Darwin"
|
||||
HOST_CPPFLAGS+= -no-cpp-precomp
|
||||
.endif
|
||||
|
||||
HOST_CPPFLAGS+= -I${COMPATOBJ} -I${COMPATOBJ}/include \
|
||||
-I${.CURDIR}/../compat -DHAVE_NBTOOL_CONFIG_H=1 \
|
||||
-D_FILE_OFFSET_BITS=64
|
||||
|
||||
DPADD+= ${COMPATOBJ}/libnbcompat.a
|
||||
LDADD+= -L${COMPATOBJ} -lnbcompat @LIBS@
|
||||
|
||||
HAVE_PTHREAD_H= @HAVE_PTHREAD_H@
|
106
tools/compat/fgetln.c
Normal file
106
tools/compat/fgetln.c
Normal file
|
@ -0,0 +1,106 @@
|
|||
/* $NetBSD: fgetln.c,v 1.9 2008/04/29 06:53:03 martin Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Christos Zoulas.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_NBTOOL_CONFIG_H
|
||||
#include "nbtool_config.h"
|
||||
#endif
|
||||
|
||||
#if !HAVE_FGETLN
|
||||
#include <stdlib.h>
|
||||
#ifndef HAVE_NBTOOL_CONFIG_H
|
||||
/* These headers are required, but included from nbtool_config.h */
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#endif
|
||||
|
||||
char *
|
||||
fgetln(FILE *fp, size_t *len)
|
||||
{
|
||||
static char *buf = NULL;
|
||||
static size_t bufsiz = 0;
|
||||
char *ptr;
|
||||
|
||||
|
||||
if (buf == NULL) {
|
||||
bufsiz = BUFSIZ;
|
||||
if ((buf = malloc(bufsiz)) == NULL)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (fgets(buf, bufsiz, fp) == NULL)
|
||||
return NULL;
|
||||
|
||||
*len = 0;
|
||||
while ((ptr = strchr(&buf[*len], '\n')) == NULL) {
|
||||
size_t nbufsiz = bufsiz + BUFSIZ;
|
||||
char *nbuf = realloc(buf, nbufsiz);
|
||||
|
||||
if (nbuf == NULL) {
|
||||
int oerrno = errno;
|
||||
free(buf);
|
||||
errno = oerrno;
|
||||
buf = NULL;
|
||||
return NULL;
|
||||
} else
|
||||
buf = nbuf;
|
||||
|
||||
if (fgets(&buf[bufsiz], BUFSIZ, fp) == NULL) {
|
||||
buf[bufsiz] = '\0';
|
||||
*len = strlen(buf);
|
||||
return buf;
|
||||
}
|
||||
|
||||
*len = bufsiz;
|
||||
bufsiz = nbufsiz;
|
||||
}
|
||||
|
||||
*len = (ptr - buf) + 1;
|
||||
return buf;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef TEST
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
char *p;
|
||||
size_t len;
|
||||
|
||||
while ((p = fgetln(stdin, &len)) != NULL) {
|
||||
(void)printf("%zu %s", len, p);
|
||||
free(p);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#endif
|
76
tools/compat/flock.c
Normal file
76
tools/compat/flock.c
Normal file
|
@ -0,0 +1,76 @@
|
|||
/* $NetBSD: flock.c,v 1.6 2008/04/28 20:24:12 martin Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Todd Vierling.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Emulate flock() with fcntl(), where available.
|
||||
* Otherwise, don't do locking; just pretend success.
|
||||
*/
|
||||
|
||||
#include "nbtool_config.h"
|
||||
|
||||
#if !HAVE_FLOCK
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
int flock(int fd, int op) {
|
||||
int rc = 0;
|
||||
|
||||
#if defined(F_SETLK) && defined(F_SETLKW)
|
||||
struct flock fl = {0};
|
||||
|
||||
switch (op & (LOCK_EX|LOCK_SH|LOCK_UN)) {
|
||||
case LOCK_EX:
|
||||
fl.l_type = F_WRLCK;
|
||||
break;
|
||||
|
||||
case LOCK_SH:
|
||||
fl.l_type = F_RDLCK;
|
||||
break;
|
||||
|
||||
case LOCK_UN:
|
||||
fl.l_type = F_UNLCK;
|
||||
break;
|
||||
|
||||
default:
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
fl.l_whence = SEEK_SET;
|
||||
rc = fcntl(fd, op & LOCK_NB ? F_SETLK : F_SETLKW, &fl);
|
||||
|
||||
if (rc && (errno == EAGAIN))
|
||||
errno = EWOULDBLOCK;
|
||||
#endif
|
||||
|
||||
return rc;
|
||||
}
|
||||
#endif
|
49
tools/compat/fpurge.c
Normal file
49
tools/compat/fpurge.c
Normal file
|
@ -0,0 +1,49 @@
|
|||
/* $NetBSD: fpurge.c,v 1.1 2009/06/16 22:35:34 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2009 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Christos Zoulas.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pretend...
|
||||
*/
|
||||
|
||||
#include "nbtool_config.h"
|
||||
|
||||
#if !HAVE_FPURGE
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
void
|
||||
fpurge(FILE *fp)
|
||||
{
|
||||
#if HAVE___FPURGE
|
||||
__fpurge(fp);
|
||||
#endif
|
||||
}
|
||||
#endif
|
5
tools/compat/fts.h
Normal file
5
tools/compat/fts.h
Normal file
|
@ -0,0 +1,5 @@
|
|||
/* $NetBSD: fts.h,v 1.2 2003/10/27 00:12:43 lukem Exp $ */
|
||||
|
||||
/* We unconditionally use the NetBSD fts(3) in libnbcompat. */
|
||||
#include "nbtool_config.h"
|
||||
#include "../../include/fts.h"
|
107
tools/compat/getline.c
Normal file
107
tools/compat/getline.c
Normal file
|
@ -0,0 +1,107 @@
|
|||
/* $NetBSD: getline.c,v 1.1 2011/03/20 20:48:57 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2011 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Christos Zoulas.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_NBTOOL_CONFIG_H
|
||||
#include "nbtool_config.h"
|
||||
#endif
|
||||
|
||||
#if !HAVE_GETLINE
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifndef HAVE_NBTOOL_CONFIG_H
|
||||
/* These headers are required, but included from nbtool_config.h */
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#endif
|
||||
|
||||
ssize_t
|
||||
getdelim(char **buf, size_t *bufsiz, int delimiter, FILE *fp)
|
||||
{
|
||||
char *ptr, *eptr;
|
||||
|
||||
|
||||
if (*buf == NULL || *bufsiz == 0) {
|
||||
*bufsiz = BUFSIZ;
|
||||
if ((*buf = malloc(*bufsiz)) == NULL)
|
||||
return -1;
|
||||
}
|
||||
|
||||
for (ptr = *buf, eptr = *buf + *bufsiz;;) {
|
||||
int c = fgetc(fp);
|
||||
if (c == -1) {
|
||||
if (feof(fp))
|
||||
return ptr == *buf ? -1 : ptr - *buf;
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
*ptr++ = c;
|
||||
if (c == delimiter) {
|
||||
*ptr = '\0';
|
||||
return ptr - *buf;
|
||||
}
|
||||
if (ptr + 2 >= eptr) {
|
||||
char *nbuf;
|
||||
size_t nbufsiz = *bufsiz * 2;
|
||||
ssize_t d = ptr - *buf;
|
||||
if ((nbuf = realloc(*buf, nbufsiz)) == NULL)
|
||||
return -1;
|
||||
*buf = nbuf;
|
||||
*bufsiz = nbufsiz;
|
||||
eptr = nbuf + nbufsiz;
|
||||
ptr = nbuf + d;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ssize_t
|
||||
getline(char **buf, size_t *bufsiz, FILE *fp)
|
||||
{
|
||||
return getdelim(buf, bufsiz, '\n', fp);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef TEST
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
char *p = NULL;
|
||||
ssize_t len;
|
||||
size_t n = 0;
|
||||
|
||||
while ((len = getline(&p, &n, stdin)) != -1)
|
||||
(void)printf("%zd %s", len, p);
|
||||
free(p);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
57
tools/compat/getmode.c
Normal file
57
tools/compat/getmode.c
Normal file
|
@ -0,0 +1,57 @@
|
|||
/* $NetBSD: getmode.c,v 1.8 2008/11/04 23:31:32 dbj Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Todd Vierling.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "nbtool_config.h"
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
void *
|
||||
setmode(const char *str)
|
||||
{
|
||||
mode_t *mp = malloc(sizeof(mode_t));
|
||||
|
||||
*mp = strtoul(str, NULL, 8);
|
||||
|
||||
return mp;
|
||||
}
|
||||
|
||||
mode_t
|
||||
getmode(const void *mp, mode_t mode)
|
||||
{
|
||||
mode_t m;
|
||||
|
||||
m = *((const mode_t *)mp);
|
||||
|
||||
mode &= ~ALLPERMS; /* input mode less RWX permissions */
|
||||
m &= ALLPERMS; /* new RWX permissions */
|
||||
|
||||
return m | mode;
|
||||
}
|
5
tools/compat/glob.h
Normal file
5
tools/compat/glob.h
Normal file
|
@ -0,0 +1,5 @@
|
|||
/* $NetBSD: glob.h,v 1.2 2003/10/27 00:12:43 lukem Exp $ */
|
||||
|
||||
/* We unconditionally use the NetBSD glob(3) in libnbcompat. */
|
||||
#include "nbtool_config.h"
|
||||
#include "../../include/glob.h"
|
21
tools/compat/issetugid.c
Normal file
21
tools/compat/issetugid.c
Normal file
|
@ -0,0 +1,21 @@
|
|||
/* $NetBSD: issetugid.c,v 1.2 2003/10/27 00:12:43 lukem Exp $ */
|
||||
|
||||
/*
|
||||
* Written by Ben Harris, 2002
|
||||
* This file is in the Public Domain
|
||||
*/
|
||||
|
||||
#include "nbtool_config.h"
|
||||
|
||||
#if !HAVE_ISSETUGID
|
||||
int
|
||||
issetugid(void)
|
||||
{
|
||||
|
||||
/*
|
||||
* Assume that anything linked against libnbcompat will be installed
|
||||
* without special privileges.
|
||||
*/
|
||||
return 0;
|
||||
}
|
||||
#endif
|
54
tools/compat/lchflags.c
Normal file
54
tools/compat/lchflags.c
Normal file
|
@ -0,0 +1,54 @@
|
|||
/* $NetBSD: lchflags.c,v 1.4 2008/04/28 20:24:12 martin Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2002 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Luke Mewburn.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/* Emulate lchflags(2), checking path with lstat(2) first to ensure that
|
||||
* it's not a symlink, and then call chflags(2) */
|
||||
|
||||
#include "nbtool_config.h"
|
||||
|
||||
#if !HAVE_LCHFLAGS && HAVE_STRUCT_STAT_ST_FLAGS
|
||||
#include <sys/stat.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int
|
||||
lchflags(const char *path, u_long flags)
|
||||
{
|
||||
struct stat psb;
|
||||
|
||||
if (lstat(path, &psb) == -1)
|
||||
return -1;
|
||||
if (S_ISLNK(psb.st_mode)) {
|
||||
return 0;
|
||||
}
|
||||
return (chflags(path, flags));
|
||||
}
|
||||
#endif
|
54
tools/compat/lchmod.c
Normal file
54
tools/compat/lchmod.c
Normal file
|
@ -0,0 +1,54 @@
|
|||
/* $NetBSD: lchmod.c,v 1.4 2008/04/28 20:24:12 martin Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2002 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Luke Mewburn.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/* Emulate lchmod(2), checking path with lstat(2) first to ensure that
|
||||
* it's not a symlink, and then call chmod(2) */
|
||||
|
||||
#include "nbtool_config.h"
|
||||
|
||||
#if !HAVE_LCHMOD
|
||||
#include <sys/stat.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int
|
||||
lchmod(const char *path, mode_t mode)
|
||||
{
|
||||
struct stat psb;
|
||||
|
||||
if (lstat(path, &psb) == -1)
|
||||
return -1;
|
||||
if (S_ISLNK(psb.st_mode)) {
|
||||
return 0;
|
||||
}
|
||||
return (chmod(path, mode));
|
||||
}
|
||||
#endif
|
54
tools/compat/lchown.c
Normal file
54
tools/compat/lchown.c
Normal file
|
@ -0,0 +1,54 @@
|
|||
/* $NetBSD: lchown.c,v 1.4 2008/04/28 20:24:12 martin Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2002 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Luke Mewburn.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/* Emulate lchown(2), checking path with lstat(2) first to ensure that
|
||||
* it's not a symlink, and then call chown(2) */
|
||||
|
||||
#include "nbtool_config.h"
|
||||
|
||||
#if !HAVE_LCHOWN
|
||||
#include <sys/stat.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int
|
||||
lchown(const char *path, uid_t owner, gid_t group)
|
||||
{
|
||||
struct stat psb;
|
||||
|
||||
if (lstat(path, &psb) == -1)
|
||||
return -1;
|
||||
if (S_ISLNK(psb.st_mode)) {
|
||||
return 0;
|
||||
}
|
||||
return (chown(path, owner, group));
|
||||
}
|
||||
#endif
|
5
tools/compat/md2.h
Normal file
5
tools/compat/md2.h
Normal file
|
@ -0,0 +1,5 @@
|
|||
/* $NetBSD: md2.h,v 1.2 2003/10/27 00:12:43 lukem Exp $ */
|
||||
|
||||
/* We unconditionally use the NetBSD MD2 in libnbcompat. */
|
||||
#include "nbtool_config.h"
|
||||
#include "../../include/md2.h"
|
5
tools/compat/md4.h
Normal file
5
tools/compat/md4.h
Normal file
|
@ -0,0 +1,5 @@
|
|||
/* $NetBSD: md4.h,v 1.3 2003/10/27 00:12:43 lukem Exp $ */
|
||||
|
||||
/* We unconditionally use the NetBSD MD4 in libnbcompat. */
|
||||
#include "nbtool_config.h"
|
||||
#include "../../sys/sys/md4.h"
|
5
tools/compat/md5.h
Normal file
5
tools/compat/md5.h
Normal file
|
@ -0,0 +1,5 @@
|
|||
/* $NetBSD: md5.h,v 1.3 2003/10/27 00:12:43 lukem Exp $ */
|
||||
|
||||
/* We unconditionally use the NetBSD MD5 in libnbcompat. */
|
||||
#include "nbtool_config.h"
|
||||
#include "../../sys/sys/md5.h"
|
3
tools/compat/mpool.h
Normal file
3
tools/compat/mpool.h
Normal file
|
@ -0,0 +1,3 @@
|
|||
/* $NetBSD: mpool.h,v 1.1 2002/01/21 20:04:37 tv Exp $ */
|
||||
|
||||
#include "../../include/mpool.h"
|
14
tools/compat/namespace.h
Normal file
14
tools/compat/namespace.h
Normal file
|
@ -0,0 +1,14 @@
|
|||
/* $NetBSD: namespace.h,v 1.3 2003/10/27 00:12:43 lukem Exp $ */
|
||||
|
||||
/*
|
||||
* Mainly empty header to make reachover bits of libc happy.
|
||||
*
|
||||
* Since all reachover bits will include this, it's a good place to pull
|
||||
* in nbtool_config.h.
|
||||
*/
|
||||
#include "nbtool_config.h"
|
||||
|
||||
/* No aliases in reachover-based libc sources. */
|
||||
#undef __indr_reference
|
||||
#undef __weak_alias
|
||||
#undef __warn_references
|
643
tools/compat/nbtool_config.h.in
Normal file
643
tools/compat/nbtool_config.h.in
Normal file
|
@ -0,0 +1,643 @@
|
|||
/* nbtool_config.h.in. Generated automatically from configure.ac by autoheader. */
|
||||
|
||||
/* $NetBSD: nbtool_config.h.in,v 1.27 2011/11/03 14:13:53 joerg Exp $ */
|
||||
|
||||
#ifndef __NETBSD_NBTOOL_CONFIG_H__
|
||||
#define __NETBSD_NBTOOL_CONFIG_H__
|
||||
|
||||
/* Define to 1 if your `fparseln' function is broken. */
|
||||
#undef BROKEN_FPARSELN
|
||||
|
||||
/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP
|
||||
systems. This function is required for `alloca.c' support on those systems.
|
||||
*/
|
||||
#undef CRAY_STACKSEG_END
|
||||
|
||||
/* Define if using `alloca.c'. */
|
||||
#undef C_ALLOCA
|
||||
|
||||
/* Define if you have `alloca', as a function or macro. */
|
||||
#undef HAVE_ALLOCA
|
||||
|
||||
/* Define if you have <alloca.h> and it should be used (not on Ultrix). */
|
||||
#undef HAVE_ALLOCA_H
|
||||
|
||||
/* Define if you have the <arpa/nameser.h> header file. */
|
||||
#undef HAVE_ARPA_NAMESER_H
|
||||
|
||||
/* Define if you have the `asnprintf' function. */
|
||||
#undef HAVE_ASNPRINTF
|
||||
|
||||
/* Define if you have the `asprintf' function. */
|
||||
#undef HAVE_ASPRINTF
|
||||
|
||||
/* Define if you have the <assert.h> header file. */
|
||||
#undef HAVE_ASSERT_H
|
||||
|
||||
/* Define if you have the `atoll' function. */
|
||||
#undef HAVE_ATOLL
|
||||
|
||||
/* Define if you have the `basename' function. */
|
||||
#undef HAVE_BASENAME
|
||||
|
||||
/* Define if you have the <ctype.h> header file. */
|
||||
#undef HAVE_CTYPE_H
|
||||
|
||||
/* Define to 1 if you have the declaration of `be16dec', and to 0 if you
|
||||
don't. */
|
||||
#undef HAVE_DECL_BE16DEC
|
||||
|
||||
/* Define to 1 if you have the declaration of `be16enc', and to 0 if you
|
||||
don't. */
|
||||
#undef HAVE_DECL_BE16ENC
|
||||
|
||||
/* Define to 1 if you have the declaration of `be16toh', and to 0 if you
|
||||
don't. */
|
||||
#undef HAVE_DECL_BE16TOH
|
||||
|
||||
/* Define to 1 if you have the declaration of `be32dec', and to 0 if you
|
||||
don't. */
|
||||
#undef HAVE_DECL_BE32DEC
|
||||
|
||||
/* Define to 1 if you have the declaration of `be32enc', and to 0 if you
|
||||
don't. */
|
||||
#undef HAVE_DECL_BE32ENC
|
||||
|
||||
/* Define to 1 if you have the declaration of `be32toh', and to 0 if you
|
||||
don't. */
|
||||
#undef HAVE_DECL_BE32TOH
|
||||
|
||||
/* Define to 1 if you have the declaration of `be64dec', and to 0 if you
|
||||
don't. */
|
||||
#undef HAVE_DECL_BE64DEC
|
||||
|
||||
/* Define to 1 if you have the declaration of `be64enc', and to 0 if you
|
||||
don't. */
|
||||
#undef HAVE_DECL_BE64ENC
|
||||
|
||||
/* Define to 1 if you have the declaration of `be64toh', and to 0 if you
|
||||
don't. */
|
||||
#undef HAVE_DECL_BE64TOH
|
||||
|
||||
/* Define to 1 if you have the declaration of `bswap16', and to 0 if you
|
||||
don't. */
|
||||
#undef HAVE_DECL_BSWAP16
|
||||
|
||||
/* Define to 1 if you have the declaration of `bswap32', and to 0 if you
|
||||
don't. */
|
||||
#undef HAVE_DECL_BSWAP32
|
||||
|
||||
/* Define to 1 if you have the declaration of `bswap64', and to 0 if you
|
||||
don't. */
|
||||
#undef HAVE_DECL_BSWAP64
|
||||
|
||||
/* Define to 1 if you have the declaration of `fstatvfs', and to 0 if you
|
||||
don't. */
|
||||
#undef HAVE_DECL_FSTATVFS
|
||||
|
||||
/* Define to 1 if you have the declaration of `gid_from_group', and to 0 if
|
||||
you don't. */
|
||||
#undef HAVE_DECL_GID_FROM_GROUP
|
||||
|
||||
/* Define to 1 if you have the declaration of `group_from_gid', and to 0 if
|
||||
you don't. */
|
||||
#undef HAVE_DECL_GROUP_FROM_GID
|
||||
|
||||
/* Define to 1 if you have the declaration of `htobe16', and to 0 if you
|
||||
don't. */
|
||||
#undef HAVE_DECL_HTOBE16
|
||||
|
||||
/* Define to 1 if you have the declaration of `htobe32', and to 0 if you
|
||||
don't. */
|
||||
#undef HAVE_DECL_HTOBE32
|
||||
|
||||
/* Define to 1 if you have the declaration of `htobe64', and to 0 if you
|
||||
don't. */
|
||||
#undef HAVE_DECL_HTOBE64
|
||||
|
||||
/* Define to 1 if you have the declaration of `htole16', and to 0 if you
|
||||
don't. */
|
||||
#undef HAVE_DECL_HTOLE16
|
||||
|
||||
/* Define to 1 if you have the declaration of `htole32', and to 0 if you
|
||||
don't. */
|
||||
#undef HAVE_DECL_HTOLE32
|
||||
|
||||
/* Define to 1 if you have the declaration of `htole64', and to 0 if you
|
||||
don't. */
|
||||
#undef HAVE_DECL_HTOLE64
|
||||
|
||||
/* Define to 1 if you have the declaration of `lchflags', and to 0 if you
|
||||
don't. */
|
||||
#undef HAVE_DECL_LCHFLAGS
|
||||
|
||||
/* Define to 1 if you have the declaration of `lchmod', and to 0 if you don't.
|
||||
*/
|
||||
#undef HAVE_DECL_LCHMOD
|
||||
|
||||
/* Define to 1 if you have the declaration of `lchown', and to 0 if you don't.
|
||||
*/
|
||||
#undef HAVE_DECL_LCHOWN
|
||||
|
||||
/* Define to 1 if you have the declaration of `le16dec', and to 0 if you
|
||||
don't. */
|
||||
#undef HAVE_DECL_LE16DEC
|
||||
|
||||
/* Define to 1 if you have the declaration of `le16enc', and to 0 if you
|
||||
don't. */
|
||||
#undef HAVE_DECL_LE16ENC
|
||||
|
||||
/* Define to 1 if you have the declaration of `le16toh', and to 0 if you
|
||||
don't. */
|
||||
#undef HAVE_DECL_LE16TOH
|
||||
|
||||
/* Define to 1 if you have the declaration of `le32dec', and to 0 if you
|
||||
don't. */
|
||||
#undef HAVE_DECL_LE32DEC
|
||||
|
||||
/* Define to 1 if you have the declaration of `le32enc', and to 0 if you
|
||||
don't. */
|
||||
#undef HAVE_DECL_LE32ENC
|
||||
|
||||
/* Define to 1 if you have the declaration of `le32toh', and to 0 if you
|
||||
don't. */
|
||||
#undef HAVE_DECL_LE32TOH
|
||||
|
||||
/* Define to 1 if you have the declaration of `le64dec', and to 0 if you
|
||||
don't. */
|
||||
#undef HAVE_DECL_LE64DEC
|
||||
|
||||
/* Define to 1 if you have the declaration of `le64enc', and to 0 if you
|
||||
don't. */
|
||||
#undef HAVE_DECL_LE64ENC
|
||||
|
||||
/* Define to 1 if you have the declaration of `le64toh', and to 0 if you
|
||||
don't. */
|
||||
#undef HAVE_DECL_LE64TOH
|
||||
|
||||
/* Define to 1 if you have the declaration of `optind', and to 0 if you don't.
|
||||
*/
|
||||
#undef HAVE_DECL_OPTIND
|
||||
|
||||
/* Define to 1 if you have the declaration of `optreset', and to 0 if you
|
||||
don't. */
|
||||
#undef HAVE_DECL_OPTRESET
|
||||
|
||||
/* Define to 1 if you have the declaration of `pwcache_groupdb', and to 0 if
|
||||
you don't. */
|
||||
#undef HAVE_DECL_PWCACHE_GROUPDB
|
||||
|
||||
/* Define to 1 if you have the declaration of `pwcache_userdb', and to 0 if
|
||||
you don't. */
|
||||
#undef HAVE_DECL_PWCACHE_USERDB
|
||||
|
||||
/* Define to 1 if you have the declaration of `setgroupent', and to 0 if you
|
||||
don't. */
|
||||
#undef HAVE_DECL_SETGROUPENT
|
||||
|
||||
/* Define to 1 if you have the declaration of `setpassent', and to 0 if you
|
||||
don't. */
|
||||
#undef HAVE_DECL_SETPASSENT
|
||||
|
||||
/* Define to 1 if you have the declaration of `strndup', and to 0 if you
|
||||
don't. */
|
||||
#undef HAVE_DECL_STRNDUP
|
||||
|
||||
/* Define to 1 if you have the declaration of `strsuftoll', and to 0 if you
|
||||
don't. */
|
||||
#undef HAVE_DECL_STRSUFTOLL
|
||||
|
||||
/* Define to 1 if you have the declaration of `sys_signame', and to 0 if you
|
||||
don't. */
|
||||
#undef HAVE_DECL_SYS_SIGNAME
|
||||
|
||||
/* Define to 1 if you have the declaration of `uid_from_user', and to 0 if you
|
||||
don't. */
|
||||
#undef HAVE_DECL_UID_FROM_USER
|
||||
|
||||
/* Define to 1 if you have the declaration of `user_from_uid', and to 0 if you
|
||||
don't. */
|
||||
#undef HAVE_DECL_USER_FROM_UID
|
||||
|
||||
/* Define if you have the `devname' function. */
|
||||
#undef HAVE_DEVNAME
|
||||
|
||||
/* Define if you have the <dirent.h> header file, and it defines `DIR'. */
|
||||
#undef HAVE_DIRENT_H
|
||||
|
||||
/* Define if you have the `dirfd' function. */
|
||||
#undef HAVE_DIRFD
|
||||
|
||||
/* Define if you have the `dirname' function. */
|
||||
#undef HAVE_DIRNAME
|
||||
|
||||
/* Define if `dd_fd' is member of `DIR'. */
|
||||
#undef HAVE_DIR_DD_FD
|
||||
|
||||
/* Define if `__dd_fd' is member of `DIR'. */
|
||||
#undef HAVE_DIR___DD_FD
|
||||
|
||||
/* Define if you have the <errno.h> header file. */
|
||||
#undef HAVE_ERRNO_H
|
||||
|
||||
/* Define if you have the <err.h> header file. */
|
||||
#undef HAVE_ERR_H
|
||||
|
||||
/* Define if you have the `esetfunc' function. */
|
||||
#undef HAVE_ESETFUNC
|
||||
|
||||
/* Define if you have the <fcntl.h> header file. */
|
||||
#undef HAVE_FCNTL_H
|
||||
|
||||
/* Define if you have the <features.h> header file. */
|
||||
#undef HAVE_FEATURES_H
|
||||
|
||||
/* Define if you have the `fgetln' function. */
|
||||
#undef HAVE_FGETLN
|
||||
|
||||
/* Define if you have the `flock' function. */
|
||||
#undef HAVE_FLOCK
|
||||
|
||||
/* Define if you have the `fparseln' function. */
|
||||
#undef HAVE_FPARSELN
|
||||
|
||||
/* Define if you have the `fpurge' function. */
|
||||
#undef HAVE_FPURGE
|
||||
|
||||
/* Define if you have the `futimes' function. */
|
||||
#undef HAVE_FUTIMES
|
||||
|
||||
/* Define if you have the `getline' function. */
|
||||
#undef HAVE_GETLINE
|
||||
|
||||
/* Define if you have the `getopt' function. */
|
||||
#undef HAVE_GETOPT
|
||||
|
||||
/* Define if you have the <getopt.h> header file. */
|
||||
#undef HAVE_GETOPT_H
|
||||
|
||||
/* Define if you have the `getopt_long' function. */
|
||||
#undef HAVE_GETOPT_LONG
|
||||
|
||||
/* Define if you have the `gid_from_group' function. */
|
||||
#undef HAVE_GID_FROM_GROUP
|
||||
|
||||
/* Define if you have the `group_from_gid' function. */
|
||||
#undef HAVE_GROUP_FROM_GID
|
||||
|
||||
/* Define if you have the <grp.h> header file. */
|
||||
#undef HAVE_GRP_H
|
||||
|
||||
/* Define if you have the `heapsort' function. */
|
||||
#undef HAVE_HEAPSORT
|
||||
|
||||
/* Define if the system has the type `id_t'. */
|
||||
#undef HAVE_ID_T
|
||||
|
||||
/* Define if you have the <inttypes.h> header file. */
|
||||
#undef HAVE_INTTYPES_H
|
||||
|
||||
/* Define if you have the `isblank' function. */
|
||||
#undef HAVE_ISBLANK
|
||||
|
||||
/* Define if you have the `issetugid' function. */
|
||||
#undef HAVE_ISSETUGID
|
||||
|
||||
/* Define if you have the `lchflags' function. */
|
||||
#undef HAVE_LCHFLAGS
|
||||
|
||||
/* Define if you have the `lchmod' function. */
|
||||
#undef HAVE_LCHMOD
|
||||
|
||||
/* Define if you have the `lchown' function. */
|
||||
#undef HAVE_LCHOWN
|
||||
|
||||
/* Define if you have the <libgen.h> header file. */
|
||||
#undef HAVE_LIBGEN_H
|
||||
|
||||
/* Define if you have the `regex' library (-lregex). */
|
||||
#undef HAVE_LIBREGEX
|
||||
|
||||
/* Define if you have the `z' library (-lz). */
|
||||
#undef HAVE_LIBZ
|
||||
|
||||
/* Define if you have the <limits.h> header file. */
|
||||
#undef HAVE_LIMITS_H
|
||||
|
||||
/* Define if you have the <locale.h> header file. */
|
||||
#undef HAVE_LOCALE_H
|
||||
|
||||
/* Define if the system has the type `long long'. */
|
||||
#undef HAVE_LONG_LONG
|
||||
|
||||
/* Define if you have the `lutimes' function. */
|
||||
#undef HAVE_LUTIMES
|
||||
|
||||
/* Define if you have the <machine/bswap.h> header file. */
|
||||
#undef HAVE_MACHINE_BSWAP_H
|
||||
|
||||
/* Define if you have the <machine/endian.h> header file. */
|
||||
#undef HAVE_MACHINE_ENDIAN_H
|
||||
|
||||
/* Define if you have the <malloc.h> header file. */
|
||||
#undef HAVE_MALLOC_H
|
||||
|
||||
/* Define if you have the <memory.h> header file. */
|
||||
#undef HAVE_MEMORY_H
|
||||
|
||||
/* Define if you have the `mkdtemp' function. */
|
||||
#undef HAVE_MKDTEMP
|
||||
|
||||
/* Define if you have the `mkstemp' function. */
|
||||
#undef HAVE_MKSTEMP
|
||||
|
||||
/* Define if you have the <ndir.h> header file, and it defines `DIR'. */
|
||||
#undef HAVE_NDIR_H
|
||||
|
||||
/* Define if you have the <netconfig.h> header file. */
|
||||
#undef HAVE_NETCONFIG_H
|
||||
|
||||
/* Define if you have the <netdb.h> header file. */
|
||||
#undef HAVE_NETDB_H
|
||||
|
||||
/* Define if you have the <paths.h> header file. */
|
||||
#undef HAVE_PATHS_H
|
||||
|
||||
/* Define if you have the `poll' function. */
|
||||
#undef HAVE_POLL
|
||||
|
||||
/* Define if you have the `pread' function. */
|
||||
#undef HAVE_PREAD
|
||||
|
||||
/* Define if you have the <pthread.h> header file. */
|
||||
#undef HAVE_PTHREAD_H
|
||||
|
||||
/* Define if you have the `putc_unlocked' function. */
|
||||
#undef HAVE_PUTC_UNLOCKED
|
||||
|
||||
/* Define if you have the `pwcache_groupdb' function. */
|
||||
#undef HAVE_PWCACHE_GROUPDB
|
||||
|
||||
/* Define if you have the `pwcache_userdb' function. */
|
||||
#undef HAVE_PWCACHE_USERDB
|
||||
|
||||
/* Define if you have the <pwd.h> header file. */
|
||||
#undef HAVE_PWD_H
|
||||
|
||||
/* Define if you have the `pwrite' function. */
|
||||
#undef HAVE_PWRITE
|
||||
|
||||
/* Define if you have the `raise_default_signal' function. */
|
||||
#undef HAVE_RAISE_DEFAULT_SIGNAL
|
||||
|
||||
/* Define if you have the `random' function. */
|
||||
#undef HAVE_RANDOM
|
||||
|
||||
/* Define if you have the <resolv.h> header file. */
|
||||
#undef HAVE_RESOLV_H
|
||||
|
||||
/* Define if you have the <rpc/types.h> header file. */
|
||||
#undef HAVE_RPC_TYPES_H
|
||||
|
||||
/* Define if you have the `setenv' function. */
|
||||
#undef HAVE_SETENV
|
||||
|
||||
/* Define if you have the `setgroupent' function. */
|
||||
#undef HAVE_SETGROUPENT
|
||||
|
||||
/* Define if you have the `setpassent' function. */
|
||||
#undef HAVE_SETPASSENT
|
||||
|
||||
/* Define if you have the `setprogname' function. */
|
||||
#undef HAVE_SETPROGNAME
|
||||
|
||||
/* Define if you have the <signal.h> header file. */
|
||||
#undef HAVE_SIGNAL_H
|
||||
|
||||
/* Define if you have the `snprintf' function. */
|
||||
#undef HAVE_SNPRINTF
|
||||
|
||||
/* Define if you have the socklen_t type. */
|
||||
#undef HAVE_SOCKLEN_T
|
||||
|
||||
/* Define if you have the <stdarg.h> header file. */
|
||||
#undef HAVE_STDARG_H
|
||||
|
||||
/* Define if you have the <stddef.h> header file. */
|
||||
#undef HAVE_STDDEF_H
|
||||
|
||||
/* Define if you have the <stdint.h> header file. */
|
||||
#undef HAVE_STDINT_H
|
||||
|
||||
/* Define if you have the <stdio.h> header file. */
|
||||
#undef HAVE_STDIO_H
|
||||
|
||||
/* Define if you have the <stdlib.h> header file. */
|
||||
#undef HAVE_STDLIB_H
|
||||
|
||||
/* Define if you have the <strings.h> header file. */
|
||||
#undef HAVE_STRINGS_H
|
||||
|
||||
/* Define if you have the <string.h> header file. */
|
||||
#undef HAVE_STRING_H
|
||||
|
||||
/* Define if you have the `strlcat' function. */
|
||||
#undef HAVE_STRLCAT
|
||||
|
||||
/* Define if you have the `strlcpy' function. */
|
||||
#undef HAVE_STRLCPY
|
||||
|
||||
/* Define if you have the `strmode' function. */
|
||||
#undef HAVE_STRMODE
|
||||
|
||||
/* Define if you have the `strndup' function. */
|
||||
#undef HAVE_STRNDUP
|
||||
|
||||
/* Define if you have the `strsep' function. */
|
||||
#undef HAVE_STRSEP
|
||||
|
||||
/* Define if you have the `strsuftoll' function. */
|
||||
#undef HAVE_STRSUFTOLL
|
||||
|
||||
/* Define if you have the `strtoll' function. */
|
||||
#undef HAVE_STRTOLL
|
||||
|
||||
/* Define if `d_namlen' is member of `struct dirent'. */
|
||||
#undef HAVE_STRUCT_DIRENT_D_NAMLEN
|
||||
|
||||
/* Define if `f_iosize' is member of `struct statvfs'. */
|
||||
#undef HAVE_STRUCT_STATVFS_F_IOSIZE
|
||||
|
||||
/* Define if `st_atim' is member of `struct stat'. */
|
||||
#undef HAVE_STRUCT_STAT_ST_ATIM
|
||||
|
||||
/* Define if `st_birthtime' is member of `struct stat'. */
|
||||
#undef HAVE_STRUCT_STAT_ST_BIRTHTIME
|
||||
|
||||
/* Define if `st_birthtimensec' is member of `struct stat'. */
|
||||
#undef HAVE_STRUCT_STAT_ST_BIRTHTIMENSEC
|
||||
|
||||
/* Define if `st_flags' is member of `struct stat'. */
|
||||
#undef HAVE_STRUCT_STAT_ST_FLAGS
|
||||
|
||||
/* Define if `st_gen' is member of `struct stat'. */
|
||||
#undef HAVE_STRUCT_STAT_ST_GEN
|
||||
|
||||
/* Define if `st_mtimensec' is member of `struct stat'. */
|
||||
#undef HAVE_STRUCT_STAT_ST_MTIMENSEC
|
||||
|
||||
/* Define if you have the <sys/bswap.h> header file. */
|
||||
#undef HAVE_SYS_BSWAP_H
|
||||
|
||||
/* Define if you have the <sys/cdefs.h> header file. */
|
||||
#undef HAVE_SYS_CDEFS_H
|
||||
|
||||
/* Define if you have the <sys/dir.h> header file, and it defines `DIR'. */
|
||||
#undef HAVE_SYS_DIR_H
|
||||
|
||||
/* Define if you have the <sys/endian.h> header file. */
|
||||
#undef HAVE_SYS_ENDIAN_H
|
||||
|
||||
/* Define if you have the <sys/featuretest.h> header file. */
|
||||
#undef HAVE_SYS_FEATURETEST_H
|
||||
|
||||
/* Define if you have the <sys/ioctl.h> header file. */
|
||||
#undef HAVE_SYS_IOCTL_H
|
||||
|
||||
/* Define if you have the <sys/mman.h> header file. */
|
||||
#undef HAVE_SYS_MMAN_H
|
||||
|
||||
/* Define if you have the <sys/mtio.h> header file. */
|
||||
#undef HAVE_SYS_MTIO_H
|
||||
|
||||
/* Define if you have the <sys/ndir.h> header file, and it defines `DIR'. */
|
||||
#undef HAVE_SYS_NDIR_H
|
||||
|
||||
/* Define if you have the <sys/param.h> header file. */
|
||||
#undef HAVE_SYS_PARAM_H
|
||||
|
||||
/* Define if you have the <sys/poll.h> header file. */
|
||||
#undef HAVE_SYS_POLL_H
|
||||
|
||||
/* Define if you have the <sys/socket.h> header file. */
|
||||
#undef HAVE_SYS_SOCKET_H
|
||||
|
||||
/* Define if you have the <sys/stat.h> header file. */
|
||||
#undef HAVE_SYS_STAT_H
|
||||
|
||||
/* Define if you have the <sys/syslimits.h> header file. */
|
||||
#undef HAVE_SYS_SYSLIMITS_H
|
||||
|
||||
/* Define if you have the <sys/sysmacros.h> header file. */
|
||||
#undef HAVE_SYS_SYSMACROS_H
|
||||
|
||||
/* Define if you have the <sys/time.h> header file. */
|
||||
#undef HAVE_SYS_TIME_H
|
||||
|
||||
/* Define if you have the <sys/types.h> header file. */
|
||||
#undef HAVE_SYS_TYPES_H
|
||||
|
||||
/* Define if you have the <sys/utsname.h> header file. */
|
||||
#undef HAVE_SYS_UTSNAME_H
|
||||
|
||||
/* Define if you have the <sys/wait.h> header file. */
|
||||
#undef HAVE_SYS_WAIT_H
|
||||
|
||||
/* Define if you have the <termios.h> header file. */
|
||||
#undef HAVE_TERMIOS_H
|
||||
|
||||
/* Define if you have the `uid_from_user' function. */
|
||||
#undef HAVE_UID_FROM_USER
|
||||
|
||||
/* Define if you have the <unistd.h> header file. */
|
||||
#undef HAVE_UNISTD_H
|
||||
|
||||
/* Define if you have the `user_from_uid' function. */
|
||||
#undef HAVE_USER_FROM_UID
|
||||
|
||||
/* Define if you have the <util.h> header file. */
|
||||
#undef HAVE_UTIL_H
|
||||
|
||||
/* Define if the system has the type `u_char'. */
|
||||
#undef HAVE_U_CHAR
|
||||
|
||||
/* Define if the system has the type `u_int'. */
|
||||
#undef HAVE_U_INT
|
||||
|
||||
/* Define if the system has the type `u_long'. */
|
||||
#undef HAVE_U_LONG
|
||||
|
||||
/* Define if the system has the type `u_quad_t'. */
|
||||
#undef HAVE_U_QUAD_T
|
||||
|
||||
/* Define if the system has the type `u_short'. */
|
||||
#undef HAVE_U_SHORT
|
||||
|
||||
/* Define if you have the `vasnprintf' function. */
|
||||
#undef HAVE_VASNPRINTF
|
||||
|
||||
/* Define if you have the `vasprintf' function. */
|
||||
#undef HAVE_VASPRINTF
|
||||
|
||||
/* Define if you have the `vsnprintf' function. */
|
||||
#undef HAVE_VSNPRINTF
|
||||
|
||||
/* Define if you have the `__fpurge' function. */
|
||||
#undef HAVE___FPURGE
|
||||
|
||||
/* Path to sh(1). */
|
||||
#undef PATH_BSHELL
|
||||
|
||||
/* If using the C implementation of alloca, define if you know the
|
||||
direction of stack growth for your system; otherwise it will be
|
||||
automatically deduced at run-time.
|
||||
STACK_DIRECTION > 0 => grows toward higher addresses
|
||||
STACK_DIRECTION < 0 => grows toward lower addresses
|
||||
STACK_DIRECTION = 0 => direction of growth unknown */
|
||||
#undef STACK_DIRECTION
|
||||
|
||||
/* Define if you have the ANSI C header files. */
|
||||
#undef STDC_HEADERS
|
||||
|
||||
/* Define if your processor stores words with the most significant byte first
|
||||
(like Motorola and SPARC, unlike Intel and VAX). */
|
||||
#undef WORDS_BIGENDIAN
|
||||
|
||||
/* Define for NetBSD headers. */
|
||||
#undef _POSIX_C_SOURCE
|
||||
|
||||
/* Define for NetBSD headers. */
|
||||
#undef _POSIX_SOURCE
|
||||
|
||||
/* Define for NetBSD headers. */
|
||||
#undef _XOPEN_SOURCE
|
||||
|
||||
/* Define to `unsigned' if <sys/types.h> does not define. */
|
||||
#undef size_t
|
||||
|
||||
/* Define if you have uint16_t, but not u_int16_t. */
|
||||
#undef u_int16_t
|
||||
|
||||
/* Define if you have uint32_t, but not u_int32_t. */
|
||||
#undef u_int32_t
|
||||
|
||||
/* Define if you have uint64_t, but not u_int64_t. */
|
||||
#undef u_int64_t
|
||||
|
||||
/* Define if you have uint8_t, but not u_int8_t. */
|
||||
#undef u_int8_t
|
||||
|
||||
/* Define if you have u_int16_t, but not uint16_t. */
|
||||
#undef uint16_t
|
||||
|
||||
/* Define if you have u_int32_t, but not uint32_t. */
|
||||
#undef uint32_t
|
||||
|
||||
/* Define if you have u_int64_t, but not uint64_t. */
|
||||
#undef uint64_t
|
||||
|
||||
/* Define if you have u_int8_t, but not uint8_t. */
|
||||
#undef uint8_t
|
||||
|
||||
#include "compat_defs.h"
|
||||
#endif /* !__NETBSD_NBTOOL_CONFIG_H__ */
|
7
tools/compat/ndbm.h
Normal file
7
tools/compat/ndbm.h
Normal file
|
@ -0,0 +1,7 @@
|
|||
/* $NetBSD: ndbm.h,v 1.1 2010/02/03 15:34:44 roy Exp $ */
|
||||
|
||||
#include "nbtool_config.h"
|
||||
#ifndef DBM_SUFFIX
|
||||
#define DBM_SUFFIX ".db"
|
||||
#endif
|
||||
#include "../../include/ndbm.h"
|
5
tools/compat/nl_types.h
Normal file
5
tools/compat/nl_types.h
Normal file
|
@ -0,0 +1,5 @@
|
|||
/* $NetBSD: nl_types.h,v 1.1 2002/01/29 10:20:32 tv Exp $ */
|
||||
|
||||
#ifdef _NLS_PRIVATE
|
||||
#include "../../include/nl_types.h"
|
||||
#endif
|
55
tools/compat/pread.c
Normal file
55
tools/compat/pread.c
Normal file
|
@ -0,0 +1,55 @@
|
|||
/* $NetBSD: pread.c,v 1.4 2008/04/28 20:24:12 martin Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Todd Vierling.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/* Emulate pread() with lseek()/read()/lseek(). Not thread-safe, of course. */
|
||||
|
||||
#include "nbtool_config.h"
|
||||
|
||||
#if !HAVE_PREAD
|
||||
#include <unistd.h>
|
||||
|
||||
ssize_t pread(int d, void *buf, size_t nbytes, off_t offset) {
|
||||
off_t oldoff = lseek(d, offset, SEEK_SET);
|
||||
int olderrno;
|
||||
ssize_t nr;
|
||||
|
||||
if (oldoff < 0)
|
||||
return -1;
|
||||
|
||||
nr = read(d, buf, nbytes);
|
||||
|
||||
olderrno = errno;
|
||||
lseek(d, oldoff, SEEK_SET);
|
||||
errno = olderrno;
|
||||
|
||||
return nr;
|
||||
}
|
||||
#endif
|
47
tools/compat/putc_unlocked.c
Normal file
47
tools/compat/putc_unlocked.c
Normal file
|
@ -0,0 +1,47 @@
|
|||
/* $NetBSD: putc_unlocked.c,v 1.4 2008/04/28 20:24:12 martin Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2003 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Jason R. Thorpe.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/* Emulate putc_unlocked(). */
|
||||
|
||||
#include "nbtool_config.h"
|
||||
|
||||
#if !HAVE_PUTC_UNLOCKED
|
||||
#include <stdio.h>
|
||||
|
||||
#ifndef putc_unlocked
|
||||
int
|
||||
putc_unlocked(int c, FILE *stream)
|
||||
{
|
||||
|
||||
putc(c, stream);
|
||||
}
|
||||
#endif /* putc_unlocked */
|
||||
#endif
|
55
tools/compat/pwrite.c
Normal file
55
tools/compat/pwrite.c
Normal file
|
@ -0,0 +1,55 @@
|
|||
/* $NetBSD: pwrite.c,v 1.4 2008/04/28 20:24:12 martin Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Todd Vierling.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/* Emulate pwrite() with lseek()/write()/lseek(). Not thread-safe, of course. */
|
||||
|
||||
#include "nbtool_config.h"
|
||||
|
||||
#if !HAVE_PWRITE
|
||||
#include <unistd.h>
|
||||
|
||||
ssize_t pwrite(int d, const void *buf, size_t nbytes, off_t offset) {
|
||||
off_t oldoff = lseek(d, offset, SEEK_SET);
|
||||
int olderrno;
|
||||
ssize_t nw;
|
||||
|
||||
if (oldoff < 0)
|
||||
return -1;
|
||||
|
||||
nw = write(d, buf, nbytes);
|
||||
|
||||
olderrno = errno;
|
||||
lseek(d, oldoff, SEEK_SET);
|
||||
errno = olderrno;
|
||||
|
||||
return nw;
|
||||
}
|
||||
#endif
|
50
tools/compat/setenv.c
Normal file
50
tools/compat/setenv.c
Normal file
|
@ -0,0 +1,50 @@
|
|||
/* $NetBSD: setenv.c,v 1.4 2008/04/28 20:24:12 martin Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Todd Vierling.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/* Emulate setenv() with getenv()/malloc()/putenv(). */
|
||||
|
||||
#include "nbtool_config.h"
|
||||
|
||||
#if !HAVE_SETENV
|
||||
int setenv(const char *name, const char *value, int overwrite) {
|
||||
char *buf;
|
||||
|
||||
if (!overwrite && getenv(name))
|
||||
return 0;
|
||||
|
||||
/* Include sizes plus '=' and trailing null. */
|
||||
if (!(buf = malloc(strlen(name) + strlen(value) + 2)))
|
||||
return -1;
|
||||
|
||||
sprintf(buf, "%s=%s", name, value);
|
||||
putenv(buf);
|
||||
}
|
||||
#endif
|
12
tools/compat/setgroupent.c
Normal file
12
tools/compat/setgroupent.c
Normal file
|
@ -0,0 +1,12 @@
|
|||
/* $NetBSD: setgroupent.c,v 1.4 2003/10/27 00:12:43 lukem Exp $ */
|
||||
|
||||
#include "nbtool_config.h"
|
||||
|
||||
#if !HAVE_SETGROUPENT || !HAVE_DECL_SETGROUPENT
|
||||
#include <grp.h>
|
||||
|
||||
int setgroupent(int stayopen) {
|
||||
setgrent();
|
||||
return 1;
|
||||
}
|
||||
#endif
|
12
tools/compat/setpassent.c
Normal file
12
tools/compat/setpassent.c
Normal file
|
@ -0,0 +1,12 @@
|
|||
/* $NetBSD: setpassent.c,v 1.4 2003/10/27 00:12:43 lukem Exp $ */
|
||||
|
||||
#include "nbtool_config.h"
|
||||
|
||||
#if !HAVE_SETPASSENT || !HAVE_DECL_SETPASSENT
|
||||
#include <pwd.h>
|
||||
|
||||
int setpassent(int stayopen) {
|
||||
setpwent();
|
||||
return 1;
|
||||
}
|
||||
#endif
|
54
tools/compat/setprogname.c
Normal file
54
tools/compat/setprogname.c
Normal file
|
@ -0,0 +1,54 @@
|
|||
/* $NetBSD: setprogname.c,v 1.5 2008/04/28 20:24:12 martin Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Todd Vierling.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "nbtool_config.h"
|
||||
|
||||
#if !HAVE_SETPROGNAME
|
||||
#include <string.h>
|
||||
|
||||
static const char *__progname = "command line";
|
||||
|
||||
void
|
||||
setprogname(const char *progname)
|
||||
{
|
||||
__progname = strrchr(progname, '/');
|
||||
if (__progname == NULL)
|
||||
__progname = progname;
|
||||
else
|
||||
__progname++;
|
||||
}
|
||||
|
||||
const char *
|
||||
getprogname(void)
|
||||
{
|
||||
return __progname;
|
||||
}
|
||||
#endif
|
663
tools/compat/snprintf.c
Normal file
663
tools/compat/snprintf.c
Normal file
|
@ -0,0 +1,663 @@
|
|||
/*
|
||||
* Copyright (c) 1995-2001 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/* From heimdal lib/roken/snprintf.c. */
|
||||
|
||||
#if HAVE_NBTOOL_CONFIG_H
|
||||
#include "nbtool_config.h"
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
RCSID("$Id: snprintf.c,v 1.3 2003/10/27 00:12:43 lukem Exp $");
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#if 0
|
||||
#include <roken.h>
|
||||
#endif
|
||||
|
||||
#undef min
|
||||
#define min(a,b) ((a) < (b) ? (a) : (b))
|
||||
#undef max
|
||||
#define max(a,b) ((a) > (b) ? (a) : (b))
|
||||
|
||||
enum format_flags {
|
||||
minus_flag = 1,
|
||||
plus_flag = 2,
|
||||
space_flag = 4,
|
||||
alternate_flag = 8,
|
||||
zero_flag = 16
|
||||
};
|
||||
|
||||
/*
|
||||
* Common state
|
||||
*/
|
||||
|
||||
struct state {
|
||||
unsigned char *str;
|
||||
unsigned char *s;
|
||||
unsigned char *theend;
|
||||
size_t sz;
|
||||
size_t max_sz;
|
||||
void (*append_char)(struct state *, unsigned char);
|
||||
/* XXX - methods */
|
||||
};
|
||||
|
||||
#if TEST_SNPRINTF
|
||||
#include "snprintf-test.h"
|
||||
#endif /* TEST_SNPRINTF */
|
||||
|
||||
#if !defined(HAVE_VSNPRINTF) || defined(TEST_SNPRINTF)
|
||||
static int
|
||||
sn_reserve (struct state *state, size_t n)
|
||||
{
|
||||
return state->s + n > state->theend;
|
||||
}
|
||||
|
||||
static void
|
||||
sn_append_char (struct state *state, unsigned char c)
|
||||
{
|
||||
if (!sn_reserve (state, 1))
|
||||
*state->s++ = c;
|
||||
}
|
||||
#endif
|
||||
|
||||
static int
|
||||
as_reserve (struct state *state, size_t n)
|
||||
{
|
||||
if (state->s + n > state->theend) {
|
||||
int off = state->s - state->str;
|
||||
unsigned char *tmp;
|
||||
|
||||
if (state->max_sz && state->sz >= state->max_sz)
|
||||
return 1;
|
||||
|
||||
state->sz = max(state->sz * 2, state->sz + n);
|
||||
if (state->max_sz)
|
||||
state->sz = min(state->sz, state->max_sz);
|
||||
tmp = realloc (state->str, state->sz);
|
||||
if (tmp == NULL)
|
||||
return 1;
|
||||
state->str = tmp;
|
||||
state->s = state->str + off;
|
||||
state->theend = state->str + state->sz - 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
as_append_char (struct state *state, unsigned char c)
|
||||
{
|
||||
if(!as_reserve (state, 1))
|
||||
*state->s++ = c;
|
||||
}
|
||||
|
||||
/* longest integer types */
|
||||
|
||||
#ifdef HAVE_LONG_LONG
|
||||
typedef unsigned long long u_longest;
|
||||
typedef long long longest;
|
||||
#else
|
||||
typedef unsigned long u_longest;
|
||||
typedef long longest;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* is # supposed to do anything?
|
||||
*/
|
||||
|
||||
static int
|
||||
use_alternative (int flags, u_longest num, unsigned base)
|
||||
{
|
||||
return flags & alternate_flag && (base == 16 || base == 8) && num != 0;
|
||||
}
|
||||
|
||||
static int
|
||||
append_number(struct state *state,
|
||||
u_longest num, unsigned base, char *rep,
|
||||
int width, int prec, int flags, int minusp)
|
||||
{
|
||||
int len = 0;
|
||||
int i;
|
||||
u_longest n = num;
|
||||
|
||||
/* given precision, ignore zero flag */
|
||||
if(prec != -1)
|
||||
flags &= ~zero_flag;
|
||||
else
|
||||
prec = 1;
|
||||
/* zero value with zero precision -> "" */
|
||||
if(prec == 0 && n == 0)
|
||||
return 0;
|
||||
do{
|
||||
(*state->append_char)(state, rep[n % base]);
|
||||
++len;
|
||||
n /= base;
|
||||
} while(n);
|
||||
prec -= len;
|
||||
/* pad with prec zeros */
|
||||
while(prec-- > 0){
|
||||
(*state->append_char)(state, '0');
|
||||
++len;
|
||||
}
|
||||
/* add length of alternate prefix (added later) to len */
|
||||
if(use_alternative(flags, num, base))
|
||||
len += base / 8;
|
||||
/* pad with zeros */
|
||||
if(flags & zero_flag){
|
||||
width -= len;
|
||||
if(minusp || (flags & space_flag) || (flags & plus_flag))
|
||||
width--;
|
||||
while(width-- > 0){
|
||||
(*state->append_char)(state, '0');
|
||||
len++;
|
||||
}
|
||||
}
|
||||
/* add alternate prefix */
|
||||
if(use_alternative(flags, num, base)){
|
||||
if(base == 16)
|
||||
(*state->append_char)(state, rep[10] + 23); /* XXX */
|
||||
(*state->append_char)(state, '0');
|
||||
}
|
||||
/* add sign */
|
||||
if(minusp){
|
||||
(*state->append_char)(state, '-');
|
||||
++len;
|
||||
} else if(flags & plus_flag) {
|
||||
(*state->append_char)(state, '+');
|
||||
++len;
|
||||
} else if(flags & space_flag) {
|
||||
(*state->append_char)(state, ' ');
|
||||
++len;
|
||||
}
|
||||
if(flags & minus_flag)
|
||||
/* swap before padding with spaces */
|
||||
for(i = 0; i < len / 2; i++){
|
||||
char c = state->s[-i-1];
|
||||
state->s[-i-1] = state->s[-len+i];
|
||||
state->s[-len+i] = c;
|
||||
}
|
||||
width -= len;
|
||||
while(width-- > 0){
|
||||
(*state->append_char)(state, ' ');
|
||||
++len;
|
||||
}
|
||||
if(!(flags & minus_flag))
|
||||
/* swap after padding with spaces */
|
||||
for(i = 0; i < len / 2; i++){
|
||||
char c = state->s[-i-1];
|
||||
state->s[-i-1] = state->s[-len+i];
|
||||
state->s[-len+i] = c;
|
||||
}
|
||||
return len;
|
||||
}
|
||||
|
||||
/*
|
||||
* return length
|
||||
*/
|
||||
|
||||
static int
|
||||
append_string (struct state *state,
|
||||
const unsigned char *arg,
|
||||
int width,
|
||||
int prec,
|
||||
int flags)
|
||||
{
|
||||
int len = 0;
|
||||
|
||||
if(arg == NULL)
|
||||
arg = (const unsigned char*)"(null)";
|
||||
|
||||
if(prec != -1)
|
||||
width -= prec;
|
||||
else
|
||||
width -= strlen((const char *)arg);
|
||||
if(!(flags & minus_flag))
|
||||
while(width-- > 0) {
|
||||
(*state->append_char) (state, ' ');
|
||||
++len;
|
||||
}
|
||||
if (prec != -1) {
|
||||
while (*arg && prec--) {
|
||||
(*state->append_char) (state, *arg++);
|
||||
++len;
|
||||
}
|
||||
} else {
|
||||
while (*arg) {
|
||||
(*state->append_char) (state, *arg++);
|
||||
++len;
|
||||
}
|
||||
}
|
||||
if(flags & minus_flag)
|
||||
while(width-- > 0) {
|
||||
(*state->append_char) (state, ' ');
|
||||
++len;
|
||||
}
|
||||
return len;
|
||||
}
|
||||
|
||||
static int
|
||||
append_char(struct state *state,
|
||||
unsigned char arg,
|
||||
int width,
|
||||
int flags)
|
||||
{
|
||||
int len = 0;
|
||||
|
||||
while(!(flags & minus_flag) && --width > 0) {
|
||||
(*state->append_char) (state, ' ') ;
|
||||
++len;
|
||||
}
|
||||
(*state->append_char) (state, arg);
|
||||
++len;
|
||||
while((flags & minus_flag) && --width > 0) {
|
||||
(*state->append_char) (state, ' ');
|
||||
++len;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* This can't be made into a function...
|
||||
*/
|
||||
|
||||
#ifdef HAVE_LONG_LONG
|
||||
|
||||
#define PARSE_INT_FORMAT(res, arg, unsig) \
|
||||
if (long_long_flag) \
|
||||
res = (unsig long long)va_arg(arg, unsig long long); \
|
||||
else if (long_flag) \
|
||||
res = (unsig long)va_arg(arg, unsig long); \
|
||||
else if (short_flag) \
|
||||
res = (unsig short)va_arg(arg, unsig int); \
|
||||
else \
|
||||
res = (unsig int)va_arg(arg, unsig int)
|
||||
|
||||
#else
|
||||
|
||||
#define PARSE_INT_FORMAT(res, arg, unsig) \
|
||||
if (long_flag) \
|
||||
res = (unsig long)va_arg(arg, unsig long); \
|
||||
else if (short_flag) \
|
||||
res = (unsig short)va_arg(arg, unsig int); \
|
||||
else \
|
||||
res = (unsig int)va_arg(arg, unsig int)
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* zyxprintf - return length, as snprintf
|
||||
*/
|
||||
|
||||
static int
|
||||
xyzprintf (struct state *state, const char *char_format, va_list ap)
|
||||
{
|
||||
const unsigned char *format = (const unsigned char *)char_format;
|
||||
unsigned char c;
|
||||
int len = 0;
|
||||
|
||||
while((c = *format++)) {
|
||||
if (c == '%') {
|
||||
int flags = 0;
|
||||
int width = 0;
|
||||
int prec = -1;
|
||||
int long_long_flag = 0;
|
||||
int long_flag = 0;
|
||||
int short_flag = 0;
|
||||
|
||||
/* flags */
|
||||
while((c = *format++)){
|
||||
if(c == '-')
|
||||
flags |= minus_flag;
|
||||
else if(c == '+')
|
||||
flags |= plus_flag;
|
||||
else if(c == ' ')
|
||||
flags |= space_flag;
|
||||
else if(c == '#')
|
||||
flags |= alternate_flag;
|
||||
else if(c == '0')
|
||||
flags |= zero_flag;
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
if((flags & space_flag) && (flags & plus_flag))
|
||||
flags ^= space_flag;
|
||||
|
||||
if((flags & minus_flag) && (flags & zero_flag))
|
||||
flags ^= zero_flag;
|
||||
|
||||
/* width */
|
||||
if (isdigit(c))
|
||||
do {
|
||||
width = width * 10 + c - '0';
|
||||
c = *format++;
|
||||
} while(isdigit(c));
|
||||
else if(c == '*') {
|
||||
width = va_arg(ap, int);
|
||||
c = *format++;
|
||||
}
|
||||
|
||||
/* precision */
|
||||
if (c == '.') {
|
||||
prec = 0;
|
||||
c = *format++;
|
||||
if (isdigit(c))
|
||||
do {
|
||||
prec = prec * 10 + c - '0';
|
||||
c = *format++;
|
||||
} while(isdigit(c));
|
||||
else if (c == '*') {
|
||||
prec = va_arg(ap, int);
|
||||
c = *format++;
|
||||
}
|
||||
}
|
||||
|
||||
/* size */
|
||||
|
||||
if (c == 'h') {
|
||||
short_flag = 1;
|
||||
c = *format++;
|
||||
} else if (c == 'l') {
|
||||
long_flag = 1;
|
||||
c = *format++;
|
||||
if (c == 'l') {
|
||||
long_long_flag = 1;
|
||||
c = *format++;
|
||||
}
|
||||
}
|
||||
|
||||
switch (c) {
|
||||
case 'c' :
|
||||
append_char(state, va_arg(ap, int), width, flags);
|
||||
++len;
|
||||
break;
|
||||
case 's' :
|
||||
len += append_string(state,
|
||||
va_arg(ap, unsigned char*),
|
||||
width,
|
||||
prec,
|
||||
flags);
|
||||
break;
|
||||
case 'd' :
|
||||
case 'i' : {
|
||||
longest arg;
|
||||
u_longest num;
|
||||
int minusp = 0;
|
||||
|
||||
PARSE_INT_FORMAT(arg, ap, signed);
|
||||
|
||||
if (arg < 0) {
|
||||
minusp = 1;
|
||||
num = -arg;
|
||||
} else
|
||||
num = arg;
|
||||
|
||||
len += append_number (state, num, 10, "0123456789",
|
||||
width, prec, flags, minusp);
|
||||
break;
|
||||
}
|
||||
case 'u' : {
|
||||
u_longest arg;
|
||||
|
||||
PARSE_INT_FORMAT(arg, ap, unsigned);
|
||||
|
||||
len += append_number (state, arg, 10, "0123456789",
|
||||
width, prec, flags, 0);
|
||||
break;
|
||||
}
|
||||
case 'o' : {
|
||||
u_longest arg;
|
||||
|
||||
PARSE_INT_FORMAT(arg, ap, unsigned);
|
||||
|
||||
len += append_number (state, arg, 010, "01234567",
|
||||
width, prec, flags, 0);
|
||||
break;
|
||||
}
|
||||
case 'x' : {
|
||||
u_longest arg;
|
||||
|
||||
PARSE_INT_FORMAT(arg, ap, unsigned);
|
||||
|
||||
len += append_number (state, arg, 0x10, "0123456789abcdef",
|
||||
width, prec, flags, 0);
|
||||
break;
|
||||
}
|
||||
case 'X' :{
|
||||
u_longest arg;
|
||||
|
||||
PARSE_INT_FORMAT(arg, ap, unsigned);
|
||||
|
||||
len += append_number (state, arg, 0x10, "0123456789ABCDEF",
|
||||
width, prec, flags, 0);
|
||||
break;
|
||||
}
|
||||
case 'p' : {
|
||||
unsigned long arg = (unsigned long)va_arg(ap, void*);
|
||||
|
||||
len += append_number (state, arg, 0x10, "0123456789ABCDEF",
|
||||
width, prec, flags, 0);
|
||||
break;
|
||||
}
|
||||
case 'n' : {
|
||||
int *arg = va_arg(ap, int*);
|
||||
*arg = state->s - state->str;
|
||||
break;
|
||||
}
|
||||
case '\0' :
|
||||
--format;
|
||||
/* FALLTHROUGH */
|
||||
case '%' :
|
||||
(*state->append_char)(state, c);
|
||||
++len;
|
||||
break;
|
||||
default :
|
||||
(*state->append_char)(state, '%');
|
||||
(*state->append_char)(state, c);
|
||||
len += 2;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
(*state->append_char) (state, c);
|
||||
++len;
|
||||
}
|
||||
}
|
||||
return len;
|
||||
}
|
||||
|
||||
#if !defined(HAVE_SNPRINTF) || defined(TEST_SNPRINTF)
|
||||
int
|
||||
snprintf (char *str, size_t sz, const char *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
int ret;
|
||||
|
||||
va_start(args, format);
|
||||
ret = vsnprintf (str, sz, format, args);
|
||||
va_end(args);
|
||||
|
||||
#ifdef PARANOIA
|
||||
{
|
||||
int ret2;
|
||||
char *tmp;
|
||||
|
||||
tmp = malloc (sz);
|
||||
if (tmp == NULL)
|
||||
abort ();
|
||||
|
||||
va_start(args, format);
|
||||
ret2 = vsprintf (tmp, format, args);
|
||||
va_end(args);
|
||||
if (ret != ret2 || strcmp(str, tmp))
|
||||
abort ();
|
||||
free (tmp);
|
||||
}
|
||||
#endif
|
||||
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(HAVE_ASPRINTF) || defined(TEST_SNPRINTF)
|
||||
int
|
||||
asprintf (char **ret, const char *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
int val;
|
||||
|
||||
va_start(args, format);
|
||||
val = vasprintf (ret, format, args);
|
||||
|
||||
#ifdef PARANOIA
|
||||
{
|
||||
int ret2;
|
||||
char *tmp;
|
||||
tmp = malloc (val + 1);
|
||||
if (tmp == NULL)
|
||||
abort ();
|
||||
|
||||
ret2 = vsprintf (tmp, format, args);
|
||||
if (val != ret2 || strcmp(*ret, tmp))
|
||||
abort ();
|
||||
free (tmp);
|
||||
}
|
||||
#endif
|
||||
|
||||
va_end(args);
|
||||
return val;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(HAVE_ASNPRINTF) || defined(TEST_SNPRINTF)
|
||||
int
|
||||
asnprintf (char **ret, size_t max_sz, const char *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
int val;
|
||||
|
||||
va_start(args, format);
|
||||
val = vasnprintf (ret, max_sz, format, args);
|
||||
|
||||
#ifdef PARANOIA
|
||||
{
|
||||
int ret2;
|
||||
char *tmp;
|
||||
tmp = malloc (val + 1);
|
||||
if (tmp == NULL)
|
||||
abort ();
|
||||
|
||||
ret2 = vsprintf (tmp, format, args);
|
||||
if (val != ret2 || strcmp(*ret, tmp))
|
||||
abort ();
|
||||
free (tmp);
|
||||
}
|
||||
#endif
|
||||
|
||||
va_end(args);
|
||||
return val;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(HAVE_VASPRINTF) || defined(TEST_SNPRINTF)
|
||||
int
|
||||
vasprintf (char **ret, const char *format, va_list args)
|
||||
{
|
||||
return vasnprintf (ret, 0, format, args);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if !defined(HAVE_VASNPRINTF) || defined(TEST_SNPRINTF)
|
||||
int
|
||||
vasnprintf (char **ret, size_t max_sz, const char *format, va_list args)
|
||||
{
|
||||
int st;
|
||||
struct state state;
|
||||
|
||||
state.max_sz = max_sz;
|
||||
state.sz = 1;
|
||||
state.str = malloc(state.sz);
|
||||
if (state.str == NULL) {
|
||||
*ret = NULL;
|
||||
return -1;
|
||||
}
|
||||
state.s = state.str;
|
||||
state.theend = state.s + state.sz - 1;
|
||||
state.append_char = as_append_char;
|
||||
|
||||
st = xyzprintf (&state, format, args);
|
||||
if (st > state.sz) {
|
||||
free (state.str);
|
||||
*ret = NULL;
|
||||
return -1;
|
||||
} else {
|
||||
char *tmp;
|
||||
|
||||
*state.s = '\0';
|
||||
tmp = realloc (state.str, st+1);
|
||||
if (tmp == NULL) {
|
||||
free (state.str);
|
||||
*ret = NULL;
|
||||
return -1;
|
||||
}
|
||||
*ret = tmp;
|
||||
return st;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(HAVE_VSNPRINTF) || defined(TEST_SNPRINTF)
|
||||
int
|
||||
vsnprintf (char *str, size_t sz, const char *format, va_list args)
|
||||
{
|
||||
struct state state;
|
||||
int ret;
|
||||
unsigned char *ustr = (unsigned char *)str;
|
||||
|
||||
state.max_sz = 0;
|
||||
state.sz = sz;
|
||||
state.str = ustr;
|
||||
state.s = ustr;
|
||||
state.theend = ustr + sz - (sz > 0);
|
||||
state.append_char = sn_append_char;
|
||||
|
||||
ret = xyzprintf (&state, format, args);
|
||||
if (state.s != NULL)
|
||||
*state.s = '\0';
|
||||
return ret;
|
||||
}
|
||||
#endif
|
3
tools/compat/sys/null.h
Normal file
3
tools/compat/sys/null.h
Normal file
|
@ -0,0 +1,3 @@
|
|||
/* $NetBSD: null.h,v 1.1 2007/07/19 13:49:12 jmmv Exp $ */
|
||||
|
||||
#include "../../../sys/sys/null.h"
|
3
tools/compat/sys/queue.h
Normal file
3
tools/compat/sys/queue.h
Normal file
|
@ -0,0 +1,3 @@
|
|||
/* $NetBSD: queue.h,v 1.1 2002/01/21 20:04:37 tv Exp $ */
|
||||
|
||||
#include "../../../sys/sys/queue.h"
|
3
tools/compat/sys/rmd160.h
Normal file
3
tools/compat/sys/rmd160.h
Normal file
|
@ -0,0 +1,3 @@
|
|||
/* $NetBSD: rmd160.h,v 1.1 2006/10/27 22:32:45 mrg Exp $ */
|
||||
|
||||
#include "../../../sys/sys/rmd160.h"
|
5
tools/compat/sys/sha1.h
Normal file
5
tools/compat/sys/sha1.h
Normal file
|
@ -0,0 +1,5 @@
|
|||
/* $NetBSD: sha1.h,v 1.1 2006/10/29 06:17:08 dogcow Exp $ */
|
||||
|
||||
/* We unconditionally use the NetBSD SHA1 in libnbcompat. */
|
||||
#include "nbtool_config.h"
|
||||
#include "../../sys/sys/sha1.h"
|
3
tools/compat/sys/sha2.h
Normal file
3
tools/compat/sys/sha2.h
Normal file
|
@ -0,0 +1,3 @@
|
|||
/* $NetBSD: sha2.h,v 1.1 2006/10/27 22:32:45 mrg Exp $ */
|
||||
|
||||
#include "../../../sys/sys/sha2.h"
|
3
tools/compat/sys/verified_exec.h
Normal file
3
tools/compat/sys/verified_exec.h
Normal file
|
@ -0,0 +1,3 @@
|
|||
/* $NetBSD: verified_exec.h,v 1.1 2006/12/20 22:03:20 agc Exp $ */
|
||||
|
||||
#include "../../sys/sys/verified_exec.h"
|
3
tools/compat/tzfile.h
Normal file
3
tools/compat/tzfile.h
Normal file
|
@ -0,0 +1,3 @@
|
|||
/* $NetBSD: tzfile.h,v 1.1 2002/01/31 22:43:49 tv Exp $ */
|
||||
|
||||
#include "../../include/tzfile.h"
|
3
tools/compat/ufs/ffs/ffs_extern.h
Normal file
3
tools/compat/ufs/ffs/ffs_extern.h
Normal file
|
@ -0,0 +1,3 @@
|
|||
/* $NetBSD: ffs_extern.h,v 1.1 2003/05/14 00:30:26 dbj Exp $ */
|
||||
|
||||
#include "../../../../sys/ufs/ffs/ffs_extern.h"
|
3
tools/compat/ufs/ffs/fs.h
Normal file
3
tools/compat/ufs/ffs/fs.h
Normal file
|
@ -0,0 +1,3 @@
|
|||
/* $NetBSD: fs.h,v 1.1 2003/05/14 00:30:26 dbj Exp $ */
|
||||
|
||||
#include "../../../../sys/ufs/ffs/fs.h"
|
3
tools/compat/ufs/ufs/dinode.h
Normal file
3
tools/compat/ufs/ufs/dinode.h
Normal file
|
@ -0,0 +1,3 @@
|
|||
/* $NetBSD: dinode.h,v 1.1 2003/05/14 00:30:26 dbj Exp $ */
|
||||
|
||||
#include "../../../../sys/ufs/ufs/dinode.h"
|
3
tools/compat/ufs/ufs/dir.h
Normal file
3
tools/compat/ufs/ufs/dir.h
Normal file
|
@ -0,0 +1,3 @@
|
|||
/* $NetBSD: dir.h,v 1.1 2003/05/14 00:30:27 dbj Exp $ */
|
||||
|
||||
#include "../../../../sys/ufs/ufs/dir.h"
|
3
tools/compat/ufs/ufs/quota.h
Normal file
3
tools/compat/ufs/ufs/quota.h
Normal file
|
@ -0,0 +1,3 @@
|
|||
/* $NetBSD: quota.h,v 1.1 2011/03/07 02:02:36 joerg Exp $ */
|
||||
|
||||
#include "../../../../sys/ufs/ufs/quota.h"
|
3
tools/compat/ufs/ufs/ufs_bswap.h
Normal file
3
tools/compat/ufs/ufs/ufs_bswap.h
Normal file
|
@ -0,0 +1,3 @@
|
|||
/* $NetBSD: ufs_bswap.h,v 1.1 2003/05/14 00:30:27 dbj Exp $ */
|
||||
|
||||
#include "../../../../sys/ufs/ufs/ufs_bswap.h"
|
5
tools/compat/vis.h
Normal file
5
tools/compat/vis.h
Normal file
|
@ -0,0 +1,5 @@
|
|||
/* $NetBSD: vis.h,v 1.2 2003/10/27 00:12:43 lukem Exp $ */
|
||||
|
||||
/* We unconditionally use the NetBSD vis(3) in libnbcompat. */
|
||||
#include "nbtool_config.h"
|
||||
#include "../../include/vis.h"
|
208
tools/gcc/Makefile
Normal file
208
tools/gcc/Makefile
Normal file
|
@ -0,0 +1,208 @@
|
|||
# $NetBSD: Makefile,v 1.50 2012/01/10 12:27:54 skrll Exp $
|
||||
|
||||
.include <bsd.own.mk>
|
||||
|
||||
GCC_LANGUAGES=c c++ objc
|
||||
MODULE= gcc4
|
||||
|
||||
MKNATIVE_CONFIG_TARGET_LIBS= \
|
||||
configure-target-libiberty \
|
||||
configure-target-libstdc++-v3 \
|
||||
configure-target-libobjc \
|
||||
configure-target-libgcc
|
||||
|
||||
.if ${HAVE_GCC} == 45
|
||||
MKNATIVE_TARGET= gcc45
|
||||
GNUHOSTDIST= ${.CURDIR}/../../external/gpl3/gcc/dist
|
||||
MKNATIVE_CONFIG_TARGET_LIBS+= \
|
||||
configure-target-libgomp
|
||||
.else
|
||||
MKNATIVE_TARGET= gcc4
|
||||
.endif
|
||||
|
||||
BINENV= /usr/bin/env -i
|
||||
|
||||
VAX_CONFIGURE_ARGS=
|
||||
|
||||
.if ${MACHINE_ARCH} == "x86_64" || ${MACHINE_ARCH} == "sparc64"
|
||||
MULTILIB_ARGS= --enable-multilib
|
||||
.else
|
||||
MULTILIB_ARGS= --disable-multilib
|
||||
.endif
|
||||
|
||||
.if ${MKSOFTFLOAT} != "no"
|
||||
SOFTFLOAT_ARGS= -with-float=soft
|
||||
.endif
|
||||
|
||||
COMMON_CONFIGURE_ARGS= --target=${MACHINE_GNU_PLATFORM} \
|
||||
--enable-long-long \
|
||||
--enable-threads \
|
||||
--with-bugurl=http://www.NetBSD.org/Misc/send-pr.html \
|
||||
--with-pkgversion="NetBSD nb2 20111202" \
|
||||
${VAX_CONFIGURE_ARGS} \
|
||||
--enable-__cxa_atexit \
|
||||
--target=i386-elf-minix \
|
||||
--with-as="${TOOLDIR}/i386-elf-minix/bin/as" \
|
||||
--with-ld="${TOOLDIR}/i386-elf-minix/bin/ld" \
|
||||
--disable-threads \
|
||||
--disable-visibility \
|
||||
--enable-__cxa_atexit \
|
||||
--disable-libunwind
|
||||
# --with-headers="/home/thomas/Documents/minix/cc3/obj/destdir.i386/usr/include"
|
||||
|
||||
.if defined(GCC_CONFIG_ARCH.${MACHINE_ARCH})
|
||||
COMMON_CONFIGURE_ARGS+= --with-arch=${GCC_CONFIG_ARCH.${MACHINE_ARCH}}
|
||||
.endif
|
||||
.if defined(GCC_CONFIG_TUNE.${MACHINE_ARCH})
|
||||
COMMON_CONFIGURE_ARGS+= --with-tune=${GCC_CONFIG_TUNE.${MACHINE_ARCH}}
|
||||
.endif
|
||||
|
||||
CONFIGURE_ARGS= ${COMMON_CONFIGURE_ARGS}
|
||||
.if ${HAVE_GCC} >= 45
|
||||
CONFIGURE_ARGS+= \
|
||||
--with-mpc=${TOOLDIR} \
|
||||
--with-mpfr=${TOOLDIR} \
|
||||
--with-gmp=${TOOLDIR}
|
||||
.endif
|
||||
CONFIGURE_ARGS+= \
|
||||
--disable-nls \
|
||||
${MULTILIB_ARGS} \
|
||||
${SOFTFLOAT_ARGS} \
|
||||
--program-transform-name="s,^,${MACHINE_GNU_PLATFORM}-," \
|
||||
--enable-languages=c
|
||||
|
||||
GCC_CPPFLAGS= -DNETBSD_TOOLS -DTARGET_SYSTEM_ROOT=0 \
|
||||
-DTARGET_SYSTEM_ROOT_RELOCATABLE
|
||||
|
||||
MAKE_ARGS= MACHINE= MAKEINFO=${TOOL_MAKEINFO:Q} \
|
||||
LIBGCC= LIBGCC1= LIBGCC1_TEST= LIBGCC2= INSTALL_LIBGCC= \
|
||||
EXTRA_PARTS= CPPFLAGS=${GCC_CPPFLAGS:Q} \
|
||||
AR=${HOST_AR:Q} RANLIB=${HOST_RANLIB:Q}
|
||||
|
||||
CONFIGURE_ENV+= gcc_cv_libc_provides_ssp=yes \
|
||||
gcc_cv_as_sparc_gotdata_op=no
|
||||
|
||||
MKNATIVE_ENV= ${BINENV} ${CONFIGURE_ENV:NC*:NLD*} \
|
||||
CC_FOR_BUILD=${HOST_CC:Q} \
|
||||
CC=${CC:Q}' '${CCADDFLAGS:Q} \
|
||||
CXX=${CXX:Q}' '${CCADDFLAGS:Q}' '${CXXADDFLAGS:Q} \
|
||||
CPP=${CPP:Q}' '-I${DESTDIR}/usr/include \
|
||||
CFLAGS= CPPFLAGS= CXXFLAGS= LDFLAGS= \
|
||||
AS=${AS:Q} AWK=${TOOL_AWK:Q} LD=${LD:Q} \
|
||||
MSGFMT=${TOOLDIR}/bin/${_TOOL_PREFIX}msgfmt \
|
||||
NM=${NM:Q} OBJDUMP=${OBJDUMP:Q} \
|
||||
XGETTEXT=${TOOLDIR}/bin/${_TOOL_PREFIX}xgettext \
|
||||
LIBS=-lintl \
|
||||
ac_cv_prog_cc_cross=yes \
|
||||
ac_cv_func_strcoll_works=yes \
|
||||
ac_cv_func_elf_getshstrndx=no \
|
||||
gcc_cv_func_printf_ptr=yes \
|
||||
gcc_cv_libc_provides_ssp=yes \
|
||||
gdb_cv_printf_has_long_double=yes \
|
||||
gdb_cv_printf_has_long_long=yes \
|
||||
gdb_cv_scanf_has_long_double=yes \
|
||||
gcc_cv_as_sparc_gotdata_op=no
|
||||
|
||||
ALL_TARGET= all-gcc
|
||||
INSTALL_TARGET= install-gcc
|
||||
|
||||
.include "${.CURDIR}/../Makefile.gmakehost"
|
||||
BUILD_MAKE=${TOOL_GMAKE}
|
||||
|
||||
#
|
||||
# mknative-gcc specific stuff
|
||||
#
|
||||
|
||||
.if ${HAVE_GCC} < 45
|
||||
GCCSRCDIR=${.CURDIR}/../../gnu/dist/gcc4
|
||||
.else
|
||||
GCCSRCDIR=${.CURDIR}/../../external/gpl3/gcc/dist
|
||||
.endif
|
||||
|
||||
CXXADDFLAGS= --sysroot=${DESTDIR}
|
||||
CCADDFLAGS= --sysroot=${DESTDIR} -L${DESTDIR}/lib -L${DESTDIR}/usr/lib -B${DESTDIR}/usr/lib/ -I${.OBJDIR}/.native/gcc/include
|
||||
|
||||
NEWCONFIGDIR?= ${.CURDIR}/../..
|
||||
MKNATIVE?= ${.CURDIR}/mknative-gcc
|
||||
|
||||
bootstrap-libgcc: .configure_done
|
||||
@echo 'Creating files needed for libgcc by a native bootstrap build.'
|
||||
@MAKE=${BUILD_MAKE:Q} ${HOST_SH} ${MKNATIVE} lib${MKNATIVE_TARGET} \
|
||||
${.OBJDIR}/build ${NEWCONFIGDIR} ${MACHINE_GNU_PLATFORM} \
|
||||
${DESTDIR}
|
||||
|
||||
native-gcc: .native/.configure_done
|
||||
@echo 'Extracting GNU GCC configury for a native toolchain.'
|
||||
@MAKE=${BUILD_MAKE:Q} ${HOST_SH} ${MKNATIVE} ${MKNATIVE_TARGET} \
|
||||
${.OBJDIR}/.native ${NEWCONFIGDIR} ${MACHINE_GNU_PLATFORM} \
|
||||
${DESTDIR}
|
||||
|
||||
NATIVE_CONFIGURE_ARGS= ${COMMON_CONFIGURE_ARGS}
|
||||
.if ${HAVE_GCC} >= 45
|
||||
NATIVE_CONFIGURE_ARGS+= \
|
||||
--with-mpc=${DESTDIR}/usr \
|
||||
--with-mpfr=${DESTDIR}/usr \
|
||||
--with-gmp=${DESTDIR}/usr
|
||||
|
||||
. if ${MACHINE_ARCH} != "vax"
|
||||
NATIVE_CONFIGURE_ARGS+= --enable-tls
|
||||
. endif
|
||||
.endif
|
||||
NATIVE_CONFIGURE_ARGS+= \
|
||||
--disable-multilib \
|
||||
--disable-symvers \
|
||||
--disable-libstdcxx-pch \
|
||||
--build=`${GCCSRCDIR}/config.guess` \
|
||||
--host=${MACHINE_GNU_PLATFORM}
|
||||
|
||||
.native/.configure_done: ${_GNU_CFGSRC} ${.CURDIR}/Makefile
|
||||
mkdir .native 2>/dev/null || true
|
||||
PATH=${TOOLDIR}/bin:$$PATH; export PATH; \
|
||||
(cd .native && ${MKNATIVE_ENV} \
|
||||
${HOST_SH} ${GNUHOSTDIST}/configure \
|
||||
${NATIVE_CONFIGURE_ARGS}) && \
|
||||
(cd .native && ${MKNATIVE_ENV} ${BUILD_MAKE} all-build-libiberty)
|
||||
PATH=${TOOLDIR}/bin:$$PATH; export PATH; \
|
||||
(cd .native && ${MKNATIVE_ENV} ${BUILD_MAKE} configure-gcc configure-libcpp) && \
|
||||
(cd .native && ${MKNATIVE_ENV} ${BUILD_MAKE} configure-libiberty) && \
|
||||
(cd .native && ${MKNATIVE_ENV} ${BUILD_MAKE} configure-libdecnumber)
|
||||
# edit Makefile so that maybe-all-gcc does not depend on all-gcc any more.
|
||||
(cd .native && mv Makefile Makefile.config && \
|
||||
${TOOL_SED} -e 's/\(maybe-all-gcc:\) all-gcc/\1/' \
|
||||
-e 's/\(maybe-all-target-libgcc:\) all-target-libgcc/\1/' \
|
||||
< Makefile.config > Makefile)
|
||||
PATH=${TOOLDIR}/bin:$$PATH; export PATH; \
|
||||
(cd .native/gcc && ${MKNATIVE_ENV} ${BUILD_MAKE} -e tree-check.h config.h multilib.h gcov-iov.h)
|
||||
PATH=${TOOLDIR}/bin:$$PATH; export PATH; \
|
||||
(cd .native/gcc && ${MKNATIVE_ENV} ${BUILD_MAKE} -e libgcc.mvars tconfig.h unwind.h)
|
||||
(cd .native && touch gcc/cc1obj gcc/cc1plus gcc/f771 gcc/libgcc.a gcc/libgcc_s.so)
|
||||
.for _lib in ${MKNATIVE_CONFIG_TARGET_LIBS}
|
||||
PATH=${TOOLDIR}/bin:$$PATH; export PATH; \
|
||||
(cd .native && ${MKNATIVE_ENV} ${BUILD_MAKE} \
|
||||
${_lib} \
|
||||
ALL_GCC_C= ALL_GCC_CXX= \
|
||||
CC_FOR_TARGET=${CC:Q}' '${CCADDFLAGS:Q} \
|
||||
CXX_FOR_TARGET=${CXX:Q}' '${CCADDFLAGS:Q}' '${CXXADDFLAGS:Q} \
|
||||
RAW_CXX_FOR_TARGET=${CXX:Q}' '${CCADDFLAGS:Q}' '${CXXADDFLAGS:Q} \
|
||||
CPP=${CPP:Q}' '-I${DESTDIR}/usr/include \
|
||||
ac_cv_prog_cc_cross=yes) && \
|
||||
true
|
||||
.endfor
|
||||
PATH=${TOOLDIR}/bin:$$PATH; export PATH; \
|
||||
(cd .native/${MACHINE_GNU_PLATFORM}/libstdc++-v3/include && \
|
||||
${MKNATIVE_ENV} ${BUILD_MAKE} \
|
||||
CC_FOR_TARGET=${CC:Q}' '${CCADDFLAGS:Q} \
|
||||
CXX_FOR_TARGET=${CXX:Q}' '${CCADDFLAGS:Q}' '${CXXADDFLAGS:Q} \
|
||||
CPP=${CPP:Q}' '-I${DESTDIR}/usr/include \
|
||||
all-local) && \
|
||||
true
|
||||
.if 0
|
||||
PATH=${TOOLDIR}/bin:$$PATH; export PATH; \
|
||||
(cd .native/${MACHINE_GNU_PLATFORM}/libiberty && \
|
||||
${MKNATIVE_ENV} ${BUILD_MAKE} needed-list)
|
||||
.endif
|
||||
@touch $@
|
||||
|
||||
clean: clean.native
|
||||
clean.native:
|
||||
-rm -r -f .native
|
69
tools/gcc/README.mknative
Normal file
69
tools/gcc/README.mknative
Normal file
|
@ -0,0 +1,69 @@
|
|||
$NetBSD: README.mknative,v 1.9 2011/09/21 02:15:18 mrg Exp $
|
||||
|
||||
XXX THIS FILE DOES NOT DESCRIBE GCC 4.5 METHODS PROPERLY XXX
|
||||
|
||||
This file describes how to bootstrap the native toolchain on a new NetBSD
|
||||
platform (and how to update the new toolchain files, if needed). These
|
||||
files may be generated on a cross-compile host without problems.
|
||||
|
||||
NOTE: DO NOT RUN "mknative" BY HAND! It requires the Makefile in this
|
||||
directory to set up certain environments first.
|
||||
|
||||
Since libc's features change over time, the config.h files can change as a
|
||||
result; thus the instructions below are the same no matter whether
|
||||
bootstrapping on a cross or native host. This is important: even on a
|
||||
"native" host, you should bootstrap the toolchain by building from an
|
||||
up-to-date source tree to a $DESTDIR using the exact same instructions.
|
||||
|
||||
In these notes, MACHINE is the $MACHINE of the target. These files can be
|
||||
cross-generated. Though a $MACHINE_ARCH all uses the same config files, you
|
||||
must pick a specific $MACHINE so that building the requisite bits below will
|
||||
work.
|
||||
|
||||
1. Set MKMAINTAINERTOOLS=yes in mk.conf. (Needed so that src/tools/gettext
|
||||
gets built, eliciting proper HAVE_*GETTEXT* defns in config.h files.)
|
||||
|
||||
2. Build and install a cross toolchain (via "build.sh -m MACHINE tools").
|
||||
|
||||
3. In src/tools/gcc, do "nbmake-MACHINE bootstrap-libgcc".
|
||||
|
||||
This will create just enough glue in src/gnu/lib/libgcc4/arch to make it
|
||||
possible to build, based on the toolchain built in ${.OBJDIR}/build.
|
||||
Because the files generated in this step contain things like
|
||||
-DCROSS_COMPILE, they are not suitable for committing. Step 8 below
|
||||
will regenerate the "proper" libgcc config files.
|
||||
|
||||
4. At top level, do
|
||||
"nbmake-MACHINE do-distrib-dirs obj includes MKGCC=no MKBINUTILS=no".
|
||||
|
||||
5. In src/gnu/lib/libgcc4, do "nbmake-MACHINE obj includes".
|
||||
|
||||
6. If the platform sets USE_COMPILERCRTSTUFF=yes, then in src/gnu/lib/crtstuff4
|
||||
do "nbmake-MACHINE dependall install"
|
||||
|
||||
7. In each of src/lib/csu, src/gnu/lib/libgcc4, and src/lib,
|
||||
do "nbmake-MACHINE dependall install".
|
||||
|
||||
Optionally, all of the following may be set in the environment to reduce
|
||||
the amount of code needed to build at this step. Basically, it must be
|
||||
possible for static binaries to build and base system libs to exist so
|
||||
that "configure" can do its job for the target--these MK* options omit
|
||||
the rest for this stage of the build.
|
||||
|
||||
MKCRYPTO=no
|
||||
MKLINT=no
|
||||
MKPROFILE=no
|
||||
MKSHARE=no
|
||||
|
||||
8. In src/tools/gcc, do "nbmake-MACHINE native-gcc".
|
||||
|
||||
This will do a full configury in ${.OBJDIR}/.native that is a "Canadian"
|
||||
cross toolchain (--build reflects the host platform, but --host and
|
||||
--target are the target). The result is a tree that would build a
|
||||
native-to-NetBSD compiler on a cross host, and mknative pulls glue data
|
||||
from this.
|
||||
|
||||
9. Try out a full build using "nbmake-MACHINE"; the result should include
|
||||
a native compiler.
|
||||
|
||||
10. If all is well, commit the glue files added to src/gnu/{lib,usr.bin}/*.
|
215
tools/gcc/files/dragonfly-spec.h
Normal file
215
tools/gcc/files/dragonfly-spec.h
Normal file
|
@ -0,0 +1,215 @@
|
|||
/* $DragonFly: src/gnu/usr.bin/cc41/cc_prep/config/dragonfly-spec.h,v 1.5 2008/07/24 21:45:10 corecode Exp $ */
|
||||
|
||||
/* Base configuration file for all DragonFly targets.
|
||||
Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GCC is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GCC; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* Common DragonFly configuration.
|
||||
All DragonFly architectures should include this file, which will specify
|
||||
their commonalities.
|
||||
|
||||
Adapted from gcc/config/freebsd-spec.h by
|
||||
Joerg Sonnenberger <joerg@bec.de>
|
||||
|
||||
Adapted from gcc/config/freebsd.h by
|
||||
David O'Brien <obrien@FreeBSD.org>
|
||||
Loren J. Rittle <ljrittle@acm.org>. */
|
||||
|
||||
|
||||
/* This defines which switch letters take arguments. On DragonFly, most of
|
||||
the normal cases (defined in gcc.c) apply, and we also have -h* and
|
||||
-z* options (for the linker) (coming from SVR4).
|
||||
We also have -R (alias --rpath), no -z, --soname (-h), --assert etc. */
|
||||
|
||||
#define DFBSD_SWITCH_TAKES_ARG(CHAR) \
|
||||
(DEFAULT_SWITCH_TAKES_ARG (CHAR) \
|
||||
|| (CHAR) == 'h' \
|
||||
|| (CHAR) == 'z' /* ignored by ld */ \
|
||||
|| (CHAR) == 'R')
|
||||
|
||||
/* This defines which multi-letter switches take arguments. */
|
||||
|
||||
#define DFBSD_WORD_SWITCH_TAKES_ARG(STR) \
|
||||
(DEFAULT_WORD_SWITCH_TAKES_ARG (STR) \
|
||||
|| !strcmp ((STR), "rpath") || !strcmp ((STR), "rpath-link") \
|
||||
|| !strcmp ((STR), "soname") || !strcmp ((STR), "defsym") \
|
||||
|| !strcmp ((STR), "assert") || !strcmp ((STR), "dynamic-linker"))
|
||||
|
||||
#define DFBSD_TARGET_OS_CPP_BUILTINS() \
|
||||
do \
|
||||
{ \
|
||||
if (DFBSD_MAJOR == 3) \
|
||||
builtin_define ("__DragonFly__=3"); \
|
||||
else if (DFBSD_MAJOR == 2) \
|
||||
builtin_define ("__DragonFly__=2"); \
|
||||
else if (DFBSD_MAJOR == 1) \
|
||||
builtin_define ("__DragonFly__=1"); \
|
||||
else \
|
||||
builtin_define ("__DragonFly__"); \
|
||||
builtin_define ("__DragonFly_cc_version=100001"); \
|
||||
builtin_define_std ("unix"); \
|
||||
builtin_define ("__KPRINTF_ATTRIBUTE__"); \
|
||||
builtin_assert ("system=unix"); \
|
||||
builtin_assert ("system=bsd"); \
|
||||
builtin_assert ("system=DragonFly"); \
|
||||
DFBSD_TARGET_CPU_CPP_BUILTINS(); \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
/* Define the default DragonFly-specific per-CPU hook code. */
|
||||
#define DFBSD_TARGET_CPU_CPP_BUILTINS() do {} while (0)
|
||||
|
||||
/* Provide a CPP_SPEC appropriate for DragonFly. We just deal with the GCC
|
||||
option `-posix', and PIC issues. */
|
||||
|
||||
#define DFBSD_CPP_SPEC " \
|
||||
%(cpp_cpu) \
|
||||
%{fPIC|fpic|fPIE|fpie:-D__PIC__ -D__pic__} \
|
||||
%{posix:-D_POSIX_SOURCE}"
|
||||
|
||||
/* Provide a STARTFILE_SPEC appropriate for DragonFly. Here we add
|
||||
the magical crtbegin.o file (see crtstuff.c) which provides part
|
||||
of the support for getting C++ file-scope static object constructed
|
||||
before entering `main'. */
|
||||
|
||||
#define DFBSD_STARTFILE_SPEC \
|
||||
"%{!shared: \
|
||||
%{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} \
|
||||
%{!p:%{profile:gcrt1.o%s} \
|
||||
%{!profile:crt1.o%s}}}} \
|
||||
crti.o%s %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}"
|
||||
|
||||
/* Provide a ENDFILE_SPEC appropriate for DragonFly. Here we tack on
|
||||
the magical crtend.o file (see crtstuff.c) which provides part of
|
||||
the support for getting C++ file-scope static object constructed
|
||||
before entering `main', followed by a normal "finalizer" file,
|
||||
`crtn.o'. */
|
||||
|
||||
#define DFBSD_ENDFILE_SPEC \
|
||||
"%{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s"
|
||||
|
||||
/* Provide a LIB_SPEC appropriate for DragonFly as configured and as
|
||||
required by the user-land thread model. Select the appropriate libc,
|
||||
depending on whether we're doing profiling or need threads support.
|
||||
Make it a hard error if -pthread is provided on the command line and gcc
|
||||
was configured with --disable-threads (this will help avoid bug
|
||||
reports from users complaining about threading when they
|
||||
misconfigured the gcc bootstrap but are later consulting DragonFly
|
||||
manual pages that refer to the mythical -pthread option). */
|
||||
|
||||
/* Provide a LIB_SPEC appropriate for DragonFly. Just select the appropriate
|
||||
libc, depending on whether we're doing profiling or need threads support.
|
||||
(simular to the default, except no -lg, and no -p). */
|
||||
|
||||
#ifdef DFBSD_NO_THREADS
|
||||
#define DFBSD_LIB_SPEC " \
|
||||
%{pthread: %eThe -pthread option is only supported on DragonFly when gcc \
|
||||
is built with the --enable-threads configure-time option.} \
|
||||
%{!nostdlib{!nostartfiles{!nolibc: -lc}}} \
|
||||
}"
|
||||
#else
|
||||
#define DFBSD_LIB_SPEC " \
|
||||
%{pthread:-lpthread} \
|
||||
%{!nostdlib: %{!nostartfiles: %{!nolibc: -lc}}} \
|
||||
"
|
||||
#endif
|
||||
|
||||
#define DFBSD_DYNAMIC_LINKER "/usr/libexec/ld-elf.so.2"
|
||||
|
||||
#if 0
|
||||
#define LINK_LIBGCC_SPEC ""
|
||||
#define LIBGCC_SPEC "%{shared: -lgcc_pic} %{!shared: -lgcc}"
|
||||
|
||||
#define PRE_LIB_SPEC " \
|
||||
%{pg: -L"PREFIX2"/lib/gcc41/profiling \
|
||||
%{!static: -rpath /usr/lib/gcc41/profiling \
|
||||
-rpath-link "PREFIX2"/lib/gcc41/profiling}} \
|
||||
%{g: -L"PREFIX2"/lib/gcc41/debug \
|
||||
%{!static: -rpath /usr/lib/gcc41/debug \
|
||||
-rpath-link "PREFIX2"/lib/gcc41/debug}} \
|
||||
-L"PREFIX2"/lib/gcc41 \
|
||||
%{!static: -rpath /usr/lib/gcc41 -rpath-link "PREFIX2"/lib/gcc41} \
|
||||
%{pg: -L"PREFIX2"/lib/profiling \
|
||||
%{!static: -rpath /usr/lib/profiling \
|
||||
-rpath-link "PREFIX2"/lib/profiling}} \
|
||||
%{g: -L"PREFIX2"/lib/debug \
|
||||
%{!static: -rpath /usr/lib/debug -rpath-link "PREFIX2"/lib/debug}} \
|
||||
%{!static: -rpath /usr/lib -rpath-link "PREFIX2"/lib} \
|
||||
"
|
||||
|
||||
#define DFBSD_LINK_COMMAND_SPEC "\
|
||||
%{!fsyntax-only:%{!c:%{!M:%{!MM:%{!E:%{!S:\
|
||||
%(linker) %l " LINK_PIE_SPEC "%X %{o*} %{A} %{d} %{e*} %{m} %{N} %{n} %{r}\
|
||||
%{s} %{t} %{u*} %{x} %{z} %{Z} %{!A:%{!nostdlib:%{!nostartfiles:%S}}}\
|
||||
%{static:} %{L*} %(link_libgcc) %o \
|
||||
%{fprofile-arcs|fprofile-generate: -lgcov}\
|
||||
%{!nostdlib:%{!nodefaultlibs:%(pre_lib)}}\
|
||||
%{!nostdlib:%{!nodefaultlibs:%(link_gcc_c_sequence)}}\
|
||||
%{!A:%{!nostdlib:%{!nostartfiles:%E}}} %{T*} }}}}}}"
|
||||
|
||||
#ifndef PREFIX2
|
||||
#define PREFIX2 "/usr"
|
||||
#endif
|
||||
|
||||
#ifndef STANDARD_STARTFILE_PREFIX_1
|
||||
#define STANDARD_STARTFILE_PREFIX_1 PREFIX2"/lib/gcc41/"
|
||||
#endif
|
||||
#ifndef STANDARD_EXEC_PREFIX
|
||||
#define STANDARD_EXEC_PREFIX PREFIX2"/libexec/gcc41/"
|
||||
#endif
|
||||
#ifndef STANDARD_STARTFILE_PREFIX
|
||||
#define STANDARD_STARTFILE_PREFIX PREFIX2"/lib/"
|
||||
#endif
|
||||
#ifndef TOOLDIR_BASE_PREFIX
|
||||
#define TOOLDIR_BASE_PREFIX PREFIX2"/libexec/gcc41"
|
||||
#endif
|
||||
#ifndef STANDARD_BINDIR_PREFIX
|
||||
#define STANDARD_BINDIR_PREFIX PREFIX2"/libexec/gcc41"
|
||||
#endif
|
||||
#ifndef STANDARD_LIBEXEC_PREFIX
|
||||
#define STANDARD_LIBEXEC_PREFIX PREFIX2"/libexec/gcc41"
|
||||
#endif
|
||||
|
||||
#ifndef GPLUSPLUS_INCLUDE_DIR
|
||||
#define GPLUSPLUS_INCLUDE_DIR PREFIX2"/include/c++"
|
||||
#endif
|
||||
#ifndef GPLUSPLUS_TOOL_INCLUDE_DIR
|
||||
#define GPLUSPLUS_TOOL_INCLUDE_DIR PREFIX2"/include/c++/4.1"
|
||||
#endif
|
||||
#ifndef GPLUSPLUS_BACKWARD_INCLUDE_DIR
|
||||
#define GPLUSPLUS_BACKWARD_INCLUDE_DIR PREFIX2"/include/c++/4.1/backward"
|
||||
#endif
|
||||
#ifndef GCC_LOCAL_INCLUDE_DIR
|
||||
#define GCC_LOCAL_INCLUDE_DIR PREFIX2"/libdata/gcc41"
|
||||
#endif
|
||||
#ifndef GCC_INCLUDE_DIR
|
||||
#define GCC_INCLUDE_DIR PREFIX2"/include"
|
||||
#endif
|
||||
|
||||
#undef INCLUDE_DEFAULTS
|
||||
#define INCLUDE_DEFAULTS \
|
||||
{ \
|
||||
{ GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1 }, \
|
||||
{ GPLUSPLUS_TOOL_INCLUDE_DIR, "G++", 1, 1, 0 }, \
|
||||
{ GPLUSPLUS_BACKWARD_INCLUDE_DIR, "G++", 1, 1, 0 }, \
|
||||
{ GCC_INCLUDE_DIR, "GCC", 0, 0 }, \
|
||||
{ GCC_LOCAL_INCLUDE_DIR, "GCC", 0, 0 }, \
|
||||
{ NULL, NULL, 0, 0 } \
|
||||
}
|
||||
#endif
|
97
tools/gcc/files/dragonfly.h
Normal file
97
tools/gcc/files/dragonfly.h
Normal file
|
@ -0,0 +1,97 @@
|
|||
/* $DragonFly: src/gnu/usr.bin/cc41/cc_prep/config/dragonfly.h,v 1.2 2008/05/19 10:46:39 corecode Exp $ */
|
||||
|
||||
/* Base configuration file for all DragonFly targets.
|
||||
Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GCC is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GCC; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* Common DragonFly configuration.
|
||||
All DragonFly architectures should include this file, which will specify
|
||||
their commonalities.
|
||||
|
||||
Adapted from gcc/config/freebsd.h by
|
||||
Joerg Sonnenberger <joerg@bec.de>
|
||||
|
||||
Adapted from gcc/config/i386/freebsd-elf.h by
|
||||
David O'Brien <obrien@FreeBSD.org>.
|
||||
Further work by David O'Brien <obrien@FreeBSD.org> and
|
||||
Loren J. Rittle <ljrittle@acm.org>. */
|
||||
|
||||
|
||||
/* This defines which switch letters take arguments. On DragonFly, most of
|
||||
the normal cases (defined in gcc.c) apply, and we also have -h* and
|
||||
-z* options (for the linker) (coming from SVR4).
|
||||
We also have -R (alias --rpath), no -z, --soname (-h), --assert etc. */
|
||||
|
||||
#undef SWITCH_TAKES_ARG
|
||||
#define SWITCH_TAKES_ARG(CHAR) (DFBSD_SWITCH_TAKES_ARG(CHAR))
|
||||
|
||||
#undef WORD_SWITCH_TAKES_ARG
|
||||
#define WORD_SWITCH_TAKES_ARG(STR) (DFBSD_WORD_SWITCH_TAKES_ARG(STR))
|
||||
|
||||
#undef TARGET_OS_CPP_BUILTINS
|
||||
#define TARGET_OS_CPP_BUILTINS() DFBSD_TARGET_OS_CPP_BUILTINS()
|
||||
|
||||
#undef CPP_SPEC
|
||||
#define CPP_SPEC DFBSD_CPP_SPEC
|
||||
|
||||
#undef STARTFILE_SPEC
|
||||
#define STARTFILE_SPEC DFBSD_STARTFILE_SPEC
|
||||
|
||||
#undef ENDFILE_SPEC
|
||||
#define ENDFILE_SPEC DFBSD_ENDFILE_SPEC
|
||||
|
||||
#undef LIB_SPEC
|
||||
#define LIB_SPEC DFBSD_LIB_SPEC
|
||||
|
||||
#if 0
|
||||
#undef LINK_COMMAND_SPEC
|
||||
#define LINK_COMMAND_SPEC DFBSD_LINK_COMMAND_SPEC
|
||||
#endif
|
||||
|
||||
/************************[ Target stuff ]***********************************/
|
||||
|
||||
/* All DragonFly Architectures support the ELF object file format. */
|
||||
#undef OBJECT_FORMAT_ELF
|
||||
#define OBJECT_FORMAT_ELF
|
||||
|
||||
/* Don't assume anything about the header files. */
|
||||
#undef NO_IMPLICIT_EXTERN_C
|
||||
#define NO_IMPLICIT_EXTERN_C 1
|
||||
|
||||
/* Make gcc agree with DragonFly's standard headers (<machine/stdint.h>, etc...) */
|
||||
|
||||
#undef WCHAR_TYPE
|
||||
#define WCHAR_TYPE "int"
|
||||
|
||||
#define MATH_LIBRARY_PROFILE "-lm_p"
|
||||
|
||||
/* Code generation parameters. */
|
||||
|
||||
/* Use periods rather than dollar signs in special g++ assembler names.
|
||||
This ensures the configuration knows our system correctly so we can link
|
||||
with libraries compiled with the native cc. */
|
||||
#undef NO_DOLLAR_IN_LABEL
|
||||
|
||||
/* Define this so we can compile MS code for use with WINE. */
|
||||
#define HANDLE_PRAGMA_PACK_PUSH_POP
|
||||
|
||||
/* Used by libgcc2.c. We support file locking with fcntl / F_SETLKW.
|
||||
This enables the test coverage code to use file locking when exiting a
|
||||
program, which avoids race conditions if the program has forked. */
|
||||
#define TARGET_POSIX_IO
|
39
tools/gcc/files/gcov-minix-fs-wrapper.h
Normal file
39
tools/gcc/files/gcov-minix-fs-wrapper.h
Normal file
|
@ -0,0 +1,39 @@
|
|||
/* This header makes it possible to redefine system calls to the
|
||||
* file system. This way, minix servers can re-route the data
|
||||
* that libgcov tries to send to the file system. This is
|
||||
* necessary, because the servers can't access the file system
|
||||
* directly. Instead, they will copy the data to a helping user
|
||||
* space process, which will call the file system for them.
|
||||
* For more information, see the <minix/gcov.h> header file.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
|
||||
/* These function pointers initially point to the standard system library
|
||||
* functions (fopen, etc). All calls to these system library functions are
|
||||
* then redefined to calls to these function pointers. Because the pointers
|
||||
* still point to the original functions, all functionality is unchanged.
|
||||
* Therefore, libgcov won't act differently when linked to applications.
|
||||
* But, when these pointers are redefined by code within the minix servers,
|
||||
* the file system calls get replaced by other functionality.
|
||||
*/
|
||||
|
||||
#define fopen(...) _gcov_fopen(__VA_ARGS__)
|
||||
#define fread(...) _gcov_fread(__VA_ARGS__)
|
||||
#define fwrite(...) _gcov_fwrite(__VA_ARGS__)
|
||||
#define fclose(...) _gcov_fclose(__VA_ARGS__)
|
||||
#define fseek(...) _gcov_fseek(__VA_ARGS__)
|
||||
#define getenv(...) _gcov_getenv(__VA_ARGS__)
|
||||
|
||||
|
||||
/* wrapper to make it possible to disable gcov_exit on a process exit (for mfs) */
|
||||
|
||||
int do_gcov_exit = 1;
|
||||
|
||||
void gcov_exit_wrapper(void){
|
||||
if(do_gcov_exit)
|
||||
gcov_exit();
|
||||
}
|
5
tools/gcc/files/hello.f
Normal file
5
tools/gcc/files/hello.f
Normal file
|
@ -0,0 +1,5 @@
|
|||
|
||||
PROGRAM hello
|
||||
print*, 'Hello, World!'
|
||||
END
|
||||
|
6
tools/gcc/files/hello.m
Normal file
6
tools/gcc/files/hello.m
Normal file
|
@ -0,0 +1,6 @@
|
|||
#import <stdio.h>
|
||||
|
||||
int main( int argc, const char *argv[] ) {
|
||||
printf( "hello world\n" );
|
||||
return 0;
|
||||
}
|
148
tools/gcc/files/i386-dragonfly.h
Normal file
148
tools/gcc/files/i386-dragonfly.h
Normal file
|
@ -0,0 +1,148 @@
|
|||
/* $DragonFly: src/gnu/usr.bin/cc41/cc_prep/config/i386/dragonfly.h,v 1.1 2006/09/27 12:10:34 corecode Exp $ */
|
||||
|
||||
/* Definitions for Intel 386 running DragonFly with ELF format
|
||||
|
||||
Copyright (C) 1996, 2000, 2002 Free Software Foundation, Inc.
|
||||
Contributed by Eric Youngdale.
|
||||
Modified for stabs-in-ELF by H.J. Lu.
|
||||
Adapted from GNU/Linux version by John Polstra.
|
||||
Continued development by David O'Brien <obrien@freebsd.org>
|
||||
Adapted from the FreeBSD version.
|
||||
|
||||
Changes:
|
||||
- remove support for changing the dynamic linker
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GCC is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GCC; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
|
||||
#define TARGET_VERSION fprintf (stderr, " (i386 DragonFly/ELF)");
|
||||
|
||||
/* Override the default comment-starter of "/". */
|
||||
#undef ASM_COMMENT_START
|
||||
#define ASM_COMMENT_START "#"
|
||||
|
||||
#undef ASM_APP_ON
|
||||
#define ASM_APP_ON "#APP\n"
|
||||
|
||||
#undef ASM_APP_OFF
|
||||
#define ASM_APP_OFF "#NO_APP\n"
|
||||
|
||||
#undef DBX_REGISTER_NUMBER
|
||||
#define DBX_REGISTER_NUMBER(n) \
|
||||
(TARGET_64BIT ? dbx64_register_map[n] : svr4_dbx_register_map[n])
|
||||
|
||||
#undef NO_PROFILE_COUNTERS
|
||||
#define NO_PROFILE_COUNTERS 1
|
||||
|
||||
/* Tell final.c that we don't need a label passed to mcount. */
|
||||
|
||||
#undef MCOUNT_NAME
|
||||
#define MCOUNT_NAME ".mcount"
|
||||
|
||||
/* Make gcc agree with <machine/ansi.h>. */
|
||||
|
||||
#undef SIZE_TYPE
|
||||
#define SIZE_TYPE (TARGET_64BIT ? "long unsigned int" : "unsigned int")
|
||||
|
||||
#undef PTRDIFF_TYPE
|
||||
#define PTRDIFF_TYPE (TARGET_64BIT ? "long int" : "int")
|
||||
|
||||
#undef WCHAR_TYPE_SIZE
|
||||
#define WCHAR_TYPE_SIZE (TARGET_64BIT ? 32 : BITS_PER_WORD)
|
||||
|
||||
#undef SUBTARGET_EXTRA_SPECS /* i386.h bogusly defines it. */
|
||||
#define SUBTARGET_EXTRA_SPECS \
|
||||
{ "dfbsd_dynamic_linker", DFBSD_DYNAMIC_LINKER }
|
||||
|
||||
/* Provide a STARTFILE_SPEC appropriate for DragonFly. Here we add
|
||||
the magical crtbegin.o file (see crtstuff.c) which provides part
|
||||
of the support for getting C++ file-scope static object constructed
|
||||
before entering `main'. */
|
||||
|
||||
#undef STARTFILE_SPEC
|
||||
#define STARTFILE_SPEC \
|
||||
"%{!shared: \
|
||||
%{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} \
|
||||
%{!p:%{profile:gcrt1.o%s} \
|
||||
%{!profile:crt1.o%s}}}} \
|
||||
crti.o%s %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}"
|
||||
|
||||
/* Provide a ENDFILE_SPEC appropriate for DragonFly. Here we tack on
|
||||
the magical crtend.o file (see crtstuff.c) which provides part of
|
||||
the support for getting C++ file-scope static object constructed
|
||||
before entering `main', followed by a normal "finalizer" file,
|
||||
`crtn.o'. */
|
||||
|
||||
#undef ENDFILE_SPEC
|
||||
#define ENDFILE_SPEC \
|
||||
"%{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s"
|
||||
|
||||
/* Provide a LINK_SPEC appropriate for DragonFly. Here we provide support
|
||||
for the special GCC options -static and -shared, which allow us to
|
||||
link things in one of these three modes by applying the appropriate
|
||||
combinations of options at link-time. We like to support here for
|
||||
as many of the other GNU linker options as possible. But I don't
|
||||
have the time to search for those flags. I am sure how to add
|
||||
support for -soname shared_object_name. H.J.
|
||||
|
||||
I took out %{v:%{!V:-V}}. It is too much :-(. They can use
|
||||
-Wl,-V.
|
||||
|
||||
When the -shared link option is used a final link is not being
|
||||
done. */
|
||||
|
||||
#undef LINK_SPEC
|
||||
#define LINK_SPEC "\
|
||||
%{p:%nconsider using `-pg' instead of `-p' with gprof(1)} \
|
||||
%{v:-V} \
|
||||
%{assert*} %{R*} %{rpath*} %{defsym*} \
|
||||
%{shared:-Bshareable %{h*} %{soname*}} \
|
||||
%{!shared: \
|
||||
%{!static: \
|
||||
%{rdynamic:-export-dynamic} \
|
||||
%{!dynamic-linker:-dynamic-linker %(dfbsd_dynamic_linker) }} \
|
||||
%{static:-Bstatic}} \
|
||||
%{symbolic:-Bsymbolic}"
|
||||
|
||||
/* A C statement to output to the stdio stream FILE an assembler
|
||||
command to advance the location counter to a multiple of 1<<LOG
|
||||
bytes if it is within MAX_SKIP bytes.
|
||||
|
||||
This is used to align code labels according to Intel recommendations. */
|
||||
|
||||
#ifdef HAVE_GAS_MAX_SKIP_P2ALIGN
|
||||
#undef ASM_OUTPUT_MAX_SKIP_ALIGN
|
||||
#define ASM_OUTPUT_MAX_SKIP_ALIGN(FILE, LOG, MAX_SKIP) \
|
||||
if ((LOG) != 0) { \
|
||||
if ((MAX_SKIP) == 0) fprintf ((FILE), "\t.p2align %d\n", (LOG)); \
|
||||
else fprintf ((FILE), "\t.p2align %d,,%d\n", (LOG), (MAX_SKIP)); \
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Don't default to pcc-struct-return, we want to retain compatibility with
|
||||
older gcc versions AND pcc-struct-return is nonreentrant.
|
||||
(even though the SVR4 ABI for the i386 says that records and unions are
|
||||
returned in memory). */
|
||||
|
||||
#undef DEFAULT_PCC_STRUCT_RETURN
|
||||
#define DEFAULT_PCC_STRUCT_RETURN 0
|
||||
|
||||
/* DragonFly sets the rounding precision of the FPU to 53 bits. Let the
|
||||
compiler get the contents of <float.h> and std::numeric_limits correct. */
|
||||
#undef TARGET_96_ROUND_53_LONG_DOUBLE
|
||||
#define TARGET_96_ROUND_53_LONG_DOUBLE (!TARGET_64BIT)
|
54
tools/gcc/files/i386-dragonfly64.h
Normal file
54
tools/gcc/files/i386-dragonfly64.h
Normal file
|
@ -0,0 +1,54 @@
|
|||
/* $DragonFly: src/gnu/usr.bin/cc41/cc_prep/config/i386/dragonfly64.h,v 1.1 2007/01/15 17:53:16 corecode Exp $ */
|
||||
|
||||
/* Definitions for AMD x86-64 running DragonFly with ELF format
|
||||
Copyright (C) 2002 Free Software Foundation, Inc.
|
||||
Contributed by David O'Brien <obrien@FreeBSD.org>
|
||||
Adapted from the FreeBSD version.
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GCC is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GCC; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* $FreeBSD: src/contrib/gcc/config/i386/freebsd64.h,v 1.9 2004/07/28 04:44:23 kan Exp $ */
|
||||
|
||||
|
||||
#undef TARGET_VERSION
|
||||
#define TARGET_VERSION fprintf (stderr, " (x86-64 DragonFly/ELF)");
|
||||
|
||||
/* Tell final.c that we don't need a label passed to mcount. */
|
||||
|
||||
#define SUBTARGET_EXTRA_SPECS \
|
||||
{ "dfbsd_dynamic_linker", DFBSD_DYNAMIC_LINKER }
|
||||
|
||||
#undef MCOUNT_NAME
|
||||
#define MCOUNT_NAME ".mcount"
|
||||
|
||||
/* Provide a LINK_SPEC appropriate for the DragonFly/x86-64 ELF target.
|
||||
This is a copy of LINK_SPEC from <i386/dragonfly.h> tweaked for
|
||||
the x86-64 target.
|
||||
XXX We don't support two arch userland yet */
|
||||
|
||||
#undef LINK_SPEC
|
||||
#define LINK_SPEC "\
|
||||
%{v:-V} \
|
||||
%{assert*} %{R*} %{rpath*} %{defsym*} \
|
||||
%{shared:-Bshareable %{h*} %{soname*}} \
|
||||
%{!shared: \
|
||||
%{!static: \
|
||||
%{rdynamic:-export-dynamic} \
|
||||
%{!dynamic-linker:-dynamic-linker %(dfbsd_dynamic_linker) }} \
|
||||
%{static:-Bstatic}} \
|
||||
%{symbolic:-Bsymbolic}"
|
148
tools/gcc/files/i386-minix.h
Normal file
148
tools/gcc/files/i386-minix.h
Normal file
|
@ -0,0 +1,148 @@
|
|||
/* Definitions for Intel 386 running MINIX with ELF format
|
||||
Copyright (C) 1996, 2000, 2002, 2004 Free Software Foundation, Inc.
|
||||
Contributed by Eric Youngdale.
|
||||
Modified for stabs-in-ELF by H.J. Lu.
|
||||
Adapted from GNU/Linux version by John Polstra.
|
||||
Continued development by David O'Brien <obrien@freebsd.org>
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GCC is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GCC; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA. */
|
||||
|
||||
#undef MINIX_TARGET_CPU_CPP_BUILTINS
|
||||
#define MINIX_TARGET_CPU_CPP_BUILTINS() \
|
||||
do \
|
||||
{ \
|
||||
builtin_define_with_int_value ("_EM_WSIZE", 4); \
|
||||
builtin_define_with_int_value ("_EM_PSIZE", 4); \
|
||||
builtin_define_with_int_value ("_EM_SSIZE", 2); \
|
||||
builtin_define_with_int_value ("_EM_LSIZE", 4); \
|
||||
builtin_define_with_int_value ("_EM_FSIZE", 4); \
|
||||
builtin_define_with_int_value ("_EM_DSIZE", 8); \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
#define TARGET_VERSION fprintf (stderr, " (i386 MINIX/ELF)");
|
||||
|
||||
/* Override the default comment-starter of "/". */
|
||||
#undef ASM_COMMENT_START
|
||||
#define ASM_COMMENT_START "#"
|
||||
|
||||
#undef ASM_APP_ON
|
||||
#define ASM_APP_ON "#APP\n"
|
||||
|
||||
#undef ASM_APP_OFF
|
||||
#define ASM_APP_OFF "#NO_APP\n"
|
||||
|
||||
#undef DBX_REGISTER_NUMBER
|
||||
#define DBX_REGISTER_NUMBER(n) \
|
||||
(TARGET_64BIT ? dbx64_register_map[n] : svr4_dbx_register_map[n])
|
||||
|
||||
#undef NO_PROFILE_COUNTERS
|
||||
#define NO_PROFILE_COUNTERS 1
|
||||
|
||||
/* Tell final.c that we don't need a label passed to mcount. */
|
||||
|
||||
#undef MCOUNT_NAME
|
||||
#define MCOUNT_NAME ".mcount"
|
||||
|
||||
/* Make gcc agree with <machine/ansi.h>. */
|
||||
|
||||
#undef SIZE_TYPE
|
||||
#define SIZE_TYPE (TARGET_64BIT ? "long unsigned int" : "unsigned int")
|
||||
|
||||
#undef PTRDIFF_TYPE
|
||||
#define PTRDIFF_TYPE (TARGET_64BIT ? "long int" : "int")
|
||||
|
||||
#undef WCHAR_TYPE_SIZE
|
||||
#define WCHAR_TYPE_SIZE (TARGET_64BIT ? 32 : BITS_PER_WORD)
|
||||
|
||||
#undef SUBTARGET_EXTRA_SPECS /* i386.h bogusly defines it. */
|
||||
#define SUBTARGET_EXTRA_SPECS \
|
||||
{ "minix_dynamic_linker", MINIX_DYNAMIC_LINKER }
|
||||
|
||||
/* Provide a STARTFILE_SPEC appropriate for MINIX. Here we add
|
||||
the magical crtbegin.o file (see crtstuff.c) which provides part
|
||||
of the support for getting C++ file-scope static object constructed
|
||||
before entering `main'. */
|
||||
|
||||
#undef STARTFILE_SPEC
|
||||
#define STARTFILE_SPEC \
|
||||
"%{!shared: \
|
||||
%{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} \
|
||||
%{!p:%{profile:gcrt1.o%s} \
|
||||
%{!profile:crt1.o%s}}}} \
|
||||
crti.o%s %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}"
|
||||
|
||||
/* Provide a ENDFILE_SPEC appropriate for MINIX. Here we tack on
|
||||
the magical crtend.o file (see crtstuff.c) which provides part of
|
||||
the support for getting C++ file-scope static object constructed
|
||||
before entering `main', followed by a normal "finalizer" file,
|
||||
`crtn.o'. */
|
||||
|
||||
#undef ENDFILE_SPEC
|
||||
#define ENDFILE_SPEC \
|
||||
"%{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s"
|
||||
|
||||
/* Provide a LINK_SPEC appropriate for MINIX. Here we provide support
|
||||
for the special GCC options -static and -shared, which allow us to
|
||||
link things in one of these three modes by applying the appropriate
|
||||
combinations of options at link-time. We like to support here for
|
||||
as many of the other GNU linker options as possible. But I don't
|
||||
have the time to search for those flags. I am sure how to add
|
||||
support for -soname shared_object_name. H.J.
|
||||
|
||||
I took out %{v:%{!V:-V}}. It is too much :-(. They can use
|
||||
-Wl,-V.
|
||||
|
||||
When the -shared link option is used a final link is not being
|
||||
done. */
|
||||
|
||||
#undef LINK_SPEC
|
||||
#define LINK_SPEC "\
|
||||
%{p:%nconsider using `-pg' instead of `-p' with gprof(1)} \
|
||||
%{v:-V} \
|
||||
%{assert*} %{R*} %{rpath*} %{defsym*} \
|
||||
%{shared:-Bshareable %{h*} %{soname*}} \
|
||||
%{!shared: \
|
||||
%{!static: \
|
||||
%{rdynamic:-export-dynamic} \
|
||||
%{!dynamic-linker:-dynamic-linker %(minix_dynamic_linker) }} \
|
||||
%{static:-Bstatic}} \
|
||||
%{symbolic:-Bsymbolic}"
|
||||
|
||||
/* A C statement to output to the stdio stream FILE an assembler
|
||||
command to advance the location counter to a multiple of 1<<LOG
|
||||
bytes if it is within MAX_SKIP bytes.
|
||||
|
||||
This is used to align code labels according to Intel recommendations. */
|
||||
|
||||
#ifdef HAVE_GAS_MAX_SKIP_P2ALIGN
|
||||
#undef ASM_OUTPUT_MAX_SKIP_ALIGN
|
||||
#define ASM_OUTPUT_MAX_SKIP_ALIGN(FILE, LOG, MAX_SKIP) \
|
||||
if ((LOG) != 0) { \
|
||||
if ((MAX_SKIP) == 0) fprintf ((FILE), "\t.p2align %d\n", (LOG)); \
|
||||
else fprintf ((FILE), "\t.p2align %d,,%d\n", (LOG), (MAX_SKIP)); \
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Don't default to pcc-struct-return, we want to retain compatibility with
|
||||
older gcc versions AND pcc-struct-return is nonreentrant.
|
||||
(even though the SVR4 ABI for the i386 says that records and unions are
|
||||
returned in memory). */
|
||||
|
||||
#undef DEFAULT_PCC_STRUCT_RETURN
|
||||
#define DEFAULT_PCC_STRUCT_RETURN 0
|
101
tools/gcc/files/minix-spec.h
Normal file
101
tools/gcc/files/minix-spec.h
Normal file
|
@ -0,0 +1,101 @@
|
|||
/* Base configuration file for all FreeBSD targets.
|
||||
Copyright (C) 1999, 2000, 2001, 2004, 2005 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GCC is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GCC; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA. */
|
||||
|
||||
/* Common MINIX configuration.
|
||||
All MINIX architectures should include this file, which will specify
|
||||
their commonalities.
|
||||
*/
|
||||
|
||||
/* In case we need to know. */
|
||||
#define USING_CONFIG_MINIX_SPEC 1
|
||||
|
||||
/* This defines which switch letters take arguments. On FreeBSD, most of
|
||||
the normal cases (defined in gcc.c) apply, and we also have -h* and
|
||||
-z* options (for the linker) (coming from SVR4).
|
||||
We also have -R (alias --rpath), no -z, --soname (-h), --assert etc. */
|
||||
|
||||
#define MINIX_SWITCH_TAKES_ARG(CHAR) \
|
||||
(DEFAULT_SWITCH_TAKES_ARG (CHAR) \
|
||||
|| (CHAR) == 'h' \
|
||||
|| (CHAR) == 'z' /* ignored by ld */ \
|
||||
|| (CHAR) == 'R')
|
||||
|
||||
/* This defines which multi-letter switches take arguments. */
|
||||
|
||||
#define MINIX_WORD_SWITCH_TAKES_ARG(STR) \
|
||||
(DEFAULT_WORD_SWITCH_TAKES_ARG (STR) \
|
||||
|| !strcmp ((STR), "rpath") || !strcmp ((STR), "rpath-link") \
|
||||
|| !strcmp ((STR), "soname") || !strcmp ((STR), "defsym") \
|
||||
|| !strcmp ((STR), "assert") || !strcmp ((STR), "dynamic-linker"))
|
||||
|
||||
#define MINIX_TARGET_OS_CPP_BUILTINS() \
|
||||
do \
|
||||
{ \
|
||||
builtin_define ("__minix"); \
|
||||
builtin_define ("__i386"); \
|
||||
MINIX_TARGET_CPU_CPP_BUILTINS(); \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
/* Define the default MINIX-specific per-CPU hook code. */
|
||||
#define MINIX_TARGET_CPU_CPP_BUILTINS() do {} while (0)
|
||||
|
||||
/* Provide a CPP_SPEC appropriate for MINIX. We just deal with the GCC
|
||||
option `-posix', and PIC issues. */
|
||||
|
||||
#define MINIX_CPP_SPEC " \
|
||||
%(cpp_cpu) \
|
||||
%(cpp_arch) \
|
||||
%{posix:-D_POSIX_SOURCE}"
|
||||
|
||||
/* Provide a STARTFILE_SPEC appropriate for MINIX. Here we add
|
||||
the magical crtbegin.o file (see crtstuff.c) which provides part
|
||||
of the support for getting C++ file-scope static object constructed
|
||||
before entering `main'. */
|
||||
|
||||
#define MINIX_STARTFILE_SPEC \
|
||||
"%{!shared: \
|
||||
%{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} \
|
||||
%{!p:%{profile:gcrt1.o%s} \
|
||||
%{!profile:crt1.o%s}}}} \
|
||||
crti.o%s %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}"
|
||||
|
||||
/* Provide a ENDFILE_SPEC appropriate for MINIX. Here we tack on
|
||||
the magical crtend.o file (see crtstuff.c) which provides part of
|
||||
the support for getting C++ file-scope static object constructed
|
||||
before entering `main', followed by a normal "finalizer" file,
|
||||
`crtn.o'. */
|
||||
|
||||
#define MINIX_ENDFILE_SPEC \
|
||||
"%{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s"
|
||||
|
||||
/* Provide a LIB_SPEC appropriate for MINIX. Just select the appropriate
|
||||
libc, depending on whether we're doing profiling or need threads support.
|
||||
(similar to the default, except no -lg, and no -p). */
|
||||
|
||||
#define MINIX_LIB_SPEC " \
|
||||
%{pthread: %eThe -pthread option is only supported on FreeBSD when gcc \
|
||||
is built with the --enable-threads configure-time option.} \
|
||||
%{!shared: \
|
||||
%{!pg: -lc} \
|
||||
%{pg: -lc_p} \
|
||||
}"
|
||||
|
||||
#define MINIX_DYNAMIC_LINKER "/libexec/ld-elf.so.1"
|
71
tools/gcc/files/minix.h
Normal file
71
tools/gcc/files/minix.h
Normal file
|
@ -0,0 +1,71 @@
|
|||
/* Base configuration file for all FreeBSD targets.
|
||||
Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GCC is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GCC; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA. */
|
||||
|
||||
/* Common MINIX configuration.
|
||||
All FreeBSD architectures should include this file, which will specify
|
||||
their commonalities.
|
||||
*/
|
||||
|
||||
/* In case we need to know. */
|
||||
#define USING_CONFIG_MINIX 1
|
||||
|
||||
/* This defines which switch letters take arguments. On MINIX, most of
|
||||
the normal cases (defined in gcc.c) apply, and we also have -h* and
|
||||
-z* options (for the linker) (coming from SVR4).
|
||||
We also have -R (alias --rpath), no -z, --soname (-h), --assert etc. */
|
||||
|
||||
#undef SWITCH_TAKES_ARG
|
||||
#define SWITCH_TAKES_ARG(CHAR) (MINIX_SWITCH_TAKES_ARG(CHAR))
|
||||
|
||||
#undef WORD_SWITCH_TAKES_ARG
|
||||
#define WORD_SWITCH_TAKES_ARG(STR) (MINIX_WORD_SWITCH_TAKES_ARG(STR))
|
||||
|
||||
#undef TARGET_OS_CPP_BUILTINS
|
||||
#define TARGET_OS_CPP_BUILTINS() MINIX_TARGET_OS_CPP_BUILTINS()
|
||||
|
||||
#undef CPP_SPEC
|
||||
#define CPP_SPEC MINIX_CPP_SPEC
|
||||
|
||||
#undef STARTFILE_SPEC
|
||||
#define STARTFILE_SPEC MINIX_STARTFILE_SPEC
|
||||
|
||||
#undef ENDFILE_SPEC
|
||||
#define ENDFILE_SPEC MINIX_ENDFILE_SPEC
|
||||
|
||||
#undef LIB_SPEC
|
||||
#define LIB_SPEC MINIX_LIB_SPEC
|
||||
|
||||
|
||||
/************************[ Target stuff ]***********************************/
|
||||
|
||||
/* All MINIX Architectures support the ELF object file format. */
|
||||
#undef OBJECT_FORMAT_ELF
|
||||
#define OBJECT_FORMAT_ELF
|
||||
|
||||
/* Don't assume anything about the header files. */
|
||||
#undef NO_IMPLICIT_EXTERN_C
|
||||
#define NO_IMPLICIT_EXTERN_C 1
|
||||
|
||||
/* Code generation parameters. */
|
||||
|
||||
/* Use periods rather than dollar signs in special g++ assembler names.
|
||||
This ensures the configuration knows our system correctly so we can link
|
||||
with libraries compiled with the native cc. */
|
||||
#undef NO_DOLLAR_IN_LABEL
|
5
tools/gcc/files/t-minix
Normal file
5
tools/gcc/files/t-minix
Normal file
|
@ -0,0 +1,5 @@
|
|||
# Compile crtbeginS.o and crtendS.o with pic.
|
||||
CRTSTUFF_T_CFLAGS_S = -fPIC
|
||||
|
||||
# Compile libgcc.a with pic.
|
||||
TARGET_LIBGCC2_CFLAGS += -fPIC
|
64
tools/gcc/files/values.c
Normal file
64
tools/gcc/files/values.c
Normal file
|
@ -0,0 +1,64 @@
|
|||
#if 0 /* $NetBSD$ */
|
||||
#
|
||||
# This is Solaris x86 specific GCC run-time environment patch, which
|
||||
# makes it possible to reliably deploy .init snippets. Trouble is that
|
||||
# Solaris linker erroneously pads .init segment with zeros [instead of
|
||||
# nops], which is bound to SEGV early upon program start-up. This bug
|
||||
# was recognized by GCC team [it is mentioned in source code], but
|
||||
# workaround apparently and obviously erroneously slipped away in some
|
||||
# newer GCC release. This patch compensates for this mishap by dropping
|
||||
# modified values-X*.o into GCC installation tree. Object modules in
|
||||
# question are normally provided by Sun and linked prior crtbegin.o.
|
||||
# Modified versions are additionally crafted with custom .init segment,
|
||||
# which does some magic:-)
|
||||
# <appro@fy.chalmers.se>
|
||||
set -e
|
||||
gcc=gcc
|
||||
if [[ "x$1" = x*gcc ]]; then
|
||||
gcc=$1; shift
|
||||
fi
|
||||
gcc_dir=`${gcc} "$@" -print-libgcc-file-name`
|
||||
gcc_dir=${gcc_dir%/*} #*/
|
||||
set -x
|
||||
${gcc} "$@" -c -o $gcc_dir/values-Xa.o -DXa $0
|
||||
${gcc} "$@" -c -o $gcc_dir/values-Xc.o -DXc $0
|
||||
${gcc} "$@" -c -o $gcc_dir/values-Xt.o -DXt $0
|
||||
exit
|
||||
#endif
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#if defined(Xa)
|
||||
const enum version _lib_version = ansi_1;
|
||||
#elif defined(Xc)
|
||||
const enum version _lib_version = strict_ansi;
|
||||
#elif defined(Xt)
|
||||
const enum version _lib_version = c_issue_4;
|
||||
#else
|
||||
#error "compile by issuing 'ksh -f values.c [gcc] [-m64]'"
|
||||
#endif
|
||||
|
||||
#if defined(__x86_64__)
|
||||
asm("\n"
|
||||
".section .init\n"
|
||||
".align 1\n"
|
||||
" leaq 1f(%rip),%rax\n"
|
||||
"1: cmpl $0,2f-1b(%rax)\n"
|
||||
" jne 2f\n"
|
||||
" jmp 2f+5\n"
|
||||
" .skip 9\n" /* pad up to 0x1b bytes */
|
||||
"2:\n"
|
||||
);
|
||||
#else
|
||||
asm("\n"
|
||||
".section .init\n"
|
||||
".align 1\n"
|
||||
" call 1f\n"
|
||||
"1: popl %eax\n"
|
||||
" cmpl $0,2f-1b(%eax)\n"
|
||||
" jne 2f\n"
|
||||
" jmp 2f+5\n"
|
||||
" .skip 10\n" /* pad up to 0x1b bytes */
|
||||
"2:\n"
|
||||
);
|
||||
#endif
|
732
tools/gcc/mknative-gcc
Executable file
732
tools/gcc/mknative-gcc
Executable file
|
@ -0,0 +1,732 @@
|
|||
#!/bin/sh
|
||||
# $NetBSD: mknative-gcc,v 1.66 2012/01/10 12:27:54 skrll Exp $
|
||||
#
|
||||
# Shell script for generating all the constants needed for a native
|
||||
# platform build of src/gnu/dist/gcc.
|
||||
#
|
||||
|
||||
# initialise
|
||||
|
||||
_TMPDIR=$2
|
||||
_TOP=$3
|
||||
_PLATFORM=$4
|
||||
_DESTDIR=$5
|
||||
_ABI=$6
|
||||
_VPATH=`grep VPATH ${_TMPDIR}/Makefile | sed 's,^.*=[ ]*,,'`
|
||||
_GNU_DIST=`cd ${_VPATH}; pwd`
|
||||
|
||||
if [ -z "$_DESTDIR" ]; then
|
||||
echo "\$_DESTDIR is empty" 2>&1
|
||||
exit 1
|
||||
fi
|
||||
|
||||
. $_TOP/tools/gcc/mknative.common
|
||||
|
||||
# default to GCC 4.1 for now
|
||||
_OUTDIR="$_TOP/gnu"
|
||||
_OUTDIRBASE="gnu"
|
||||
|
||||
##### gnu/lib/crtstuff #####
|
||||
|
||||
get_crtstuff () {
|
||||
_subdir="$1"
|
||||
mkdir -p $_OUTDIR/lib/$_subdir/arch
|
||||
|
||||
getvars gcc/Makefile \
|
||||
INCLUDES CRTSTUFF_CFLAGS CRTSTUFF_T_CFLAGS \
|
||||
tm_defines xm_file xm_defines \
|
||||
| sed "s,-I$_DESTDIR/usr/include,,g" \
|
||||
| write_mk $_OUTDIRBASE/lib/$_subdir/arch/$MACHINE_ARCH.mk
|
||||
}
|
||||
|
||||
##### gnu/lib/libg2c #####
|
||||
|
||||
get_libg2c () {
|
||||
mkdir -p $_OUTDIR/lib/libg2c3/arch/$MACHINE_ARCH
|
||||
|
||||
write_c $_OUTDIRBASE/lib/libg2c3/arch/$MACHINE_ARCH/config.h <$_TMPDIR/$_PLATFORM/libf2c/libU77/config.h
|
||||
write_c $_OUTDIRBASE/lib/libg2c3/arch/$MACHINE_ARCH/g2c.h <$_TMPDIR/$_PLATFORM/libf2c/g2c.h
|
||||
|
||||
{
|
||||
getvars $_PLATFORM/libf2c/Makefile \
|
||||
F2CEXT
|
||||
getvars $_PLATFORM/libf2c/libF77/Makefile \
|
||||
ALL_CFLAGS OBJS
|
||||
getvars $_PLATFORM/libf2c/libI77/Makefile \
|
||||
ALL_CFLAGS OBJS | sed 's,=,+=,'
|
||||
getvars $_PLATFORM/libf2c/libU77/Makefile \
|
||||
ALL_CFLAGS OBJS | sed 's,=,+=,'
|
||||
} | write_mk $_OUTDIRBASE/lib/libg2c3/arch/$MACHINE_ARCH/defs.mk
|
||||
}
|
||||
|
||||
##### gnu/lib/libgcc #####
|
||||
|
||||
get_libgcc_list_funcs_asm () {
|
||||
{
|
||||
getvars gcc/Makefile LIB1ASMFUNCS | {
|
||||
# print newline separated list
|
||||
sed -e '
|
||||
s,^.*=,,
|
||||
s, *$,,
|
||||
s, *, ,g
|
||||
s, ,\
|
||||
,g'
|
||||
}
|
||||
getvars gcc/Makefile LIB2FUNCS_EXTRA | {
|
||||
# print newline separated list
|
||||
sed -e '
|
||||
s,^.*=,,
|
||||
s, *$,,
|
||||
s, *, ,g
|
||||
s, ,\
|
||||
,g' | \
|
||||
sed -ne '
|
||||
/\.S$/ { s,^.*/,,; s,\.S$,,; p; }
|
||||
/\.asm$/ { s,^.*/,,; s,\.asm$,,; p; }
|
||||
'
|
||||
}
|
||||
} | {
|
||||
# print foo and foo_s
|
||||
sed -ne '
|
||||
/./ {
|
||||
p
|
||||
s,$,_s,
|
||||
p
|
||||
}
|
||||
'
|
||||
} | sort
|
||||
}
|
||||
|
||||
get_libgcc_list_funcs_lib () {
|
||||
local _lib=$1
|
||||
local _lib_prefix=${_lib%.*}
|
||||
local _lib_suffix=${_lib#*.}
|
||||
local _abi=${2:-'\.'}
|
||||
|
||||
cat build/gcc/libgcc.mk | \
|
||||
grep '/'${_abi}'/' | \
|
||||
sed -ne '
|
||||
/^'${_abi}'\/'${_lib_prefix}'\.'${_lib_suffix}': .*\.o$/ {
|
||||
s,^.*/,,
|
||||
s,\.o$,,
|
||||
p
|
||||
}
|
||||
' | sort
|
||||
}
|
||||
|
||||
get_libgcc_list_objs_libs () {
|
||||
local _abi=${1:-'\.'}
|
||||
|
||||
cat build/gcc/libgcc.mk | \
|
||||
grep '/'${_abi}'/' | \
|
||||
egrep '^'${_abi}'\/(libgcc_s\.so|libgcc\.a|libgcc_eh\.a|libgcov\.a): (libgcc_s|libgcc|libgcc_eh|libgcov)\/.*\.o$' | \
|
||||
sed -e '
|
||||
s,^'${_abi}'\/,,
|
||||
s,: .*/, ,
|
||||
s,^\(.*\) \(.*\)$,\2 \1,
|
||||
' | sort
|
||||
}
|
||||
|
||||
get_libgcc_list_objs_srcs () {
|
||||
local _abi=${1:-'\.'} # XXX not used
|
||||
|
||||
if [ -e $_TOP/${libgcc_db_funcs}.S ]; then
|
||||
cut -f1 $_TOP/${libgcc_db_objs_libs} | sed -e 's,\.o$,,' | \
|
||||
comm -23 /dev/stdin $_TOP/${libgcc_db_funcs}.S | \
|
||||
sed -e 's,\(.*\),\1.o \1.c,'
|
||||
|
||||
cut -f1 $_TOP/${libgcc_db_objs_libs} | sed -e 's,\.o$,,' | \
|
||||
comm -12 /dev/stdin $_TOP/${libgcc_db_funcs}.S | \
|
||||
sed -e 's,\(.*\),\1.o \1.S,'
|
||||
else
|
||||
cut -f1 $_TOP/${libgcc_db_objs_libs} | sed -e 's,\.o$,,' | \
|
||||
sed -e 's,\(.*\),\1.o \1.c,'
|
||||
fi | sort
|
||||
}
|
||||
|
||||
get_libgcc_list_objs_tmplsrcs () {
|
||||
local _abi=${1:-'\.'}
|
||||
|
||||
grep 'GCC_FOR_TARGET.*\.o$' build/gcc/libgcc.mk | \
|
||||
grep '/'${_abi}'/' | \
|
||||
sed -ne '
|
||||
s,^.* -c \([^ ]*\).* -o .*/\([^ ]*\.o\)$,\2 \1,
|
||||
# basename
|
||||
/\$/ { s,\$.*/,,; }
|
||||
/\// { s,\/.*/,,; }
|
||||
p
|
||||
' | sort -u
|
||||
}
|
||||
|
||||
get_libgcc_list_objs_xflags () {
|
||||
local _flags=$1
|
||||
local _abi=${2:-'\.'}
|
||||
|
||||
grep 'GCC_FOR_TARGET.*\.o$' build/gcc/libgcc.mk | \
|
||||
grep '/'${_abi}'/' | \
|
||||
sed -n '
|
||||
x
|
||||
:loop
|
||||
g
|
||||
s/^\(.*\) \(-['${_flags}'][^ ][^ ]*\) \(.*\) \(-o .*\)\/\(.*\.o\)$/\5 \2/p
|
||||
g
|
||||
s/^\(.*\) \(-['${_flags}'][^ ][^ ]*\) \(.*\) \(-o .*\)\/\(.*\.o\)$/\1 \3 \4\/\5/
|
||||
h
|
||||
t loop
|
||||
' | sort
|
||||
}
|
||||
|
||||
get_libgcc_list_objs_cppflags () {
|
||||
get_libgcc_list_objs_xflags D $1
|
||||
}
|
||||
|
||||
get_libgcc_list_objs_copts () {
|
||||
get_libgcc_list_objs_xflags fmx $1
|
||||
}
|
||||
|
||||
get_libgcc_list_tmplsrcs () {
|
||||
local _lib=$1
|
||||
local _abi=$2 # XXX not used
|
||||
local _tmplallsrcs=$( mktemp /tmp/mknative-gcc._tmplallsrcs.XXXXXX )
|
||||
|
||||
touch $_TOP/${libgcc_db_tmplsrcs}.tmplsrcs.${_lib%.*}
|
||||
touch $_TOP/${libgcc_db_tmplsrcs}.tmplfpsrcs.${_lib%.*}
|
||||
touch $_TOP/${libgcc_db_tmplsrcs}.tmplasmsrcs.${_lib%.*}
|
||||
|
||||
# all files
|
||||
local _lib_prefix=${_lib%.*}
|
||||
local _lib_suffix=${_lib#*.}
|
||||
join $_TOP/$libgcc_db_objs_libs $_TOP/$libgcc_db_objs_tmplsrcs | \
|
||||
grep ${_lib_prefix}'\.'${_lib_suffix} | cut -d' ' -f 3 | sort -u > \
|
||||
$_tmplallsrcs
|
||||
|
||||
# TMPLFPSRCS = [fdp]p-bit.c
|
||||
grep '[fdt]p-bit\.c' <$_tmplallsrcs | sort -u | \
|
||||
writefile ${libgcc_db_tmplsrcs}.tmplfpsrcs.${_lib%.*}
|
||||
|
||||
# TMPLASMSRCS = $(LIB1ASMSRC)
|
||||
grep '\$(LIB1ASMSRC)' <$_tmplallsrcs | sort -u | \
|
||||
writefile ${libgcc_db_tmplsrcs}.tmplasmsrcs.${_lib%.*}
|
||||
|
||||
# TMPLSRCS is anything else; exclude TMPLFPSRCS and TMPLASMSRCS
|
||||
cat $_tmplallsrcs | \
|
||||
comm -23 /dev/stdin $_TOP/${libgcc_db_tmplsrcs}.tmplfpsrcs.${_lib%.*} | \
|
||||
comm -23 /dev/stdin $_TOP/${libgcc_db_tmplsrcs}.tmplasmsrcs.${_lib%.*} | \
|
||||
writefile ${libgcc_db_tmplsrcs}.tmplsrcs.${_lib%.*}
|
||||
|
||||
rm -f $_tmplallsrcs
|
||||
}
|
||||
|
||||
get_libgcc_new_analyze () {
|
||||
local _abi=$1
|
||||
|
||||
mkdir -p $_TOP/${_machine_arch_subdir}
|
||||
|
||||
touch $_TOP/${libgcc_db_funcs}.S
|
||||
get_libgcc_list_funcs_asm | \
|
||||
writefile ${libgcc_db_funcs}.S
|
||||
|
||||
for _lib in libgcc_s.so libgcc.a libgcc_eh.a libgcov.a; do
|
||||
touch $_TOP/${libgcc_db_funcs}.${_lib%.*}
|
||||
get_libgcc_list_funcs_lib $_lib $_abi | \
|
||||
writefile ${libgcc_db_funcs}.${_lib%.*}
|
||||
done
|
||||
|
||||
get_libgcc_list_objs_libs $_abi | writefile ${libgcc_db_objs_libs}
|
||||
get_libgcc_list_objs_srcs $_abi | writefile ${libgcc_db_objs_srcs}
|
||||
get_libgcc_list_objs_tmplsrcs $_abi | writefile ${libgcc_db_objs_tmplsrcs}
|
||||
get_libgcc_list_objs_cppflags $_abi | writefile ${libgcc_db_objs_cppflags}
|
||||
get_libgcc_list_objs_copts $_abi | writefile ${libgcc_db_objs_copts}
|
||||
|
||||
for _lib in libgcc_s.so libgcc.a libgcc_eh.a libgcov.a; do
|
||||
get_libgcc_list_tmplsrcs $_lib $_abi
|
||||
done
|
||||
}
|
||||
|
||||
#####
|
||||
|
||||
get_libgcc_gen_tmplsrcs_tmplsrcs () {
|
||||
local _lib=$1
|
||||
|
||||
printf '\n'
|
||||
printf 'TMPLSRCS.%s = \\\n' $_lib
|
||||
sed -e 's,^, ,; s,$, \\,' $_TOP/${libgcc_db_tmplsrcs}.tmplsrcs.${_lib%.*}
|
||||
}
|
||||
|
||||
get_libgcc_gen_tmplsrcs_tmplfpsrcs () {
|
||||
local _lib=$1
|
||||
|
||||
printf '\n'
|
||||
printf 'TMPLFPSRCS.%s = \\\n' $_lib
|
||||
sed -e 's,^, ,; s,$, \\,' $_TOP/${libgcc_db_tmplsrcs}.tmplfpsrcs.${_lib%.*}
|
||||
}
|
||||
|
||||
get_libgcc_gen_tmplsrcs_tmplasmsrcs () {
|
||||
local _lib=$1
|
||||
|
||||
printf '\n'
|
||||
printf 'TMPLASMSRCS.%s = \\\n' $_lib
|
||||
sed -e 's,^, ,; s,$, \\,' $_TOP/${libgcc_db_tmplsrcs}.tmplasmsrcs.${_lib%.*} | \
|
||||
sed -e 's,LIB1ASMSRC,G_&,'
|
||||
}
|
||||
|
||||
get_libgcc_gen_srcs () {
|
||||
local _lib=$1
|
||||
|
||||
printf '\n'
|
||||
printf 'SRCS.%s = \\\n' $_lib
|
||||
if [ -e $_TOP/${libgcc_db_funcs}.S ]; then
|
||||
comm -23 $_TOP/${libgcc_db_funcs}.${_lib%.*} $_TOP/${libgcc_db_funcs}.S | \
|
||||
sed -e 's,$,.c,; s,^,tmp_,'
|
||||
comm -12 $_TOP/${libgcc_db_funcs}.${_lib%.*} $_TOP/${libgcc_db_funcs}.S | \
|
||||
sed -e 's,$,.S,; s,^,tmp_,'
|
||||
else
|
||||
cat $_TOP/${libgcc_db_funcs}.${_lib%.*} | \
|
||||
sed -e 's,$,.c,; s,^,tmp_,'
|
||||
fi | sort | \
|
||||
sed -e 's,^, ,; s,$, \\,'
|
||||
}
|
||||
|
||||
_lookup_objs () {
|
||||
local _obj=$1; local _key=$2
|
||||
|
||||
eval grep \^$_obj\\\ \$_TOP/\${libgcc_db_objs_${_key}} | cut -f2
|
||||
}
|
||||
|
||||
get_libgcc_gen_srcs_tmplsrcs () {
|
||||
cut -f1 $_TOP/${libgcc_db_objs_libs} | \
|
||||
while read _obj; do
|
||||
printf 'SRCS.tmp_%s=%s\n' \
|
||||
"$( _lookup_objs $_obj srcs )" \
|
||||
"$( _lookup_objs $_obj tmplsrcs )"
|
||||
done | \
|
||||
sed -e 's,\$(\(.*\)),${G_\1},'
|
||||
}
|
||||
|
||||
get_libgcc_gen_srcs_cppflags () {
|
||||
cut -f1 $_TOP/${libgcc_db_objs_libs} | \
|
||||
while read _obj; do
|
||||
printf '_CPPFLAGS.tmp_%s=%s\n' \
|
||||
"$( _lookup_objs $_obj srcs )" \
|
||||
"$( _lookup_objs $_obj cppflags | xargs )"
|
||||
done
|
||||
}
|
||||
|
||||
get_libgcc_gen_srcs_copts () {
|
||||
cut -f1 $_TOP/${libgcc_db_objs_libs} | \
|
||||
while read _obj; do
|
||||
printf 'COPTS.tmp_%s=%s\n' \
|
||||
"$( _lookup_objs $_obj srcs )" \
|
||||
"$( _lookup_objs $_obj copts | xargs )"
|
||||
done
|
||||
}
|
||||
|
||||
get_libgcc_new_generate () {
|
||||
local _abi=$1
|
||||
|
||||
for _lib in libgcc_s.so libgcc.a libgcc_eh.a libgcov.a; do
|
||||
for _tmpl in tmplsrcs tmplfpsrcs tmplasmsrcs; do
|
||||
eval get_libgcc_gen_tmplsrcs_${_tmpl} $_lib | \
|
||||
write_mk ${libgcc_libs_mk}.${_lib%.*}.tmplsrcs.${_tmpl}.mk
|
||||
done
|
||||
|
||||
get_libgcc_gen_srcs $_lib | \
|
||||
write_mk ${libgcc_libs_mk}.${_lib%.*}.srcs.mk
|
||||
done
|
||||
|
||||
for _arg in tmplsrcs cppflags copts; do
|
||||
eval get_libgcc_gen_srcs_${_arg} | \
|
||||
eval writefile \$libgcc_srcs_mk_${_arg}
|
||||
done
|
||||
}
|
||||
|
||||
#####
|
||||
|
||||
get_libgcc_new () {
|
||||
_subdir="$1"
|
||||
_abi="$2"
|
||||
|
||||
# List of generated files.
|
||||
|
||||
_machine_arch_subdir=$_OUTDIRBASE/lib/lib$_subdir/arch${_archsubdir}/$MACHINE_ARCH/$_abi
|
||||
|
||||
libgcc_db_funcs=${_machine_arch_subdir}/funcs
|
||||
libgcc_db_tmplsrcs=${_machine_arch_subdir}/tmplsrcs
|
||||
libgcc_db_objs_libs=${_machine_arch_subdir}/objs.libs
|
||||
libgcc_db_objs_srcs=${_machine_arch_subdir}/objs.srcs
|
||||
libgcc_db_objs_tmplsrcs=${_machine_arch_subdir}/objs.tmplsrcs
|
||||
libgcc_db_objs_cppflags=${_machine_arch_subdir}/objs.cppflags
|
||||
libgcc_db_objs_copts=${_machine_arch_subdir}/objs.copts
|
||||
|
||||
get_libgcc_new_analyze $_abi
|
||||
|
||||
libgcc_libs_mk=${_machine_arch_subdir}/libs
|
||||
libgcc_srcs_mk=${_machine_arch_subdir}/srcs.mk
|
||||
libgcc_srcs_mk_tmplsrcs=${_machine_arch_subdir}/srcs.tmplsrcs.mk
|
||||
libgcc_srcs_mk_cppflags=${_machine_arch_subdir}/srcs.cppflags.mk
|
||||
libgcc_srcs_mk_copts=${_machine_arch_subdir}/srcs.copts.mk
|
||||
|
||||
get_libgcc_new_generate $_abi
|
||||
}
|
||||
|
||||
get_libgcc () {
|
||||
_subdir="$1"
|
||||
mkdir -p $_OUTDIR/lib/lib$_subdir/arch
|
||||
|
||||
case "$_subdir" in
|
||||
gcc4|gcc)
|
||||
_extravars="COLLECT2 UNWIND_H xm_include_list"
|
||||
_archsubdir=""
|
||||
;;
|
||||
esac
|
||||
|
||||
# DPBIT, FPBIT only used on mn10[23]00, we don't need them.
|
||||
# XXX we should probably grab everything Just In Case for
|
||||
# the future.
|
||||
{
|
||||
getvars gcc/Makefile \
|
||||
INCLUDES LIB2ADD LIB2ADDEH LIB2ADD_ST \
|
||||
LIB1ASMFUNCS LIB1ASMSRC \
|
||||
LIB2_DIVMOD_FUNCS LIB2FUNCS_ST \
|
||||
LIB2FUNCS_EXTRA \
|
||||
LIBGCC2_CFLAGS \
|
||||
SHLIB_MKMAP SHLIB_MKMAP_OPTS \
|
||||
SHLIB_MAPFILES SHLIB_NM_FLAGS \
|
||||
EXTRA_HEADERS xm_defines \
|
||||
tm_defines ${_extravars}
|
||||
} | sed "s,-I$_DESTDIR/usr/include,,g" \
|
||||
| write_mk $_OUTDIRBASE/lib/lib$_subdir/arch${_archsubdir}/$MACHINE_ARCH.mk
|
||||
|
||||
# Generate new style files.
|
||||
if [ -n "${MKNATIVE_LIBGCC_NEW}" ]; then
|
||||
get_libgcc_new $_subdir $_ABI
|
||||
fi
|
||||
}
|
||||
|
||||
##### gnu/lib/libgcov #####
|
||||
|
||||
get_libgcov () {
|
||||
_subdir="$1"
|
||||
|
||||
mkdir -p $_OUTDIR/lib/lib$_subdir/libgcov/arch/$MACHINE_ARCH
|
||||
|
||||
{
|
||||
getvars gcc/Makefile \
|
||||
LIBGCOV
|
||||
} | write_mk $_OUTDIRBASE/lib/lib$_subdir/libgcov/arch/$MACHINE_ARCH/defs.mk
|
||||
|
||||
write_c $_OUTDIRBASE/lib/lib$_subdir/libgcov/arch/$MACHINE_ARCH/gcov-iov.h \
|
||||
<$_TMPDIR/gcc/gcov-iov.h
|
||||
|
||||
}
|
||||
|
||||
##### gnu/usr.bin/gcc[34]/libiberty #####
|
||||
|
||||
get_gcc_libiberty () {
|
||||
_subdir="$1"
|
||||
case "$_subdir" in
|
||||
gcc4)
|
||||
_libibertydir="usr.bin/$_subdir/libiberty"
|
||||
;;
|
||||
gcc)
|
||||
_libibertydir="lib/libiberty"
|
||||
;;
|
||||
esac
|
||||
mkdir -p $_OUTDIR/$_libibertydir/arch/$MACHINE_ARCH
|
||||
|
||||
getvars libiberty/Makefile \
|
||||
ALLOCA EXTRA_OFILES LIBOBJS REQUIRED_OFILES \
|
||||
| write_mk $_OUTDIRBASE/$_libibertydir/defs.mk
|
||||
|
||||
write_c $_OUTDIRBASE/$_libibertydir/arch/$MACHINE_ARCH/config.h \
|
||||
<$_TMPDIR/libiberty/config.h
|
||||
}
|
||||
|
||||
##### lib/libdecnumber #####
|
||||
|
||||
get_libdecnumber () {
|
||||
_subdir="$1"
|
||||
|
||||
mkdir -p $_OUTDIR/usr.bin/$_subdir/arch/$MACHINE_ARCH
|
||||
write_c $_OUTDIRBASE/usr.bin/$_subdir/arch/$MACHINE_ARCH/config.h \
|
||||
<$_TMPDIR/libdecnumber/config.h
|
||||
}
|
||||
|
||||
##### lib/libgomp #####
|
||||
|
||||
get_libgomp () {
|
||||
_subdir="$1"
|
||||
|
||||
mkdir -p $_OUTDIR/lib/$_subdir/arch/$MACHINE_ARCH
|
||||
write_c $_OUTDIRBASE/lib/$_subdir/arch/$MACHINE_ARCH/config.h \
|
||||
<$_TMPDIR/$_PLATFORM/libgomp/config.h
|
||||
write_c $_OUTDIRBASE/lib/$_subdir/arch/$MACHINE_ARCH/libgomp_f.h \
|
||||
<$_TMPDIR/$_PLATFORM/libgomp/libgomp_f.h
|
||||
write_mk $_OUTDIRBASE/lib/$_subdir/arch/$MACHINE_ARCH/libgomp.spec \
|
||||
<$_TMPDIR/$_PLATFORM/libgomp/libgomp.spec
|
||||
write_c $_OUTDIRBASE/lib/$_subdir/arch/$MACHINE_ARCH/omp.h \
|
||||
<$_TMPDIR/$_PLATFORM/libgomp/omp.h
|
||||
}
|
||||
|
||||
##### gnu/lib/libobjc #####
|
||||
|
||||
get_libobjc () {
|
||||
_subdir="$1/arch/$MACHINE_ARCH"
|
||||
_options="ALL_OPT_FILES"
|
||||
_unwind="UNWIND_H"
|
||||
|
||||
mkdir -p $_OUTDIR/lib/$_subdir
|
||||
|
||||
{
|
||||
if [ -n "$_options" ]; then
|
||||
getvars gcc/Makefile $_options
|
||||
fi
|
||||
getvars $_PLATFORM/libobjc/Makefile \
|
||||
ALL_CFLAGS INCLUDES OBJS OBJC_H \
|
||||
| sed "s,$_GNU_DIST,\${GNUHOSTDIST},g"
|
||||
if [ -n "$_unwind" ]; then
|
||||
getvars gcc/Makefile $_unwind
|
||||
fi
|
||||
} | write_mk $_OUTDIRBASE/lib/$_subdir/defs.mk
|
||||
|
||||
write_c $_OUTDIRBASE/lib/$_subdir/config.h \
|
||||
<$_TMPDIR/$_PLATFORM/libobjc/config.h
|
||||
}
|
||||
|
||||
##### gnu/lib/libstdc++-v3 #####
|
||||
|
||||
get_libstdcxx_v3 () {
|
||||
_subdir="$1"
|
||||
mkdir -p $_OUTDIR/lib/$_subdir/arch/$MACHINE_ARCH
|
||||
|
||||
case ${_subdir} in
|
||||
*)
|
||||
_src_CC_files="atomicity_file CCODECVT_CC CCOLLATE_CC CCTYPE_CC CMESSAGES_CC CMONEY_CC CNUMERIC_CC CTIME_CC CLOCALE_CC BASIC_FILE_CC"
|
||||
_headers1="host_headers debug_headers tr1_headers c_compatibility_headers_extra tr1_impl_headers parallel_headers decimal_headers"
|
||||
_headers2="thread_host_headers host_headers_extra"
|
||||
_build_headers="c++allocator.h c++config.h cxxabi_tweaks.h gthr-default.h gthr-posix.h gthr-single.h gthr-tpf.h gthr.h"
|
||||
_unwind="UNWIND_H"
|
||||
;;
|
||||
esac
|
||||
|
||||
# build files
|
||||
for h in $_build_headers; do
|
||||
write_c $_OUTDIRBASE/lib/$_subdir/arch/$MACHINE_ARCH/$h \
|
||||
<$_TMPDIR/$_PLATFORM/libstdc++-v3/include/$_PLATFORM/bits/$h
|
||||
done
|
||||
|
||||
write_c $_OUTDIRBASE/lib/$_subdir/arch/$MACHINE_ARCH/config.h \
|
||||
<$_TMPDIR/$_PLATFORM/libstdc++-v3/config.h
|
||||
write_c $_OUTDIRBASE/lib/$_subdir/arch/$MACHINE_ARCH/gstdint.h \
|
||||
<$_TMPDIR/$_PLATFORM/libstdc++-v3/include/gstdint.h
|
||||
|
||||
{
|
||||
# libsupc++
|
||||
getvars $_PLATFORM/libstdc++-v3/libsupc++/Makefile \
|
||||
sources | sed 's/^G_sources=/G_LIBSUPCXX_SOURCES=/'
|
||||
getvars $_PLATFORM/libstdc++-v3/libsupc++/Makefile \
|
||||
c_sources | sed 's/^G_c_sources=/G_LIBSUPCXX_C_SOURCES=/'
|
||||
|
||||
# src
|
||||
getvars $_PLATFORM/libstdc++-v3/src/Makefile \
|
||||
sources $_src_CC_files SECTION_FLAGS | sed 's/^G_sources=/G_SRC_SOURCES=/'
|
||||
|
||||
# include
|
||||
getvars $_PLATFORM/libstdc++-v3/include/Makefile \
|
||||
c_base_headers std_headers | sed -e 's#/[^ ][^ ]*/##g' -e 's/\${GNUHOSTDIST}//g'
|
||||
getvars $_PLATFORM/libstdc++-v3/include/Makefile \
|
||||
bits_headers backward_headers ext_headers c_base_headers_extra \
|
||||
$_headers1 | sed -e 's#/[^ ][^ ]*/##g' -e 's/\${GNUHOSTDIST}//g'
|
||||
getvars $_PLATFORM/libstdc++-v3/include/Makefile \
|
||||
$_headers2 | sed -e 's#\./[^ ][^ ]*/##g' -e 's/\${GNUHOSTDIST}//g'
|
||||
|
||||
if [ -n "$_unwind" ]; then
|
||||
getvars gcc/Makefile $_unwind
|
||||
fi
|
||||
} | write_mk $_OUTDIRBASE/lib/$_subdir/arch/$MACHINE_ARCH/defs.mk
|
||||
}
|
||||
|
||||
##### gnu/usr.bin/gcc3 #####
|
||||
|
||||
get_gcc () {
|
||||
_subdir="$1"
|
||||
mkdir -p $_OUTDIR/usr.bin/$_subdir/arch/$MACHINE_ARCH
|
||||
mkdir -p $_OUTDIR/usr.bin/libcpp/arch/$MACHINE_ARCH
|
||||
case ${_subdir} in
|
||||
gcc4)
|
||||
_buildname="BUILD_"
|
||||
_libcppsubdir=""
|
||||
_extravars="TM_H ALL_OPT_FILES"
|
||||
_hconfig_h=""
|
||||
_extravars2="tm_file_list build_xm_include_list"
|
||||
_extravars3="tm_p_include_list"
|
||||
;;
|
||||
|
||||
gcc)
|
||||
_buildname="BUILD_"
|
||||
_libcppsubdir=""
|
||||
_extravars="TM_H ALL_OPT_FILES"
|
||||
_hconfig_h=""
|
||||
_extravars2="tm_file_list build_xm_include_list"
|
||||
_extravars3="tm_p_include_list"
|
||||
;;
|
||||
esac
|
||||
|
||||
{
|
||||
getvars gcc/Makefile \
|
||||
${_buildname}EARLY_SUPPORT ${_buildname}ERRORS ${_buildname}PRINT \
|
||||
${_buildname}RTL ${_buildname}SUPPORT ${_buildname}VARRAY | \
|
||||
sed -e 's#build/errors.o#build-errors.o#g' \
|
||||
-e 's#build/print-rtl.o#build-print-rtl.o#g' \
|
||||
-e 's#build/rtl.o#build-rtl.o#g' \
|
||||
-e 's#build/varray.o#build-varray.o#g' \
|
||||
-e 's#build/ggc-none.o#build-ggc-none.o#g' \
|
||||
-e 's#build/##g'
|
||||
getvars gcc/Makefile \
|
||||
ALL_CFLAGS ALL_CPPFLAGS C_AND_OBJC_OBJS C_OBJS CCCP_OBJS \
|
||||
GCOV_OBJS PROTO_OBJS ${_extravars1} \
|
||||
INCLUDES md_file OBJC_OBJS OBJS out_file version \
|
||||
BUILD_PREFIX RTL_H TREE_H ${_hconfig_h} BASIC_BLOCK_H GCC_H \
|
||||
GTFILES_SRCDIR GTFILES_FILES_FILES GTFILES_FILES_LANGS \
|
||||
GTFILES GTFILES_LANG_DIR_NAMES \
|
||||
tm_defines host_xm_file host_xm_defines tm_p_file \
|
||||
target_cpu_default ${_extravars} ${_extravars2} \
|
||||
lang_specs_files ${_extravars3} \
|
||||
| sed "s,-I$_DESTDIR/usr/include,,g"
|
||||
getvars gcc/Makefile \
|
||||
LIB2ADDEHDEP | sed 's/unwind.inc//'
|
||||
getvars gcc/Makefile \
|
||||
CXX_OBJS CXX_C_OBJS | sed 's/cp\///g'
|
||||
getvars gcc/Makefile \
|
||||
F77_OBJS | sed 's/f\///g'
|
||||
case ${_subdir} in
|
||||
gcc4 | gcc)
|
||||
getvars libcpp/Makefile \
|
||||
libcpp_a_OBJS
|
||||
;;
|
||||
gcc3)
|
||||
getvars gcc/Makefile \
|
||||
LIBCPP_OBJS LIBCPP_H
|
||||
;;
|
||||
esac
|
||||
getvars gcc/Makefile \
|
||||
ENABLE_SHARED
|
||||
case ${_subdir} in
|
||||
gcc4 | gcc)
|
||||
echo G_SHLIB_LINK="$CC -shared"
|
||||
echo G_SHLIB_MULTILIB=.
|
||||
;;
|
||||
esac
|
||||
} | write_mk $_OUTDIRBASE/usr.bin/$_subdir/arch/$MACHINE_ARCH/defs.mk
|
||||
|
||||
case "$_subdir" in
|
||||
gcc4)
|
||||
write_c $_OUTDIRBASE/usr.bin/$_subdir/libcpp/arch/$MACHINE_ARCH/config.h <$_TMPDIR/libcpp/config.h
|
||||
hfiles='auto-host gencheck configargs gthr-default tm bconfig config multilib'
|
||||
;;
|
||||
gcc)
|
||||
write_c $_OUTDIRBASE/usr.bin/libcpp/arch/$MACHINE_ARCH/config.h <$_TMPDIR/libcpp/config.h
|
||||
hfiles='auto-host configargs gthr-default tm bconfig config multilib bversion plugin-version'
|
||||
;;
|
||||
esac
|
||||
for f in $hfiles; do
|
||||
write_c $_OUTDIRBASE/usr.bin/$_subdir/arch/$MACHINE_ARCH/$f.h <$_TMPDIR/gcc/$f.h
|
||||
if [ "${MACHINE_ARCH}" = "powerpc" -a "${f}" = "configargs" ]
|
||||
then
|
||||
ex <<__EOF__ $_OUTDIRBASE/usr.bin/$_subdir/arch/$MACHINE_ARCH/$f.h
|
||||
/configuration_arguments/ s/$//
|
||||
ya
|
||||
i
|
||||
#ifdef _SOFT_FLOAT
|
||||
.
|
||||
pu
|
||||
s/";$/ -with-float=soft";/
|
||||
a
|
||||
#else
|
||||
#endif
|
||||
.
|
||||
. m +1
|
||||
/configure_default_options/ s/{ NULL.*$//
|
||||
a
|
||||
#ifdef _SOFT_FLOAT
|
||||
{ "float", "soft" },
|
||||
#endif
|
||||
{ NULL, NULL }
|
||||
};
|
||||
.
|
||||
wq
|
||||
__EOF__
|
||||
fi
|
||||
done
|
||||
|
||||
# keep identical
|
||||
for f in all-tree.def; do
|
||||
cp $_TMPDIR/gcc/$f $_OUTDIR/usr.bin/$_subdir/arch/$MACHINE_ARCH/$f
|
||||
done
|
||||
|
||||
# special transforms
|
||||
for f in gtyp-input.list; do
|
||||
sed -e 's/^.*external\/gpl3\/gcc\/dist/SRCDIR/' < $_TMPDIR/gcc/$f > $_OUTDIR/usr.bin/$_subdir/arch/$MACHINE_ARCH/$f
|
||||
done
|
||||
|
||||
# special platforms
|
||||
if [ "${MACHINE_ARCH}" = "sh3el" -o "${MACHINE_ARCH}" = "sh3eb" ]; then
|
||||
write_c $_OUTDIRBASE/usr.bin/$_subdir/arch/$MACHINE_ARCH/sysroot-suffix.h <$_TMPDIR/gcc/sysroot-suffix.h
|
||||
fi
|
||||
}
|
||||
|
||||
##### main #####
|
||||
|
||||
case "$1" in
|
||||
# .mk and .h files for libgcc bootstrap (from host build)
|
||||
libgcc)
|
||||
get_libgcc gcc3
|
||||
get_crtstuff crtstuff3
|
||||
exit 0
|
||||
;;
|
||||
|
||||
libgcc4)
|
||||
get_libgcc gcc4
|
||||
get_crtstuff crtstuff4
|
||||
exit 0
|
||||
;;
|
||||
|
||||
libgcc45)
|
||||
_OUTDIR="$_TOP/external/gpl3/gcc"
|
||||
_OUTDIRBASE="external/gpl3/gcc"
|
||||
get_libgcc gcc
|
||||
get_crtstuff crtstuff
|
||||
get_libgcov gcc
|
||||
exit 0
|
||||
;;
|
||||
|
||||
# gcc files
|
||||
gcc4)
|
||||
get_gcc gcc4
|
||||
get_libgcc gcc4
|
||||
get_libgcov gcc4
|
||||
get_crtstuff crtstuff4
|
||||
get_gcc_libiberty gcc4
|
||||
get_libobjc libobjc4
|
||||
get_libstdcxx_v3 libstdc++-v3_4
|
||||
exit 0
|
||||
;;
|
||||
|
||||
gcc45)
|
||||
_OUTDIR="$_TOP/external/gpl3/gcc"
|
||||
_OUTDIRBASE="external/gpl3/gcc"
|
||||
get_gcc gcc
|
||||
get_libgcc gcc
|
||||
get_libgcov gcc
|
||||
get_crtstuff crtstuff
|
||||
get_gcc_libiberty gcc
|
||||
get_libobjc libobjc
|
||||
get_libstdcxx_v3 libstdc++-v3
|
||||
get_libdecnumber libdecnumber
|
||||
get_libgomp libgomp
|
||||
exit 0
|
||||
;;
|
||||
|
||||
|
||||
*) echo invalid arguments; exit 1;;
|
||||
esac
|
91
tools/gcc/mknative.common
Normal file
91
tools/gcc/mknative.common
Normal file
|
@ -0,0 +1,91 @@
|
|||
# $NetBSD: mknative.common,v 1.9 2007/02/05 18:26:01 apb Exp $
|
||||
#
|
||||
# from: NetBSD: mknative,v 1.12 2003/03/05 06:17:17 mrg Exp
|
||||
#
|
||||
# shell-fragment common to all "mknative" scripts
|
||||
|
||||
bomb()
|
||||
{
|
||||
echo >&2 "ABORT: $*"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Make sure we can run OK.
|
||||
if [ -x "$MAKE" ]; then
|
||||
:
|
||||
else
|
||||
bomb "MAKE not set"
|
||||
fi
|
||||
|
||||
# usage: getvars MAKEFILE VARNAME [VARNAME...]
|
||||
#
|
||||
getvars()
|
||||
{
|
||||
_mf="$1"; shift
|
||||
case "$MAKE" in
|
||||
*gmake)
|
||||
env MAKEFLAGS= $MAKE -f - -f "$_TMPDIR/$_mf" _x_ <<EOF || bomb "getvars $_mf $* failed"
|
||||
define echo_var
|
||||
@echo G_\${var}="\${\${var}}" | sed -e 's,\([^\.]\)\./\([a-zA-Z0-9_-]*\.o\),\1\2,g' -e 's,$_VPATH,\$\${GNUHOSTDIST},g' -e 's,$_GNU_DIST,\$\${GNUHOSTDIST},g'
|
||||
|
||||
endef
|
||||
_x_:
|
||||
\$(foreach var,$*,\$(echo_var))
|
||||
EOF
|
||||
;;
|
||||
*)
|
||||
$MAKE -B -f - _x_ <<EOF || bomb "getvars $_mf $* failed"
|
||||
_x_:
|
||||
.for var in $*
|
||||
@echo G_\${var}=\${\${var}:Q} | sed -e 's,\([^\.]\)\./\([a-zA-Z0-9_-]*\.o\),\1\2,g' -e 's,$_VPATH,\$\${GNUHOSTDIST},g' -e 's,$_GNU_DIST,\$\${GNUHOSTDIST},g'
|
||||
.endfor
|
||||
.include "$_TMPDIR/$_mf"
|
||||
EOF
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# usage: write_c FILENAME
|
||||
#
|
||||
write_c()
|
||||
{
|
||||
echo '/* This file is automatically generated. DO NOT EDIT! */' >$_TOP/$1.tmp || \
|
||||
bomb "cannot create $1"
|
||||
grep '$''NetBSD' $0 | sed 's,[#$],,g;s,.*,/* Generated from: & */,' >>$_TOP/$1.tmp
|
||||
echo '$NetBSD: mknative.common,v 1.9 2007/02/05 18:26:01 apb Exp $' | sed 's,[#$],,g;s,.*,/* Generated from: & */,' >>$_TOP/$1.tmp
|
||||
echo '' >>$_TOP/$1.tmp
|
||||
writefile $1
|
||||
}
|
||||
|
||||
# usage: write_mk FILENAME
|
||||
#
|
||||
write_mk()
|
||||
{
|
||||
echo '# This file is automatically generated. DO NOT EDIT!' >$_TOP/$1.tmp || \
|
||||
bomb "cannot create $1"
|
||||
grep '$''NetBSD' $0 | sed 's,[#$],,g;s,.*,# Generated from: &,' >>$_TOP/$1.tmp
|
||||
echo '$NetBSD: mknative.common,v 1.9 2007/02/05 18:26:01 apb Exp $' | sed 's,[#$],,g;s,.*,# Generated from: &,' >>$_TOP/$1.tmp
|
||||
echo '#' >>$_TOP/$1.tmp
|
||||
writefile $1
|
||||
}
|
||||
|
||||
writefile()
|
||||
{
|
||||
sed -e 's,netbsd\(elf\)*1[0-9\.]*\(_\)*[A-Z]*,netbsd\1,' \
|
||||
-e 's,^/\* #undef HAVE_MMAP \*/$,#define HAVE_MMAP 1,' \
|
||||
>>$_TOP/$1.tmp
|
||||
|
||||
# Compare new file, sans "generated from" comments and RCS Id,
|
||||
# to old file. If they match, don't change anything.
|
||||
rm -f $_TMPDIR/.1 $_TMPDIR/.2
|
||||
grep -v 'Generated from:' $_TOP/$1 >$_TMPDIR/.1 2>/dev/null
|
||||
grep -v 'Generated from:' $_TOP/$1.tmp >$_TMPDIR/.2
|
||||
|
||||
# will not overwrite a file that has the same content
|
||||
if cmp $_TMPDIR/.1 $_TMPDIR/.2 >/dev/null 2>&1; then
|
||||
rm -f $_TOP/$1.tmp
|
||||
else
|
||||
echo >&2 "$1 changed"
|
||||
mv -f $_TOP/$1.tmp $_TOP/$1
|
||||
fi
|
||||
}
|
62
tools/gcc/patches/patch-aa
Normal file
62
tools/gcc/patches/patch-aa
Normal file
|
@ -0,0 +1,62 @@
|
|||
$NetBSD: patch-aa,v 1.1.1.1 2009/09/18 11:24:50 dmcmahill Exp $
|
||||
|
||||
--- configure.orig Sat Apr 25 04:10:29 2009
|
||||
+++ configure
|
||||
@@ -4532,7 +4532,7 @@ if test "${with_mpfr_lib+set}" = set; then
|
||||
fi;
|
||||
|
||||
if test "x$with_mpfr" != x; then
|
||||
- gmplibs="-L$with_mpfr/lib $gmplibs"
|
||||
+ gmplibs="-L$with_mpfr/lib -Wl,-R${PREFIX}/lib $gmplibs"
|
||||
gmpinc="-I$with_mpfr/include"
|
||||
fi
|
||||
if test "x$with_mpfr_include" != x; then
|
||||
--- gcc/config.gcc.orig 2009-04-17 13:58:41 +0200
|
||||
+++ gcc/config.gcc
|
||||
@@ -488,6 +488,33 @@ case ${target} in
|
||||
default_use_cxa_atexit=yes;;
|
||||
esac
|
||||
;;
|
||||
+*-*-dragonfly*)
|
||||
+ gas=yes
|
||||
+ gnu_ld=yes
|
||||
+ extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o"
|
||||
+ case ${target} in
|
||||
+ *-*-dragonfly1 | *-*-dragonfly[1].*)
|
||||
+ tm_defines="${tm_defines} DFBSD_MAJOR=1" ;;
|
||||
+ *-*-dragonfly2 | *-*-dragonfly[2].*)
|
||||
+ tm_defines="${tm_defines} DFBSD_MAJOR=2" ;;
|
||||
+ *-*-dragonfly3 | *-*-dragonfly[3].*)
|
||||
+ tm_defines="${tm_defines} DFBSD_MAJOR=3" ;;
|
||||
+ *-*-dragonfly4 | *-*-dragonfly[4].*)
|
||||
+ tm_defines="${tm_defines} DFBSD_MAJOR=4" ;;
|
||||
+ *)
|
||||
+ echo 'Please update *-*-dragonfly* in gcc/config.gcc'
|
||||
+ exit 1
|
||||
+ ;;
|
||||
+ esac
|
||||
+ tmake_file="t-slibgcc-elf-ver t-dragonfly"
|
||||
+ case ${enable_threads} in
|
||||
+ "" | yes | posix)
|
||||
+ thread_file='posix'
|
||||
+ tmake_file="${tmake_file} t-dragonfly-thread"
|
||||
+ ;;
|
||||
+ esac
|
||||
+ dfbsd_tm_file="${dfbsd_tm_file} dragonfly-spec.h dragonfly.h"
|
||||
+ ;;
|
||||
*-*-linux* | frv-*-*linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu | *-*-gnu* | *-*-kopensolaris*-gnu)
|
||||
extra_parts="crtbegin.o crtbeginS.o crtbeginT.o crtend.o crtendS.o"
|
||||
gas=yes
|
||||
@@ -1053,6 +1080,12 @@ x86_64-*-freebsd*)
|
||||
tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h ${fbsd_tm_file} i386/x86-64.h i386/freebsd.h i386/freebsd64.h"
|
||||
tmake_file="${tmake_file} i386/t-crtstuff"
|
||||
;;
|
||||
+i[34567]86-*-dragonfly*)
|
||||
+ tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h ${dfbsd_tm_file} i386/dragonfly.h"
|
||||
+ ;;
|
||||
+x86_64-*-dragonfly*)
|
||||
+ tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h ${dfbsd_tm_file} i386/x86-64.h i386/dragonfly.h i386/dragonfly64.h"
|
||||
+ ;;
|
||||
i[34567]86-*-netbsdelf*)
|
||||
tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h netbsd.h netbsd-elf.h i386/netbsd-elf.h"
|
||||
;;
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue