Convert uses of XKeycodeToKeysym (deprecated) to XkbKeycodeToKeysym
[oweals/cde.git] / util / mergelib.cpp
1 XCOMM!/bin/sh
2 XCOMM
3 XCOMM $TOG: mergelib.cpp /main/5 1998/02/06 11:24:31 kaleb $
4 XCOMM 
5 XCOMM Copyright (c) 1989, 1998 The Open Group
6 XCOMM 
7 XCOMM All Rights Reserved
8 XCOMM 
9 XCOMM The above copyright notice and this permission notice shall be included in
10 XCOMM all copies or substantial portions of the Software.
11 XCOMM 
12 XCOMM THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
13 XCOMM IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14 XCOMM FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
15 XCOMM OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
16 XCOMM AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
17 XCOMM CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
18 XCOMM 
19 XCOMM Except as contained in this notice, the name of The Open Group shall not be
20 XCOMM used in advertising or otherwise to promote the sale, use or other dealings
21 XCOMM in this Software without prior written authorization from The Open Group.
22 XCOMM 
23 XCOMM Author:  Jim Fulton, MIT X Consortium
24 XCOMM 
25 XCOMM mergelib - merge one library into another; this is commonly used by X
26 XCOMM     to add the extension library into the base Xlib.
27 XCOMM
28
29 usage="usage:  $0  to-library from-library [object-filename-prefix]"
30 objprefix=_
31
32 case $# in
33     2) ;;
34     3) objprefix=$3 ;;
35     *) echo "$usage" 1>&2; exit 1 ;;
36 esac
37
38 tolib=$1
39 fromlib=$2
40
41 if [ ! -f $fromlib ]; then
42     echo "$0:  no such from-library $fromlib" 1>&2
43     exit 1
44 fi
45
46 if [ ! -f $tolib ]; then
47     echo "$0:  no such to-library $tolib" 1>&2
48     exit 1
49 fi
50
51
52 XCOMM
53 XCOMM Create a temp directory, and figure out how to reference the 
54 XCOMM object files from it (i.e. relative vs. absolute path names).
55 XCOMM
56
57 tmpdir=tmp.$$
58 origdir=..
59
60 mkdir $tmpdir
61
62 if [ ! -d $tmpdir ]; then
63     echo "$0:  unable to create temporary directory $tmpdir" 1>&2
64     exit 1
65 fi
66
67 case "$fromlib" in
68     /?*) upfrom= ;;
69     *)  upfrom=../ ;;
70 esac
71
72 case "$tolib" in
73     /?*) upto= ;;
74     *)  upto=../ ;;
75 esac
76
77
78 XCOMM
79 XCOMM In the temp directory, extract all of the object files and prefix
80 XCOMM them with some symbol to avoid name clashes with the base library.
81 XCOMM
82 cd $tmpdir
83 ar x ${upfrom}$fromlib
84 for i in *.o; do
85     mv $i ${objprefix}$i
86 done
87
88
89 XCOMM
90 XCOMM Merge in the object modules, ranlib (if appropriate) and cleanup
91 XCOMM
92 ARCMD ${upto}$tolib *.o
93 RANLIB ${upto}$tolib
94 cd $origdir
95 rm -rf $tmpdir
96
97
98