aix43_shlib_build.sh

Jamey Sharp jamey at gabe.freedesktop.org
Mon Oct 31 15:09:12 PST 2005


Update of /cvs/xtest/xtest/src/tet3/bin
In directory gabe:/tmp/cvs-serv27930/src/tet3/bin

Added Files:
	aix43_shlib_build.sh symbols.sh symbuild.sh 
	w32_shlib_build.ksh w32_symbuild.ksh 
Log Message:
Importing TET 3.3h (unsupported) sources from http://tetworks.opengroup.org/tet/tet3.3h-unsup.src.tgz.
Omitted the contrib directory: we don't care, and the license situation wasn't entirely clear.


--- NEW FILE: symbols.sh ---
#
#	SCCS: @(#)symbols.sh	1.1 (98/09/01)
#
#	UniSoft Ltd., London, England
#
# Copyright (c) 1998 The Open Group
# All rights reserved.
#
# No part of this source code may be reproduced, stored in a retrieval
# system, or transmitted, in any form or by any means, electronic,
# mechanical, photocopying, recording or otherwise, except as stated in
# the end-user licence agreement, without the prior permission of the
# copyright owners.
# A copy of the end-user licence agreement is contained in the file
# Licence which accompanies this distribution.
# 
# Motif, OSF/1, UNIX and the "X" device are registered trademarks and
# IT DialTone and The Open Group are trademarks of The Open Group in
# the US and other countries.
#
# X/Open is a trademark of X/Open Company Limited in the UK and other
# countries.
#
# ************************************************************************
#
# SCCS:   	@(#)symbols.sh	1.1 98/09/01 TETware release 3.3
# NAME:		symbols.sh
# PRODUCT:	TETware
# AUTHOR:	Andrew Dingwall, UniSoft Ltd.
# DATE CREATED:	July 1998
#
# DESCRIPTION:
#	shell script to extract the imported and exported symbols
#	from a .c file
#	
#
# MODIFICATIONS:
# 
# ************************************************************************

tmp_c=tmp$$.c

trap 's=$?; rm -f $tmp_c; exit $s' 0
trap 'exit $?' 1 2 3 13 15


badusage()
{
	echo "usage: $0 [cc-options ...] cfiles ..." 1>&2
	exit 2
}

# parse the command line
cflags=
cfiles=
while test $# -gt 0
do
	case $1 in
	-c)
		;;
	-*)
		cflags="$cflags${cflags:+ }$1"
		;;
	*.c)
		cfiles="$cfiles${cfiles:+ }$1"
		;;
	*)
		echo "$0: unknown file $1 ignored" 1>&2
		;;
	esac
	shift
done

if test -z "$cfiles"
then
	badusage
fi

# for each .c file, generate a .sym file that will contain a list of export
# and import symbols
#
# each line in the .sym file will be of the form:
#
#	EXPORT <type> <symbol>
# or
#	IMPORT <type> <symbol>
#
# where <type> is one of FUNC, FUNCPTR, DATA or ARRAY

for cfile in $cfiles
do
	incdir=`dirname $cfile`
	output=`basename $cfile .c`.sym
	cat - $cfile > $tmp_c <<!EOF
#define TET_SHLIB_BUILD_SCRIPT
#define TET_IMPORT_FUNC(TYPE, NAME, ARGS) \
	TET_IMPORT_SYMBOL FUNC NAME junk
#define TET_IMPORT_FUNC_PTR(TYPE, NAME, ARGS) \
	TET_IMPORT_SYMBOL FUNCPTR NAME junk
#define TET_IMPORT_DATA(TYPE, NAME) \
	TET_IMPORT_SYMBOL DATA NAME junk
#define TET_IMPORT_ARRAY(TYPE, NAME, DIM) \
	TET_IMPORT_SYMBOL ARRAY NAME junk
