Installing Bob - JeffBerman/Bob GitHub Wiki

How to install Better Object Builder

Install IBM i prerequisites

Some software needs to be installed on the IBM i before Bob can be installed. Please follow the instructions to install prerequisites before continuing here.

Install Better Object Builder

Installation of Bob consists merely of copying the Bob folder into a directory in the IFS, setting an environment variable to point to its location, and issuing some commands to install helper tools.

Copy Bob to the IFS

The Bob folder needs to be copied to a directory in the IFS. It doesn't matter where, but a good option is to create directory /Build and place it in there, alongside all the other projects that will be built. This results in a folder structure like this:

/Build
/Build/Bob
/Build/your-project-1
/Build/your-project-2

Copy Bob to this directory either via Windows Explorer (PC) or Finder (Mac), or by cloning the project (if Git is installed):

$ mkdir /Build
$ cd /Build
$ git clone --recursive https://github.com/s4isystems/Bob.git

Set the character encoding parameters

To properly build objects, Bob needs to know the CCSID used for source files and the CCSID used when the IBM i outputs data. This is controlled by several parameters in the IBMiMake makefile, in the Bob folder on the IBM i. Bob ships with these default values: source files are expected to be encoded in UTF-8, and IBM i text output is encoded in EBCDIC 37. This is configurable, however, by adjusting the following lines:

ICONV := /QOpenSys/usr/bin/iconv
ICONV_EBCDIC := IBM-037
ICONV_ASCII := UTF-8
SETCCSID_ASCII := 1208
  • ICONV sets the location of the iconv text conversion utility that ships with PASE. Bob uses iconv to convert pieces of compiler output from EBCDIC to an ASCII-like encoding. It is uncommon to need to change this setting.
  • ICONV_EBCDIC specifies what argument should be used with the iconv tool to reference the flavor of EBCDIC used on the system. Available encodings can be seen by issuing this command from a shell: /QOpenSys/usr/bin/iconv -l.
  • ICONV_ASCII specifies what argument should be used with the iconv tool to reference the ASCII-like encoding used for source files in your environment. Available encodings can be seen by issuing this command from a shell: /QOpenSys/usr/bin/iconv -l.
  • SETCCSID_ASCII represents the actual CCSID number that corresponds with the ICONV_ASCII setting. For example, UTF-8 is CCSID 1208, ISO 8859-1 is CCSID 819, and Windows Latin-1 is CCSID 1252. Before issuing a compile instruction, Bob sets each source file's CCSID attribute to this value to insure that source files are correctly converted to EBCDIC by the IBM compiler.

Set the target CCSID for compiled objects

The RPG and C compilers provide a TGTCCSID parameter that specify what CCSID to compile the module to, and (at least for RPG) what CCSID Unicode source code should be internally converted to before compiling. The IBMiMake file includes a setting to specify this value:

TGTCCSID := *JOB

Bob ships with a default value of *JOB, but this can be changed to any value supported by the TGTCCSID parameter on the CRTRPGMOD and CRTCMOD compiler commands.

Set the IBMIMAKE environment variable

Bob looks for an environment variable named IBMIMAKE to tell it the location of its IBMiMake makefile, which resides in the Bob folder installed in the previous step. When the IBM i prerequisites were installed, a /QOpenSys/etc/profile file was created and populated. Add the creation of the environment variable by copying the following into the profile file:

# Set environment variable for Bob build system
IBMIMAKE='/Build/Bob/IBMiMake' # Location of IBMiMake makefile
export IBMIMAKE

Install helper tools

Included in the Bob folder is source code for CRTFRMSTMF, a tool to help compile source code in the IFS for objects that normally don't allow this; and ExecWLibs, a tool that executes a command after adding a set of libraries to the library list. Compile them into library BOBTOOLS:

===> CRTLIB LIB(BOBTOOLS) TEXT('Bob helper tools')
===> QSH CMD('cd /Build/Bob/crtfrmstmf && /Build/Bob/shelic BOBTOOLS')
===> QSH CMD('cd /Build/Bob/ExecWLibs && /Build/Bob/shelic BOBTOOLS')

Hooray! The Bob build system is now installed. It can now be used from a command line (QP2TERM or SSH) to compile software.

Build the sample project

Now that everything is installed and configured, let's build the included sample project.

  1. First create a library to build to.

    ===> CRTLIB LIB(BOBTEST) TEXT('Better Object Builder test project')
    
  2. Switch to a shell and issue the command to build the sample project.

    $ ssh ibmi01
    $ make all OBJPATH:=/QSYS.LIB/BOBTEST.LIB -f '/Build/Bob/sample-project/Makefile'
    
  3. You should see output similar to this.

    Using IBMiMake file: /Build/Bob/IBMiMake
    IBMiMake log directory: /Build/Bob/sample-project/Logs/2017-06-02_16.33.17-Fri
    *** Creating PF [TEST01]
    *** Creating LF [TEST01A]
    *** Creating command [BOBTEST]
    *** Creating RPG module [TEST010]
    *** Creating program [TEST010] from modules [TEST010] and service programs []
    
    
    ***
    *** Source directory:   /Build/Bob/sample-project
    *** Target library:     BOBTEST
    *** Compile listings:   /Build/Bob/sample-project/Logs/2017-06-02_16.33.17-Fri
    ***
    ***           * * * * *   B u i l d   S u c c e s s f u l !   * * * * *
    
    ===> DSPLIB BOBTEST
    
                                    Display Library
    
     Library  . . . . . . :   BOBTEST         Number of objects  . :   6
     Type . . . . . . . . :   PROD            Library ASP number . :   1
     Create authority . . :   *SYSVAL         Library ASP device . :   *SYSBAS
                                             Library ASP group  . :   *SYSBAS
     
     Type options, press Enter.
     5=Display full attributes   8=Display service attributes
    
     Opt  Object      Type      Attribute               Size  Text                 
         TEST010     *PGM      RPGLE                 126976                       
         TEST010     *MODULE   RPGLE                 106496                       
         EVFEVENT    *FILE     PF                     77824                       
         TEST01      *FILE     PF                     61440                       
         TEST01A     *FILE     LF                     61440                       
         BOBTEST     *CMD                              8192                       
                                                                                 
                                                                                 
                                                                                 
                                                                                 
                                                                             Bottom
     F3=Exit   F12=Cancel   F17=Top   F18=Bottom