update readme and add gitignore
[client-tools.git] / tools / buildBranchBinaryLibs.sh
blob4a6e19baad3f7c075889d61eef37622543883ed5
1 #!/bin/sh
2 # Copyright 2003, Sony Online Entertainment.
3 # All rights reserved.
5 # Based off a script originally written by Rick Delashmit.
7 # PURPOSE: Build the infrequently-changing Linux libraries that
8 # typically live in perforce as binaries. The gcc 2.95.3 C++ libraries are
9 # incompatible with the gcc 3.x C++ libraries. This script builds
10 # all the libraries that normally exist in perforce as binaries.
12 # NOTE: This script will fail if the user has not taken care to remove
13 # *.a and *.so from their client spec. Those files will be read-only and
14 # the new compiled versions will fail to replace them. As of this writing,
15 # the only .a file that should exist in perforce is the one for pcre in
16 # swg/$BRANCH/src/external/3rd/library/pcre/*.
18 # USAGE: run this script in the from the base directory of a branch.
20 # Here's some examples of branch directories:
21 # ~/swg/current
22 # ~/swg/test
23 # /swo/swg/current
25 # BUGS:
27 # * This script does no error checking on the result of the builds. If
28 # the caller does not watch the output, it is possible this script will fail.
30 # * This script has failed to build in the live branch on Matt Bogue's machine.
31 # Rick and I could not resolve the apparent bash substitution issue that was
32 # occurring. Our workaround was to link the live branch's
33 # external/3rd/library/platform/libs directory to the corresponding directory
34 # in the current branch.
36 export BASEDIR=`pwd`
37 export TEAMBUILDER=0
38 export PLATFORM=linux
40 # chatapi
41 cd $BASEDIR/src/external/3rd/library/soePlatform/ChatAPI2/ChatAPI/projects/Chat/ChatMono
42 make debug release
43 mkdir -p ../../../../../libs/Linux-Debug
44 mkdir -p ../../../../../libs/Linux-Release
45 cp ../../../lib/debug/libChatAPI.a ../../../../../libs/Linux-Debug/
46 cp ../../../lib/release/libChatAPI.a ../../../../../libs/Linux-Release/
48 # stlport
49 cd $BASEDIR/src/external/3rd/library/stlport453/src
50 make -f gcc-linux.mak
52 # zlib
53 # Note: just link zlib to the zlib already installed under Linux.
54 mkdir -p $BASEDIR/src/external/3rd/library/zlib/lib/linux
55 ln -s -f /usr/lib/libz.a $BASEDIR/src/external/3rd/library/zlib/lib/linux/libz.a
57 # loginapi
58 cd $BASEDIR/src/external/3rd/library/platform/projects/Session/LoginAPI
59 make debug release
61 # commonapi
62 cd $BASEDIR/src/external/3rd/library/platform/projects/Session/CommonAPI
63 make debug release
65 # base
66 cd $BASEDIR/src/external/3rd/library/platform/utils/Base/linux
67 make debug_st release_st
69 # commodityapi
70 cd $BASEDIR/src/external/3rd/library/soePlatform/CommodityAPI/linux
71 make debug release
72 cp $BASEDIR/src/external/3rd/library/soePlatform/libs/Linux-Debug/libcommodityapi.so $BASEDIR/exe/linux/
73 cp $BASEDIR/src/external/3rd/library/soePlatform/libs/Linux-Debug/libcommodityapi.so $BASEDIR/dev/linux/
75 # csassistgameapi
76 cd $BASEDIR/src/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi
77 make debug release
79 echo Copying csassistgameapi
80 mkdir -p ../../../../libs/Linux-Debug
81 mkdir -p ../../../../libs/Linux-Release
83 cp debug/libCSAssistgameapi.a ../../../../libs/Linux-Debug/
84 cp release/libCSAssistgameapi.a ../../../../libs/Linux-Release/
85 # note: this includes various other libs that CustomerServiceServer expects to link with, so is not compatible
87 echo Building monapi
88 # monapi
89 cd $BASEDIR/src/external/3rd/library/platform/MonAPI2
90 make clean
91 make all
93 # libOracleDB (CommodityServer)
94 cd $BASEDIR/src/external/3rd/library/soePlatform/CommodityServer/platform/utils/OracleDB
95 rm -f *.o
96 ls *.cpp |sed -e '/\.cpp/s///' -e '/^.*$/s//g++ -g -c -I..\/..\/..\/..\/..\/oracle\/include -I.. &.cpp -o &.o/' >comp.sh
97 source ./comp.sh
98 rm -f comp.sh
99 ar rcs libOracleDB.a *.o
100 mkdir -p ../../../../libs/Linux-Debug
101 mv -f libOracleDB.a ../../../../libs/Linux-Debug/libOracleDB.a
103 # libBase (CommodityServer)
104 cd $BASEDIR/src/external/3rd/library/soePlatform/CommodityServer/platform/utils/Base
105 rm -f *.o */*.o
106 ls *.cpp linux/*.cpp |sed -e '/\.cpp/s///' -e '/^.*$/s//g++ -g -c -Dlinux=1 -D_REENTRANT &.cpp -o &.o/' >comp.sh
107 source ./comp.sh
108 rm -f comp.sh
109 ar rcs libBase.a *.o linux/*.o
110 mkdir -p ../../../../libs/Linux-Debug
111 mv -f libBase.a ../../../../libs/Linux-Debug/libBase.a
113 # Create an empty library.a to solve makefile dependencies on libCSAssistBase.a and libCSAssistUnicode.a
114 echo > /tmp/empty.cpp
115 g++ -c -o /tmp/empty.o /tmp/empty.cpp
116 ar crs /tmp/empty.a /tmp/empty.o
118 mkdir -p $BASEDIR/src/external/3rd/library/soePlatform/libs/Linux-Debug
119 cp /tmp/empty.a $BASEDIR/src/external/3rd/library/soePlatform/libs/Linux-Debug/libCSAssistBase.a
120 cp /tmp/empty.a $BASEDIR/src/external/3rd/library/soePlatform/libs/Linux-Debug/libCSAssistUnicode.a
122 mkdir -p $BASEDIR/src/external/3rd/library/soePlatform/libs/Linux-Release
123 cp /tmp/empty.a $BASEDIR/src/external/3rd/library/soePlatform/libs/Linux-Release/libCSAssistBase.a
124 cp /tmp/empty.a $BASEDIR/src/external/3rd/library/soePlatform/libs/Linux-Release/libCSAssistUnicode.a
126 # Build CommoditiesServer_d and CommoditiesServer_r
127 # .. start with local OracleDB library
128 cd $BASEDIR/src/external/3rd/library/soePlatform/CommodityServer/platform/utils/OracleDB
129 make all
131 # .. now do the server
132 cd ../../..
133 make all
135 # Copy CommoditiesServer_* to exe/linux. The normal
136 # make process copies those from exe/linux to dev/linux.
137 cp commoditysvr $BASEDIR/exe/linux/CommoditiesServer_d
138 cp commoditysvr $BASEDIR/exe/linux/CommoditiesServer_r
140 # Remove the debugging symbols from the release version.
141 # This save 80+ MB.
142 strip -g $BASEDIR/exe/linux/CommoditiesServer_r
144 # Copy Commodities server from exe/linux to dev/linux for the first time. Failure to do this
145 # will cause the build to break.
146 cp $BASEDIR/exe/linux/CommoditiesServer_* $BASEDIR/dev/linux
148 # Build the MonAPI2 library.
149 cd $BASEDIR/src/external/3rd/library/platform/MonAPI2
150 ./bootstrap
151 ./configure --with-udplibrary=../../udplibrary --prefix=`pwd`
152 make
153 make install