From c676c950dbb022004e7224b39355decfa74e6032 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 4 Oct 2010 15:23:24 +0200 Subject: [PATCH] compile_et: Support using system compile_et. --- source4/heimdal_build/et_compile_wrapper.sh | 35 +++++++-------------- source4/heimdal_build/wscript_build | 26 +++++++++------ source4/heimdal_build/wscript_configure | 17 +++++----- 3 files changed, 38 insertions(+), 40 deletions(-) diff --git a/source4/heimdal_build/et_compile_wrapper.sh b/source4/heimdal_build/et_compile_wrapper.sh index ec3b39ff560..b267bb5ddcc 100755 --- a/source4/heimdal_build/et_compile_wrapper.sh +++ b/source4/heimdal_build/et_compile_wrapper.sh @@ -4,18 +4,11 @@ SELF=$0 SELFDIR=`dirname ${SELF}` -BUILDDIR=$1 -DESTDIR=$2 - -CMD=$3 -FILE=$4 -SOURCE=$5 -shift 5 - -test -z "${BUILDDIR}" && { - echo "${SELF}:BUILDDIR: '${BUILDDIR}'" >&2; - exit 1; -} +DESTDIR=$1 +CMD=$2 +FILE=$3 +SOURCE=$4 +shift 4 test -z "${DESTDIR}" && { echo "${SELF}:DESTDIR: '${DESTDIR}'" >&2; @@ -39,16 +32,12 @@ test -z "${SOURCE}" && { CURDIR=`pwd` -cd ${BUILDDIR} && { - ABS_BUILDDIR=`pwd` - cd ${CURDIR} -} || { - echo "${SELF}:cannot cd into '${BUILDDIR}'" >&2; - exit 1; -} - cd ${DESTDIR} && { - ${ABS_BUILDDIR}/${CMD} ${FILE} >&2 || exit 1; + # Remove older copies beforehand - MIT's compile_et uses odd permissions for these + # files, which makes Heimdal's compile_et fail mysteriously when writing to them. + rm -f `basename ${FILE} .et`.c + rm -f `basename ${FILE} .et`.h + ${CMD} ${FILE} >&2 || exit 1; cd ${CURDIR} TMP="${SOURCE}.$$" mv ${SOURCE} ${TMP} && { @@ -56,9 +45,9 @@ cd ${DESTDIR} && { cat ${TMP} >> ${SOURCE} } } - rm ${TMP} + rm -f ${TMP} } || { - echo "${SELF}:cannot cd into '${BUILDDIR}'" >&2; + echo "${SELF}:cannot cd into '${DESTDIR}'" >&2; exit 1; } diff --git a/source4/heimdal_build/wscript_build b/source4/heimdal_build/wscript_build index 3375e3296bc..257796faf06 100644 --- a/source4/heimdal_build/wscript_build +++ b/source4/heimdal_build/wscript_build @@ -124,12 +124,17 @@ def HEIMDAL_ERRTABLE(bld, name, source): out_files.append('%s.c' % bname) out_files.append('%s.h' % bname) - t = bld(rule='${SRC[1].abspath(env)} . ${TGT[0].parent.abspath(env)} default/source4/heimdal_build/compile_et ${SRC[0].abspath(env)} ${TGT[0].bldpath(env)}', + sources = [source, 'et_compile_wrapper.sh'] + + if not bld.CONFIG_SET('USING_SYSTEM_COMPILE_ET'): + sources.append('compile_et') + + t = bld(rule='${SRC[1].abspath(env)} ${TGT[0].parent.abspath(env)} ${COMPILE_ET} ${SRC[0].abspath(env)} ${TGT[0].bldpath(env)}', ext_out = '.c', before = 'cc', on_results = True, shell = True, - source = [source, 'et_compile_wrapper.sh', 'compile_et'], + source = sources, target = out_files, name = name) Build.BuildContext.HEIMDAL_ERRTABLE = HEIMDAL_ERRTABLE @@ -602,22 +607,23 @@ bld.SAMBA_BINARY('asn1_compile', cflags='-DSOCKET_WRAPPER_DISABLE=1 -DNSS_WRAPPER_DISABLE=1 -D_SAMBA_HOSTCC_', includes='../heimdal/lib/asn1 ../heimdal/lib/roken', group='build_compilers', - deps='HEIMDAL_ROKEN_HOSTCC LIBREPLACE_HOSTCC', + deps='HEIMDAL_ROKEN_HOSTCC', install=False ) -bld.SAMBA_BINARY('compile_et', - '../heimdal/lib/vers/print_version.c ../heimdal/lib/com_err/parse.c ../heimdal/lib/com_err/lex.c ../heimdal/lib/com_err/compile_et.c', - use_hostcc=True, +if not bld.CONFIG_SET('USING_SYSTEM_COMPILE_ET'): + bld.SAMBA_BINARY('compile_et', + '../heimdal/lib/vers/print_version.c ../heimdal/lib/com_err/parse.c ../heimdal/lib/com_err/lex.c ../heimdal/lib/com_err/compile_et.c', + use_hostcc=True, use_global_deps=False, - includes='../heimdal/lib/com_err', + includes='../heimdal/lib/com_err', group='build_compilers', cflags='-DSOCKET_WRAPPER_DISABLE=1 -DNSS_WRAPPER_DISABLE=1 -D_SAMBA_HOSTCC_', - deps='HEIMDAL_ROKEN_HOSTCC LIBREPLACE_HOSTCC', + deps='HEIMDAL_ROKEN_HOSTCC', install=False - ) - + ) + bld.env['COMPILE_ET'] = os.path.join(bld.env['BUILD_DIRECTORY'], 'compile_et') bld.SAMBA_BINARY('samba4kinit', '../heimdal/kuser/kinit.c ../heimdal/lib/vers/print_version.c', diff --git a/source4/heimdal_build/wscript_configure b/source4/heimdal_build/wscript_configure index db4aa9c426d..74b1794151c 100644 --- a/source4/heimdal_build/wscript_configure +++ b/source4/heimdal_build/wscript_configure @@ -7,16 +7,16 @@ conf.CHECK_HEADERS('err.h') conf.CHECK_HEADERS('ifaddrs.h') conf.CHECK_HEADERS('''crypt.h errno.h inttypes.h netdb.h signal.h sys/bswap.h - sys/file.h sys/stropts.h sys/timeb.h sys/times.h sys/uio.h sys/un.h - sys/utsname.h time.h timezone.h ttyname.h netinet/in.h - netinet/in6.h netinet6/in6.h libintl.h''') + sys/file.h sys/stropts.h sys/timeb.h sys/times.h sys/uio.h sys/un.h + sys/utsname.h time.h timezone.h ttyname.h netinet/in.h + netinet/in6.h netinet6/in6.h libintl.h''') conf.CHECK_HEADERS('curses.h term.h termcap.h', together=True) conf.CHECK_FUNCS('''atexit cgetent getprogname setprogname gethostname putenv rcmd readv sendmsg setitimer strlwr strncasecmp - strptime strsep strsep_copy strtok_r strupr swab umask uname unsetenv - closefrom err warn errx warnx flock writev''') + strptime strsep strsep_copy strtok_r strupr swab umask uname unsetenv + closefrom err warn errx warnx flock writev''') conf.CHECK_FUNCS_IN('hstrerror', 'resolv socket nsl', checklibc=True) conf.CHECK_FUNCS_IN('''getnameinfo sendmsg socket getipnodebyname gethostent gethostent_r @@ -34,9 +34,9 @@ conf.CHECK_FUNCS('bswap32') conf.CHECK_TYPE('struct winsize', define='HAVE_STRUCT_WINSIZE', headers='sys/termios.h sys/ioctl.h') conf.CHECK_STRUCTURE_MEMBER('struct winsize', 'ws_xpixel', - define='HAVE_WS_XPIXEL', headers='sys/termios.h sys/ioctl.h') + define='HAVE_WS_XPIXEL', headers='sys/termios.h sys/ioctl.h') conf.CHECK_STRUCTURE_MEMBER('struct winsize', 'ws_ypixel', - define='HAVE_WS_YPIXEL', headers='sys/termios.h sys/ioctl.h') + define='HAVE_WS_YPIXEL', headers='sys/termios.h sys/ioctl.h') conf.DEFINE('HAVE_KRB_STRUCT_WINSIZE', 1) conf.DEFINE('VOID_RETSIGTYPE', 1) @@ -62,3 +62,6 @@ conf.DEFINE('SAMBA4_INTERNAL_HEIMDAL', 1) if conf.CHECK_BUNDLED_SYSTEM('com_err', checkfunctions='com_err', headers='com_err.h'): conf.define('USING_SYSTEM_COM_ERR', 1) + +if conf.find_program('compile_et', var='COMPILE_ET'): + conf.define('USING_SYSTEM_COMPILE_ET', 1) -- 2.34.1