Notes on making FB releases

- Making an FB release means:
  - Ensuring that the development version is in reasonable/usable state.
  - Updating the documentation (Wiki and man page) for language/compiler changes and new features, if not yet done.
  - Choosing and preparing gcc toolchains/build environments for DOS, Linux x86, Linux x86_64, Win32, Win64.
  - Compiling the development version of FB for all of them.
  - Building the Win32 installer (`contrib/nsis-installer/`).
  - Testing the builds to ensure they are basically working.
  - Synchronizing the online Wiki with the Wiki files in the fbc Git repository.
  - Regenerating the PrintToc and CompilerErrMsg pages.
  - Regenerating the examples/manual/ directory (code examples from the Wiki).
  - Compiling the offline documentation (CHM, HTML, text).
  - Creating the release packages (source code, binary builds, documentation).
  - Uploading them and source code of dependencies (binutils, gcc, MinGW, DJGPP, ...) to fbc's download site on SourceForge.
  - Announcing the new release on freebasic.net, in freebasic.net/forum News, and in SourceForge fbc project News.
- When making a new release, please check that the source code for the new release can be compiled using at least the compiler from the previous release. Ideally it is compilable with even older versions. This way we can ensure that fbc can always be bootstrapped using the last release.
- FB releases in form of prebuilt binaries should be made at least for DOS, Linux, and Win32.
- The DOS and Win32 packages traditionally are standalone builds coming with prebuilt binutils and MinGW/DJGPP libraries.
- The Linux package traditionally is a normal build intended to be installed into `/usr` or `/usr/local` and uses the system's binutils/libraries.
- All the binary packages must be built from the same source revision.
- The source must be packaged and uploaded in parallel to the binary packages.
- All the to-be-released fbc binaries should be built with the same date, preferably on the same day the release is published. It's confusing to have multiple fbcs each with the same version number but different dates; are they the same version or not?
- All the binary packages should include a build.txt file describing the gcc/binutils toolchain used for the build and the tools/libraries included in the FB package.
- Run the test suite for every release build/package to ensure everything basically works.
- Test all compilation modes (exe, dll, profiling, ...) to ensure everything basically works.
- Run every .exe (binutils etc.) included in the packages to ensure that no DLLs are missing
- Check that globbing works ok for Windows builds (all included .exe's and new generated ones too),

because it depends on the configuration of the MinGW-w64 runtime.

- Linux packages must be `.tar.gz`, Windows/DOS packages must be `.zip`. Other formats such as `.tar.xz` or `.7z` should be offered additionally, but note that there are people with e.g. older GNU/Linux systems that don't know `.tar.lzma` or `.tar.xz`, or with Windows systems that don't have 7-zip installed.

Packaging and Manifests
The FB makefile offers the `gitdist` command for packaging the source code via `git archive`, and the `bindist` command for packaging previously built binaries. Example workflow:

    # Go to fbc Git clone
    cd fbc

    # Compile FB
    make

    # Package the source code
    make gitdist

    # Package the binaries, regenerate the manifest
    make bindist

    # Check the manifest
    git diff

`gitdist` creates source tarballs in multiple formats. It assumes that all changes to the fbc source code used for building the release have been committed to Git.
`bindist` creates the needed binary archive(s), potentially in multiple formats, with the proper package name and directory layout depending on the target platform and whether it's a normal or standalone build, and it (re)generates the corresponding manifest (list of all files included in the archive) in the `contrib/manifest/` directory in the fbc source tree.
By checking the manifest differences via Git (git diff, git gui, etc.) you can check whether any files are missing in comparison to the previous release, or whether files were added that should not be included. Should there be any such issues, they may need to be fixed manually (possible the makefile's `bindist` implementation needs updating, or you simply need to copy in missing files), after which `make bindist` can be run again to recreate the package and update the manifest again.
`bindist` configuration options:

- `TARGET_OS`/`TARGET_ARCH` makefile variables: You can set `TARGET_OS` and/or `TARGET_ARCH` on the make command line to override the makefile's default uname check. This is useful if you want to package for a different system than what the uname command returns. For example, packaging the FB-dos release from a MinGW/MSYS shell (with MSYS tools instead of DJGPP tools):

    make bindist TARGET_OS=dos

- `FBPACKAGE` makefile variable: Package/archive file name without path or extension. Defaults:
  - Linux/BSD normal, Windows/DOS standalone: `FreeBASIC-x.xx.x-target`
  - Linux/BSD standalone: `FreeBASIC-x.xx.x-target-standalone`
  - Windows/DOS normal (MinGW/DJGPP-style packages): `fbc-x.xx.x-target`
- `FBPACKSUFFIX` makefile variable: Suffix string that will be appended to the package name (and the toplevel directory in the archive).
- `FBMANIFEST` makefile variable: Manifest file name without path or extension. The defaults are the same as for `FBPACKAGE`, except without the `-x.xx.x` version number part.
- `FBVERSION` makefile variable: Is already set in the makefile, but you can override it if you want to (e.g. when making testing releases instead of "official" releases). For example: `FBVERSION=0.90.1` or `FBVERSION=0.90.1rc1`
- `DISABLE_DOCS=1` makefile variable: If this variable is set, `bindist` will exclude documentation (readme, changelog, man page) and examples from the package. This is useful when creating small binary-only fbc packages such as those for installation into DJGPP/MinGW trees.

Toolchain/build environment
When making an FB release, the GCC toolchain used to build FB has a huge impact, because FB itself will basically become a modified/extended version of that toolchain. The FB-dos and FB-win32 releases include libraries from the used DJGPP/MinGW toolchains, and they will be used for any FB programs made with those FB builds. Even the FB-linux release will depend on the gcc/glibc version it was built with, because of the precompiled rtlib/gfxlib2 libraries, and because of fbc which will have been linked against shared libraries that may not exist on other systems.
Additionally, different GCC toolchains and runtime libraries (e.g. MinGW.org vs. MinGW-w64, or DJGPP 2.03 vs. 2.04 vs. CVS) can be more or less different in terms of ABI compatibility or runtime behaviour. As such any FB program can behave differently depending on the GCC toolchain, including fbc itself.
More information:
Known problems when compiling FB
GCC toolchain choice
FB manual/documentation

- See also doc/fbchkdoc/readme.txt and doc/manual/readme.txt
- Get MySQL, libcurl, libaspell, libpcre
- Build the wiki tools:

`cd doc/libfbdoc`
`make`
`cd ../fbdoc`
`make`
`cd ../fbchkdoc`
`make`
`cd ../makefbhelp`
`make`

- Update the wiki cache (the offline copy of the *.wakka files)

`cd doc/manual`
`rm -f cache/*`
`make refresh`

- Regenerate the PrintToc page:

`cd doc/fbchkdoc`
`./mkprntoc -web`

- Regenerate the CompilerErrMsg page:

`cd doc/fbchkdoc`
`./mkerrlst`
`fbc mkerrtxt.bas -exx`
`./mkerrtxt > errors.wakka`
Then copy the error list from errors.wakka into doc/manual/cache/CompilerErrMsg.wakka, and update the online wiki too.

- Update the wiki samples in examples/manual/ (may want to clear out the old ones first, to delete those removed from the wiki)

`cd doc/fbchkdoc`
`./getindex -web`
`./samps extract @PageIndex.txt`