tsj: major sophistication in the build_script generation phase