Normal vs. Standalone FreeBASIC

FreeBASIC

Normal vs. Standalone FreeBASIC
 
When built from source, FreeBASIC can be configured for and installed in one of these two different setups:

Normal build (default)
Standalone build
 
Normal directory layout:
  • bin/
    • fbc.exe
    • [<target>-]ld.exe
    • other tools for native/cross compilation...
  • include/
    • freebasic/
      • fbgfx.bi
      • other headers...
  • lib/
    • freebasic/
      • <target>/
        • libfb.a
        • other libraries...
Standalone directory layout:
  • bin/
    • <target>/
      • ld.exe
      • other tools...
  • inc/
    • fbgfx.bi
    • other headers...
  • lib/
    • <target>/
      • libfb.a
      • other libraries...
  • fbc.exe
 
Differences to the standalone build:

  • fbc is located in bin/, like other programs
  • looks for includes in include/freebasic/, instead of inc/, to cleanly separate FB headers from system headers
  • looks for its own libraries in lib/freebasic/ instead of lib/, to cleanly separate FB libraries from system libraries
  • looks for binutils/gcc 1) in bin/ and 2) by relying on PATH
  • looks for crt/gcc libraries 1) in lib/freebasic/ and 2) by running "gcc -print-file-name=..."
  • -target option accepts system triplets such as "i686-pc-linux-gnu" or "x86_64-w64-mingw32"
  • the target name given to the -target option is prepended to the gcc/binutils program names when cross-compiling
  • compatible with the standard /usr or /usr/local directories
  • typically used for the FB-linux release
  • uses windres from binutils to compile win32 resource scripts

This makes the normal FB build integrate with GNU/Linux distributions and other Unix-like systems pretty well, allows fbc to be installed into MinGW or DJGPP trees next to gcc, and allows fbc to work with binutils/gcc cross-compiling toolchains.
Differences to the normal build:

  • the fbc binary is located at the toplevel, not inside bin/
  • looks for tools inside bin/<target>/, i.e. it uses bin/<target>/ld.exe instead of bin/[<target>-]ld.exe
  • looks for FB includes in inc/, not in include/freebasic/
  • looks for libraries in lib/, not in lib/freebasic/
  • does not try to rely on PATH and use system tools
  • does not try to query gcc to find files
  • -target only accepts simple FB target names, no system triplets
  • typically used for the FB-dos and FB-win32 releases
  • uses GoRC to compile win32 resource scripts

The standalone build is intended to be used for self-contained installations such as the traditional FB-win32 and FB-dos releases. It also allows adding fbc to the PATH, without having to add the whole bin/ directory.