#define TET_EXPORT_FUNC(TYPE, NAME, ARGS) \
	TET_EXPORT_SYMBOL FUNC NAME junk
#define TET_EXPORT_FUNC_PTR(TYPE, NAME, ARGS) \
	TET_EXPORT_SYMBOL FUNCPTR NAME junk
#define TET_EXPORT_DATA(TYPE, NAME) \
	TET_EXPORT_SYMBOL DATA NAME junk
#define TET_EXPORT_ARRAY(TYPE, NAME, DIM) \
	TET_EXPORT_SYMBOL ARRAY NAME junk
!EOF

	${CC:-cc} -I$incdir $cflags -E $tmp_c | egrep '^[ 	]*TET' | \
		awk '$1 == "TET_EXPORT_SYMBOL" {
			printf("EXPORT %s %s\n", $2, $3);
		}
		$1 == "TET_IMPORT_SYMBOL" {
			printf("IMPORT %s %s\n", $2, $3);
		}' > $output
done


--- NEW FILE: w32_symbuild.ksh ---
#
#	SCCS: @(#)w32_symbuild.ksh	1.1 (98/09/01)
#
#	UniSoft Ltd., London, England
#
# Copyright (c) 1998 The Open Group
# All rights reserved.
#
# No part of this source code may be reproduced, stored in a retrieval
# system, or transmitted, in any form or by any means, electronic,
# mechanical, photocopying, recording or otherwise, except as stated in
# the end-user licence agreement, without the prior permission of the
# copyright owners.
# A copy of the end-user licence agreement is contained in the file
# Licence which accompanies this distribution.
# 
# Motif, OSF/1, UNIX and the "X" device are registered trademarks and
# IT DialTone and The Open Group are trademarks of The Open Group in
# the US and other countries.
#
# X/Open is a trademark of X/Open Company Limited in the UK and other
# countries.
#
# ************************************************************************
#
# SCCS:   	@(#)w32_symbuild.ksh	1.1 98/09/01 TETware release 3.3
# NAME:		w32_symbuild.ksh
# PRODUCT:	TETware
# AUTHOR:	Andrew Dingwall, UniSoft Ltd.
# DATE CREATED:	July 1998
#
# DESCRIPTION:
#	shell script to extract the imported and exported symbols
#	from a .c file, then compile the .c file so that a reference
#	to a symbol that is exported from a program to a DLL is changed
#	to an indirect reference via a pointer
#	
#
# MODIFICATIONS:
# 
# ************************************************************************

# determine the name of the .c file
cfile=
for arg
do
	case $arg in
	*.c)
		if test -z "$cfile"
		then
			cfile=$arg
		else
			echo $0: can only handle one .c file 1>&2
			exit 2
		fi
		;;
	esac
done

if test -z "$cfile"
then
	echo $0: need a .c file name 1>&2
	exit 2
fi

# extract the symbols
CC=${CC:?} sh ../bin/symbols.sh "$@"

# for each symbol that is exported from a program to a DLL, a cdef is
# generated of the form:
#
#	-Dfoo=(*tet_dll_foo)
#
x=${cfile##*/}
symfile=${x%.c}.sym
cdefs=
while read impexp type name junk
do
	case $impexp in
	EXPORT)
		cdefs="$cdefs${cdefs:+ }-D$name=(*tet_dll_$name)"
		;;
	esac
done < $symfile


# do the compilation
echo $CC $cdefs "$@"
$CC $cdefs "$@"


