The tool flx_build_rtl can now be used to bootstrap Felix,
or build a cross compilation target.

At present a couple of the steps cannot be performed other
than by copying. Any combination of the steps can be performed.
        
        make rtlbuild

is an example (see the Makefile).

What this program can do is

        C++ compile the rtl
        Felix compile all the plugins
        Felix compile all the tools

using a specified OS/C++ compiler pair. By default,

        Darwin -> clang
        Linux -> gcc
        NT -> msvc

detected by "uname". Here is the help page:
===================================================
# locations

  --repo=repo               default: src
  --pkg=bootpkg
  --target-dir=target_dir     default: build/trial
  --target-bin=target_bin     default: host
  --source-dir=source_dir     default: build/release
  --source-bin=source_bin     default: host

# cleaning options

  --clean-target-dir          delete entire target directory
  --clean-target-bin-dir      delete target sub-directory
  --clean-target-bin-binaries delete binaries from target sub-directory (not 
implemented yet)

# copy options

  --copy-repo                 copy src dir of repository
  --copy-compiler             copy compiler flxg
  --copy-pkg-db               copy package database
  --copy-config-headers       copy C++ config headers
  --copy-version              copy Felix version file
  --copy-library              copy Felix library

# compilation options

  --build-rtl                 C++ compile the run time library
  --build-plugins             Felix compile the plugins
  --build-flx                 Felix compile flx
  --build-tools               Felix compile standard tools

  --debug                     do stuff verbosely

# Environment variables

FLX_SHELL_ECHO=1              echo all shell callouts (system, popen)

Purpuse: Build new Felix target

Requires repository 'repo' contain 'src'
Requires source_dir contain source_bin
Ensures target_dir contains:

  (a) Repository source
  (b) Share library
  (c) config db, C++ headers, libraries and executables

Copies version, flxg, config db, and C++ headers from source_dir if required
Compiles all C++ sources to libraries and executables
========================

Here is what the Makefile target "rtlbuild" says:


rtlbuild:
        build/release/host/bin/flx --test=build/release  
src/tools/flx_build_rtl \
                --repo=.\
                --target-dir=build/trial \
                --target-bin=host \
                --source-dir=build/release \
                --source-bin=host \
                --clean-target-dir \
                --clean-target-bin-dir \
                --copy-repo \
                --copy-compiler \
                --copy-pkg-db \
                --copy-config-headers \
                --copy-version \
                --copy-library \
                --build-rtl \
                --build-plugins \
                --build-flx \
                --build-tools


First, the location options specify the repository source with --repo=dir.
In the Makefile this is . however you can also specify something 
like --repo=build/release/share. The repository source is in the
subdirectory "src" (the Python build may not copy this in properly
which is why I'm using "." instead).

Next, you can specify the directory containing the new Felix system,
in this case build/trial, and the directory within that which names
the target. You could also specify an existing Felix build directory
like build/release and a new target like "debug". If you did that you'd have

        build/release/share  # shared stuff
        build/release/host   # standard host
        build/release/debug # debugging variant

Next, you can specify an existing Felix system directory and
target. This is can be used to copy the configuration from.
At present there is no program to help generate a configuration,
so we allow to copy an existing one. You can do this, then
edit it if required. The -bin prefix means "platform dependent
sources for Felix, C++ config headers, object files, libraries
and executables".

The actions are in three groups:

1. Cleaning: you can delete the whole Felix target system,
or just the target subdirectory, to make sure there's no crud in it.
If you're adding a new target to an existing build, use --clean-target-bin
not --clean-target-dir because the latter will scrub all your existing
targets and the share subdirectory as well!

2. Copying. You can copy the repository 'src' directory.

The flx_pkgconfig "config" directory
of *.fpc files (the package database), the C++ config headers
which have macros in them to condition builds to the
current platform can be copied because we have no config
program yet to generate a fresh config.

Note "flxg" HAS to be copied since this program cannot
run Ocaml compilations (yet).

The "version" copy action copies the
the version.flx file from the source share  library directory.
This is a generated file with just the version in it.
Its shared, but still generated.

The library target copies the Felix library to the target share subdirectory,
only of use if you're setting up a new top level Felix installation rather
than just adding a new target.

3. Compiling.
You can compile the rtl, the plugins, and the standard tools,
and the core tools. Core tools are flx, flx_pkgconfig and scoop.

The compiler used, and what is built, is controlled by

        --pkg==build_flx_rtl_clang_osx

which is an *.fpc file in the config directory set up for
clang and osx. You can also use linux and gcc,
all four combinations.

The package is like this:

~/felix>less src/config/build_flx_rtl_clang_osx.fpc
description: Build system bootstrap root.
toolchain: toolchain_clang_osx
compiler: clang
os: OSX
Requires: flx flx_gc flx_exceptions flx_pthread flx_async re2 sqlite3 
flx_dynlink demux faio

The list of libraries to build in the Requires clause is the key to the build
process. The toolchain field specifies which toolchain plugin to load
to drive the compilations (the compiler and os fields are just doco).

If you want to trace the callouts use

        FLX_SHELL_ECHO=1

environment variable. This prints commands going to system()
and popen() [in any Felix program not just the build tool]


Status
====

the tool has been working for a while, with some missing stuff.
Not all the exes are built. However I have been able to delete
build/release and replace it with build/trial, rebuild and repeat
several times, so the bootstrap reaches a fixpoint, and the
result can be installed an seems to work correctly.

The Felix build is preferred over the Python build (although
you have to run the Python one once to create the tools needed
to actually build the build tool .. :)

There is no optimisation: the tool builds everything.


--
john skaller
skal...@users.sourceforge.net
http://felix-lang.org




------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and 
their applications. This 200-page book is written by three acclaimed 
leaders in the field. The early access version is available now. 
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
Felix-language mailing list
Felix-language@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/felix-language

Reply via email to