Back to home page

Enduro/X

 
 

    


0001 BUILDSERVER(8)
0002 ==============
0003 :doctype: manpage
0004 
0005 
0006 NAME
0007 ----
0008 buildserver - Build XATMI server executable
0009 
0010 
0011 SYNOPSIS
0012 --------
0013 *buildserver* ['OPTIONS']
0014 
0015 
0016 DESCRIPTION
0017 -----------
0018 Build server is a binary which generates main() entry point for the server process.
0019 Also server processes can be configured at build stage to statically 
0020 advertise services, passed to command line. Once the main entry point and advertise
0021 tables are generate, the C compiler is invoked to which generated and user files are passed.
0022 
0023 It is possible to override the functionality of the generated main() function by
0024 enabling *TMMAINEXIT* macro for build. If macro is set, then after generated variable
0025 definition "mainexit.h" header is included, which may contain custom code.
0026 
0027 The generated server entry point looks like:
0028 
0029 --------------------------------------------------------------------------------
0030 
0031 /* Buildserver auto-generated code */
0032 /*---------------------------Includes-----------------------------------*/
0033 #include <stdio.h>
0034 #include <stdlib.h>
0035 #include <ndebug.h>
0036 #include <atmi.h>
0037 #include <ndrstandard.h>
0038 #include <ubf.h>
0039 #include <string.h>
0040 #include <unistd.h>
0041 #include <xa.h>
0042 /*---------------------------Externs------------------------------------*/
0043 /* Buildserver auto generated extern service list */
0044 extern void TESTFUNC (TPSVCINFO *);
0045 /*---------------------------Macros-------------------------------------*/
0046 /*---------------------------Enums--------------------------------------*/
0047 /*---------------------------Typedefs-----------------------------------*/
0048 /*---------------------------Globals------------------------------------*/
0049 /*---------------------------Statics------------------------------------*/
0050 /* Auto generated system advertise table */
0051 expublic struct tmdsptchtbl_t ndrx_G_tmdsptchtbl[] = {
0052     {"TESTSVC","TESTFUNC",(void (*)(TPSVCINFO *)) TESTFUNC, 0, 0 },
0053     { NULL, NULL, NULL, 0, 0 }
0054 };
0055 /*---------------------------Prototypes---------------------------------*/
0056 
0057 /* Buildserver main  */
0058 int main( int argc, char** argv )
0059 {
0060     _tmbuilt_with_thread_option=0;
0061     struct tmsvrargs_t tmsvrargs =
0062     {
0063         &tmnull_switch,
0064         &ndrx_G_tmdsptchtbl[0],
0065         0,
0066         tpsvrinit,
0067         tpsvrdone,
0068         NULL,
0069         NULL,
0070         NULL,
0071         NULL,
0072         NULL
0073     };
0074 #ifdef TMMAINEXIT
0075 #include "mainexit.h"
0076 #endif
0077     return( _tmstartserver( argc, argv, &tmsvrargs ));
0078 }
0079 
0080 --------------------------------------------------------------------------------
0081 
0082 The command line template, how C compiler is invoked, is following:
0083 
0084 --------------------------------------------------------------------------------
0085 <CC> [$CFLAGS] -o <binary_name> <generated_source>.c [-I<$NDRX_HOME>/include 
0086 -L<NDRX_HOME>/{lib|lib64}] [<first_files>] [<RM_libs>] -latmisrvinteg -latmi -lubf -lnstd [<last_files>]
0087 --------------------------------------------------------------------------------
0088 
0089 All filesystem path related buffers internally are set to 5120 bytes + EOS byte,
0090 thus for example if build command is longer than 5120, it will be truncated
0091 to 5120.
0092 
0093 ENVIRONMENT
0094 -----------
0095 [*CC*]::
0096 Optional environment variable indicating which C compiler to use. If parameter is
0097 not set, the *cc* command is used.
0098 
0099 [*CFLAGS*]::
0100 Optional C flags to be passed to C compiler during the *cc* execution. There
0101 is set of compiler flags that are required for certain platforms. See section
0102 bellow.
0103 
0104 [*NDRX_HOME*]::
0105 Optional environment variable indicating the Enduro/X installation home. If variable
0106 is set then, "-I$NDRX_HOME/include" and "-L$NDRX_HOME/lib" (or lib64) is added 
0107 to the *cc* command line.
0108 
0109 OPTIONS
0110 -------
0111 
0112 [*-C*]::
0113 COBOL mode. Reserved for future use.
0114 
0115 [*-o* filename]::
0116 Output file name for compiler. If not specified, then default is *SERVER*.
0117 
0118 [*-f* firstfiles]::
0119 Arguments to be passed to compiler command line. Typically here source file names, object
0120 file names or library settings are passed. These names are included in compilation command
0121 before Enduro/X libraries (from left to right).
0122 
0123 [*-a*]::
0124 Alias to '-f'.
0125 
0126 [*-l* lastfiles]::
0127 Arguments to be passed to compiler command line. Typically here source file names, object
0128 file names or library settings are passed. These names are included in compilation command
0129 after Enduro/X libraries (from left to right).
0130 
0131 [*-r* rm_name]::
0132 This is resource manager name. The resource manager according the specified name
0133 shall be configured in *$NDRX_RMFILE* (first priority) or *$NDRX_HOME/udataobj/RM* file.
0134 The file format is following 'rm_name:xa_switch_name:<compiler libraries>'. If 
0135 specified, then 'xa_switch_name' is included in the process. Thus later *libndrxxatmsx(8)*
0136 XA driver can be used (set in *NDRX_XA_DRIVERLIB* env var, see *ex_env(5)*), 
0137 so that driver resolves built in symbols. Compiler libraries from resource manager 
0138 are passed in command line after the first files. If switch name is not specified,
0139 then default null switch 'tmnull_switch' is reference (present in *libatmi*).
0140 File format is described bellow.
0141 
0142 [*-s* '{@filename|svc1,svc2,...:func|:func}']::
0143 Service definition which shall be added. This argument can be repeated multiple
0144 times in command line. Syntax modes are following '-s ASVC,BSVC', will advertise
0145 two services for which functions ASVC() and BSVC() is expected to be present 
0146 in artifacts passed to '-f' or '-l' flags (source/object files). If passing 
0147 '-sCSVC,ZSVC:SOMEFUNC', then it is expected, that the extern function is SOMEFUNC()
0148 which also must be present in '-f' or '-l' included artifacts. It is also possible
0149 to register the function in service tables (currently not used by Enduro/X) via
0150 '-s:SOMEFUNC' parameter. The services may be advertised via specified 
0151 file, in such case '@filename' is specified. See section bellow for include file format.
0152 
0153 [*-g* rm_name]::
0154 '-g' is alias to '-r'.
0155 
0156 [*-k*]::
0157 Keep the the generate source code with the main function. If not set, the file
0158 is deleted when *buildserver* finishes.
0159 
0160 [*-t*]::
0161 Server is multi-threaded. Indicates that server can be started/configured in
0162 multi-threaded mode. This flag is reserved for future use. Currently this
0163 indication is built in the binary, but not used in any other way. Will be used
0164 once Enduro/X will support multi-threaded service dispatching. Do not confuse
0165 this flag with current Enduro/X threading model, as user threads are fully
0166 supported.
0167 
0168 [*-v*]::
0169 Verbose mode. This will print the build command to stderr.
0170 
0171 [*-h*]::
0172 Print the help.
0173 
0174 SERVICE FILE FORMAT
0175 -------------------
0176 The file format for service advertise is basically the same as '-s' parameter.
0177 Each line shall contain either 'SOMESVC[,OTHERSVC]:SOMEFUNC' or 'SOMESVC' or ':SOMEFUNC'.
0178 File format ignores lines starting with '#' or empty (white space filled) lines.
0179 
0180 Sample file ('advertise_file.txt', included by -s @advertise_file.txt to buildserver):
0181 --------------------------------------------------------------------------------
0182 #
0183 # This file exports some functions for test purposes
0184 #
0185 
0186 FI1,FI2:ECHOSV
0187 ECHO2SV
0188 ECHO2SV
0189 :SERV
0190 
0191 --------------------------------------------------------------------------------
0192 
0193 RM FILE FORMAT
0194 --------------
0195 Resource manager file format accepts '#' as comments, and parser ignores 
0196 whitespace/empty lines. The format is '<rm_name>:<switch_name>:<libraries>'
0197 
0198 Sample definitions:
0199 --------------------------------------------------------------------------------
0200 #
0201 # This is test file of the switches
0202 #
0203 
0204 nullsw:tmnull_switch:
0205 TestSw:ndrxstatsw: -L ../test021_xafull -l xadrv
0206 #
0207 # Oracle static registration switch:
0208 #
0209 Oracle_XA:xaosw:-L$(ORACLE_HOME)/lib -lclntsh
0210 --------------------------------------------------------------------------------
0211 
0212 PLATFORM SPECIFIC COMPILER FLAGS
0213 --------------------------------
0214 
0215 There are certain flags which must be passed to the compilers, in order to get
0216 binaries successfully linked.
0217 
0218 *AIX OS - xlC Compiler*:  
0219 
0220 . '-brtl': Enable runtime linking. Mandatory only for ATMI Clients, to allow
0221 runtime XA switch symbol resolve from lib to binary.
0222 
0223 *AIX OS - GCC Compiler*:
0224 
0225 . '-maix64': AIX 64 bit flag must be passed to compiler.
0226 
0227 . '-Wl,-brtl': Enable runtime linking. Mandatory only for ATMI Clients, to allow
0228 runtime XA switch symbol resolve from lib to binary.
0229 
0230 
0231 EXAMPLE
0232 -------
0233 See *atmitest/test071_buildtools/run.sh* for samples. Some of them:
0234 
0235 --------------------------------------------------------------------------------
0236 $ export CC=cc
0237 $ export CFLAGS="-g -I../../include -L../../libatmi -L../../libubf -L../../libatmisrv -L../../libnstd"
0238 
0239 $ buildserver -o atmi.sv71 -rTestSw -a atmisv71_1.c -l atmisv71_2.c -v \
0240     -s A,B,C:TESTSV -sECHOSV -s:TESTSV -sZ:ECHOSV -f atmisv71_3.c -l atmisv71_4.c \
0241     -s @advertise_file.txt
0242 
0243 --------------------------------------------------------------------------------
0244 
0245 That would result in following compilation unit:
0246 
0247 --------------------------------------------------------------------------------
0248 
0249 $ cc -g -I../../include -L../../libatmi -L../../libubf -L../../tmsrv -L../../libatmisrv \
0250 -L../../libexuuid -L../../libexthpool -L../../libnstd -o atmi.sv71 ndrx_bs_xw4wIZ.c \
0251 -I./include -L./lib atmisv71_1.c atmisv71_3.c -L ../test021_xafull -l xadrv -latmisrvinteg \
0252 -latmi -lubf -lnstd -lrt -ldl -lm -lc -lpthread atmisv71_2.c atmisv71_4.c
0253 
0254 --------------------------------------------------------------------------------
0255 
0256 
0257 EXIT STATUS
0258 -----------
0259 *0*::
0260 Success
0261 
0262 *1*::
0263 Failure
0264 
0265 BUGS
0266 ----
0267 Report bugs to support@mavimax.com
0268 
0269 SEE ALSO
0270 --------
0271 *buildclient(8)* *buildtms(8)* *ex_env(5)*
0272 
0273 COPYING
0274 -------
0275 (C) Mavimax, Ltd
0276