--- NEW FILE: w32_shlib_build.ksh ---
#
#	SCCS: @(#)w32_shlib_build.ksh	1.1 (98/09/01)
#
#	UniSoft Ltd., London, England
#
# Copyright (c) 1998 The Open Group
# All rights reserved.
#
# No part of this source code may be reproduced, stored in a retrieval
# system, or transmitted, in any form or by any means, electronic,
# mechanical, photocopying, recording or otherwise, except as stated in
# the end-user licence agreement, without the prior permission of the
# copyright owners.
# A copy of the end-user licence agreement is contained in the file
# Licence which accompanies this distribution.
# 
# Motif, OSF/1, UNIX and the "X" device are registered trademarks and
# IT DialTone and The Open Group are trademarks of The Open Group in
# the US and other countries.
#
# X/Open is a trademark of X/Open Company Limited in the UK and other
# countries.
#
# ************************************************************************
#
# SCCS:   	@(#)w32_shlib_build.ksh	1.1 98/09/01 TETware release 3.3
# NAME:		w32_shlib_build.ksh
# PRODUCT:	TETware
# AUTHOR:	Andrew Dingwall, UniSoft Ltd.
# DATE CREATED:	July 1998
#
# DESCRIPTION:
#	shell script to build the shared API libraries on Win32 systems
#
# MODIFICATIONS:
# 
# ************************************************************************

tmp=tmp$$

trap 's=$?; rm -f $tmp; exit $s' 0
trap 'exit $?' 1 2 3 13 15


badusage()
{
	echo "usage: $0 [cc-options ...] -o output ofiles ..." 1>&2
	exit 2
}

# parse the command line
output=
ofiles=
cflags=
libs=
while test $# -gt 0
do
	case $1 in
	-o)
		# note that patterns are case-insensitive in the MKS shell
		if test X$1 = X-o
		then
			output=$2
			shift
		else
			cflags="$cflags${cflags:+ }$1"
		fi
		;;
	-*)
		cflags="$cflags${cflags:+ }$1"
		;;
	*.obj)
		ofiles="$ofiles${ofiles:+ }$1"
		;;
	*.lib)
		libs="$libs${libs:+ }$1"
		;;
	*)
		echo "$0: unknown file $1 ignored" 1>&2
		;;
	esac
	shift
done

if test -z "$ofiles" -o -z "$output"
then
	badusage
fi

# generate the list of symbol files
for ofile in $ofiles
do
	symfiles="$symfiles${symfiles:+ }${ofile%.obj}.sym"
done


set -e

sort -u -o $tmp $symfiles

# generate the dynlink.gen file for use by tcm/dynlink.c
awk '$1 == "EXPORT" {
	if ($2 == "DATA" || $2 == "FUNCPTR" || $2 == "ARRAY")
		printf("\ttet_dll_%s = &%s;\n", $3, $3);
	else if ($2 == "FUNC")
		printf("\ttet_dll_%s = %s;\n", $3, $3);
}' $tmp > dynlink.gen

# generate the dlcheck.gen file for use by tcm/dynlink.c
awk '$1 == "EXPORT" {
	printf("\tif (!tet_dll_%s)\n\t\treport_nullptr(\"%s\");\n", $3, $3);
}' $tmp > dlcheck.gen


# build the shared API library
CC=cc ../bin/w32_symbuild -I. $cflags -c ../tcm/dynlink.c
mv dynlink.obj dlcheck.obj
set -x
cc -LD -o $output $ofiles dlcheck.obj $libs


--- NEW FILE: aix43_shlib_build.sh ---
#
#	SCCS: @(#)aix43_shlib_build.sh	1.1 (98/09/01)
#
#	UniSoft Ltd., London, England
#
# Copyright (c) 1998 The Open Group
# All rights reserved.
#
# No part of this source code may be reproduced, stored in a retrieval
# system, or transmitted, in any form or by any means, electronic,
# mechanical, photocopying, recording or otherwise, except as stated in
# the end-user licence agreement, without the prior permission of the
# copyright owners.
# A copy of the end-user licence agreement is contained in the file
# Licence which accompanies this distribution.
# 
# Motif, OSF/1, UNIX and the "X" device are registered trademarks and
# IT DialTone and The Open Group are trademarks of The Open Group in
# the US and other countries.
#
# X/Open is a trademark of X/Open Company Limited in the UK and other
# countries.
#
# ************************************************************************
#
# SCCS:   	@(#)aix43_shlib_build.sh	1.1 98/09/01 TETware release 3.3
# NAME:		aix43_shlib_build.sh
# PRODUCT:	TETware
# AUTHOR:	Andrew Dingwall, UniSoft Ltd.
# DATE CREATED:	July 1998
#
# DESCRIPTION:
#	shell script to build the shared API libraries on AIX 4.3
# 
# MODIFICATIONS:
# 
# ************************************************************************

tmp=tmp$$
tmp_imp=tmp$$.imp
tmp_exp=tmp$$.exp

trap 's=$?; rm -f $tmp $tmp_imp $tmp_exp; exit $s' 0
trap 'exit $?' 1 2 3 13 15


badusage()
{
	echo "usage: $0 -o output ofiles ..." 1>&2
	exit 2
}

args="`getopt l:o: $*`"
if test $? -eq 0
then
	set -- $args
else
	badusage
fi

# parse the command line
output=
ofiles=
libs=
while test $# -gt 0
do
	case $1 in
	-l)
		libs="$libs${libs:+ }$1$2"
		shift
		;;
	-l*|*.a)
		libs="$libs${libs:+ }$1"
		;;
	-o)
		output=$2
		shift
		;;
	--)
		;;
	-*)
		badusage
		;;
	*.o)
		ofiles="$ofiles${ofiles:+ }$1"
		;;
	*)
		echo "$0: unknown file $1 ignored" 1>&2
		;;
	esac
	shift
done

if test -z "$ofiles" -o -z "$output"
then
	badusage
fi

for ofile in $ofiles
do
	symfile=`basename $ofile .o`.sym
	symfiles="$symfiles${symfiles:+ }$symfile"
done

set -e

sort -u -o $tmp $symfiles

# generate the import file for the linker
awk 'BEGIN {
	printf("#! .\n");
}
$1 == "EXPORT" {
	print $3;
}' $tmp > $tmp_imp

# generate the export file for the linker
awk '$1 == "IMPORT" {
	print $3;
}' $tmp > $tmp_exp

# build the shared object and put it in an archive library
ld -brtl -bM:SRC -bnoentry -bI:$tmp_imp -bE:$tmp_exp -o shr.o $ofiles $libs -lc
rm -f $output
ar rcv $output shr.o
rm -f shr.o


--- NEW FILE: symbuild.sh ---
#
#	SCCS: @(#)symbuild.sh	1.1 (98/09/01)
#
#	UniSoft Ltd., London, England
#
# Copyright (c) 1998 The Open Group
# All rights reserved.
#
# No part of this source code may be reproduced, stored in a retrieval
# system, or transmitted, in any form or by any means, electronic,
# mechanical, photocopying, recording or otherwise, except as stated in
# the end-user licence agreement, without the prior permission of the
# copyright owners.
# A copy of the end-user licence agreement is contained in the file
# Licence which accompanies this distribution.
# 
# Motif, OSF/1, UNIX and the "X" device are registered trademarks and
# IT DialTone and The Open Group are trademarks of The Open Group in
# the US and other countries.
#
# X/Open is a trademark of X/Open Company Limited in the UK and other
# countries.
#
# ************************************************************************
#
# SCCS:   	@(#)symbuild.sh	1.1 98/09/01 TETware release 3.3
# NAME:		symbuild.sh
# PRODUCT:	TETware
# AUTHOR:	Andrew Dingwall, UniSoft Ltd.
# DATE CREATED:	July 1998
#
# DESCRIPTION:
#	shell script to extract the imported and exported symbols
#	from a .c file, then compile it
#	
#
# MODIFICATIONS:
# 
# ************************************************************************

# extract the symbols
CC=${CC:?} sh ../bin/symbols.sh "$@"

# do the compilation
$CC "$@"




More information about the xorg-test-commit mailing list