diff -N -r -u -b boost_1_34_0/tools/build/v2/build-system.jam boost_1_34_0_amiga/tools/build/v2/build-system.jam --- boost_1_34_0/tools/build/v2/build-system.jam 2007-03-14 21:02:25 +++ boost_1_34_0_amiga/tools/build/v2/build-system.jam 2007-05-12 19:51:16 @@ -113,6 +113,11 @@ site-path = [ modules.peek : SystemRoot ] $(user-path) ; } +if [ os.name ] = AMIGA +{ + site-path = /SDK/Local/Data $(user-path) ; +} + load-config site-config : $(site-path) ; # diff -N -r -u -b boost_1_34_0/tools/build/v2/tools/amiga.jam boost_1_34_0_amiga/tools/build/v2/tools/amiga.jam --- boost_1_34_0/tools/build/v2/tools/amiga.jam 2114-02-06 23:28:16 +++ boost_1_34_0_amiga/tools/build/v2/tools/amiga.jam 2007-06-02 13:35:07 @@ -0,0 +1,88 @@ +# Copyright 2007 Steven Solie +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + +# AmigaOS amiga.jam +# + +import toolset : flags ; +import property ; +import generators ; +import os ; +import type ; +import feature ; +import set ; +import common ; +import errors ; +import property-set ; + +toolset.register amiga ; + +import unix ; +toolset.inherit-generators amiga : unix ; +toolset.inherit-flags amiga : unix ; +toolset.inherit-rules amiga : unix ; + + +# Declare generators +generators.override amiga.searched-lib-generator : searched-lib-generator ; +generators.register-c-compiler amiga.compile.c : C : OBJ : amiga ; +generators.register-c-compiler amiga.compile.c++ : CPP : OBJ : amiga ; + + +rule init ( version ? : command * : options * ) +{ + local condition = [ common.check-init-parameters amiga : version $(version) ] ; + local command = [ common.get-invocation-command amiga : g++ : $(command) ] ; + + common.handle-options amiga : $(condition) : $(command) : $(options) ; + + flags amiga.link NEED_STRIP $(condition)/off : "" ; +} + + +# Declare flags and actions +flags amiga.compile OPTIONS off : -O0 ; +flags amiga.compile OPTIONS speed : -O3 ; +flags amiga.compile OPTIONS space : -Os ; +flags amiga.compile OPTIONS off : -fno-inline ; +flags amiga.compile OPTIONS on : -Wno-inline ; +flags amiga.compile OPTIONS full : -finline-functions -Wno-inline ; +flags amiga.compile OPTIONS off : -w ; +flags amiga.compile OPTIONS on : -Wall -Wwrite-strings ; +flags amiga.compile OPTIONS all : -Wall -Wwrite-strings -pedantic ; +flags amiga.compile OPTIONS on : -Werror ; +flags amiga.compile OPTIONS on : -ggdb ; +flags amiga.compile OPTIONS on : -pg ; +flags amiga.compile DEFINES ; +flags amiga.compile INCLUDES ; + +flags amiga.link OPTIONS on : -ggdb ; +flags amiga.link OPTIONS on : -pg ; +flags amiga.link LINKPATH ; +flags amiga.link LIBRARIES ; + + +actions compile.c +{ + "$(CONFIG_COMMAND)" -mcrt=clib2 $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)" +} + + +actions compile.c++ +{ + "$(CONFIG_COMMAND)" -mcrt=clib2 -ftemplate-depth-128 $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)" +} + + +actions link bind LIBRARIES +{ + $(CONFIG_COMMAND) -mcrt=clib2 $(OPTIONS) -L"$(LINKPATH)" -o "$(<)" "$(>)" "$(LIBRARIES)" -lstdc++ -lm -lunix + $(NEED_STRIP)strip $(NEED_STRIP)-R.comment $(NEED_STRIP)"$(<)" +} + + +actions piecemeal archive +{ + ar -crs "$(<:T)" "$(>:T)" +} diff -N -r -u -b boost_1_34_0/tools/build/v2/tools/builtin.jam boost_1_34_0_amiga/tools/build/v2/tools/builtin.jam --- boost_1_34_0/tools/build/v2/tools/builtin.jam 2007-03-14 21:02:24 +++ boost_1_34_0_amiga/tools/build/v2/tools/builtin.jam 2007-05-12 19:53:23 @@ -61,6 +61,7 @@ case MACOSX : host-os = darwin ; case KFREEBSD : host-os = freebsd ; case LINUX : host-os = linux ; + case AMIGA : host-os = amiga ; case * : host-os = unix ; } } diff -N -r -u -b boost_1_34_0/tools/build/v2/tools/common.jam boost_1_34_0_amiga/tools/build/v2/tools/common.jam --- boost_1_34_0/tools/build/v2/tools/common.jam 2007-04-01 17:51:15 +++ boost_1_34_0_amiga/tools/build/v2/tools/common.jam 2007-05-12 19:54:23 @@ -697,6 +697,7 @@ case cw : tag += cw ; case darwin* : tag += ; case edg* : tag += edg ; + case amiga* : tag += amiga ; case gcc* : { switch [ $(property-set).get ] diff -N -r -u -b boost_1_34_0/tools/build/v2/util/os.jam boost_1_34_0_amiga/tools/build/v2/util/os.jam --- boost_1_34_0/tools/build/v2/util/os.jam 2007-03-14 21:02:22 +++ boost_1_34_0_amiga/tools/build/v2/util/os.jam 2007-05-12 19:55:15 @@ -94,6 +94,10 @@ local home = [ environ HOMEDRIVE HOMEPATH ] ; .home-directories = $(home[1])$(home[2]) [ environ HOME ] [ environ USERPROFILE ] ; } +else if $(.name) = AMIGA +{ + .home-directories = ; # AmigaOS is single user only +} else { .home-directories = [ environ HOME ] ; diff -N -r -u -b boost_1_34_0/tools/build/v2/util/path.jam boost_1_34_0_amiga/tools/build/v2/util/path.jam --- boost_1_34_0/tools/build/v2/util/path.jam 2006-11-23 02:30:09 +++ boost_1_34_0_amiga/tools/build/v2/util/path.jam 2007-05-12 20:27:53 @@ -490,6 +490,16 @@ return [ native-UNIX $(result) ] ; } +rule native-AMIGA ( path ) +{ + return $(path) ; +} + +rule make-AMIGA ( native ) +{ + return [ native-UNIX $(native) ] ; +} + # # split-VMS: splits input native path into # device dir file (each part is optional), diff -N -r -u -b boost_1_34_0/tools/jam/src/build.jam boost_1_34_0_amiga/tools/jam/src/build.jam --- boost_1_34_0/tools/jam/src/build.jam 2006-07-23 09:24:21 +++ boost_1_34_0_amiga/tools/jam/src/build.jam 2007-05-12 20:22:39 @@ -164,6 +164,12 @@ [ opt --debug : -s -O3 -fno-inline -pg ] -I$(--python-include) : -L$(--python-lib[1]) -l$(--python-lib[2]) ; +## GCC 4.x on AmigaOS +toolset amiga gcc : "-mcrt=clib2 -o " : -D + : + [ opt --release : -O3 ] + [ opt --debug : -ggdb -O0 ] : + -lunix ; ## Intel C/C++ for Linux toolset intel-linux icc : "-o " : -D : @@ -402,6 +408,10 @@ { jam.source += execmac.c filemac.c pathmac.c ; } +else if $(AMIGA) +{ + jam.source += execamiga.c fileamiga.c pathamiga.c ; +} else { jam.source += execunix.c fileunix.c pathunix.c ; @@ -455,7 +465,7 @@ if $(NT) { actions piecemeal together existing [DELETE] { del /F /Q $(>) } } -if $(UNIX) { actions piecemeal together existing [DELETE] { +if $(UNIX) || $(AMIGA) { actions piecemeal together existing [DELETE] { rm -f $(>) } } if $(VMS) { actions piecemeal together existing [DELETE] { @@ -464,7 +474,7 @@ if $(NT) { --chmod+w = "attrib -r " ; } -if $(UNIX) { +if $(UNIX) || $(AMIGA) { --chmod+w = "chmod +w " ; } if $(VMS) { @@ -480,7 +490,7 @@ if $(NT) { actions [MKDIR] { md $(<) } } -if $(UNIX) { actions [MKDIR] { +if $(UNIX) || $(AMIGA) { actions [MKDIR] { mkdir $(<) } } if $(VMS) { actions [MKDIR] { @@ -526,10 +536,10 @@ return $(exe) ; } if ! $(--def[2]) { actions [COMPILE] { - "$(--cc)" $(--bin)$(<:D=) $(--dir)$(<:D) $(--out)$(<) $(--def)$(--defs) $(--flags) "$(--libs)" $(>) + "$(--cc)" $(--bin)$(<:D=) $(--dir)$(<:D) $(--out)$(<) $(--def)$(--defs) $(--flags) $(>) "$(--libs)" } } else { actions [COMPILE] { - "$(--cc)" $(--bin)$(<:D=) $(--dir)$(<:D) $(--out)$(<) $(--def[1])$(--defs:J=$(--def[2]))$(--def[3]) $(--flags) "$(--libs)" $(>) + "$(--cc)" $(--bin)$(<:D=) $(--dir)$(<:D) $(--out)$(<) $(--def[1])$(--defs:J=$(--def[2]))$(--def[3]) $(--flags) $(>) "$(--libs)" } } if $(VMS) { actions [COMPILE.LINK] { "$(--link)" $(--link-bin)$(<:D=) $(--link-dir)$(<:D) $(--link-out)$(<) $(--link-def)$(--link-defs) $(--link-flags) "$(--link-libs)" $(>J=", ") @@ -548,7 +558,7 @@ if $(NT) { actions [LINK] { copy $(>) $(<) } } -if $(UNIX) { actions [LINK] { +if $(UNIX) || $(AMIGA) { actions [LINK] { ln -fs $(>) $(<) } } if $(VMS) { actions [LINK] { @@ -564,7 +574,7 @@ del /f $(<) rename $(>) $(<) } } -if $(UNIX) { actions [MOVE] { +if $(UNIX) || $(AMIGA) { actions [MOVE] { mv -f $(>) $(<) } } if $(VMS) { actions [MOVE] { @@ -635,7 +645,7 @@ rename y.tab$(<[2]:S) $(<[2]) ) else set _error_ = } } -if $(UNIX) { actions [YACC] { +if $(UNIX) || $(AMIGA) { actions [YACC] { if ` "$(yacc)" $(>) ` ; then mv -f y.tab$(<[1]:S) $(<[1]) mv -f y.tab$(<[2]:S) $(<[2]) @@ -782,7 +792,7 @@ copy /Y "$(>)" "$(<)" >NUL: } } -if $(UNIX) +if $(UNIX) || $(AMIGA) { actions [PACK] { tar zcf "$(<)" "$(>)" @@ -800,13 +810,13 @@ { local zip = ; if $(NT) { zip = $($(<).exe:S=.zip) ; } - if $(UNIX) { zip = $($(<).exe:S=.tgz) ; } + if $(UNIX) || $(AMIGA) { zip = $($(<).exe:S=.tgz) ; } zip = $(zip:S=)-$(VERSION)-$(RELEASE)-$(platform)$(zip:S) ; DEPENDS $(zip) : $($(<).exe) ; DEPENDS dist : $(zip) ; #~ LOCATE on $(zip) = $(locate-target) ; if $(NT) { [ZIP] $(zip) : $($(<).exe) ; } - if $(UNIX) { [PACK] $(zip) : $($(<).exe) ; } + if $(UNIX) || $(AMIGA) { [PACK] $(zip) : $($(<).exe) ; } .clean $(zip) ; } @@ -828,7 +838,7 @@ local pack = ; if $(NT) { pack = $(dst-dir).zip ; } - if $(UNIX) { pack = $(dst-dir).tgz ; } + if $(UNIX) || $(AMIGA) { pack = $(dst-dir).tgz ; } DEPENDS dist : $(pack) ; DEPENDS $(pack) : $(dst-files) ; diff -N -r -u -b boost_1_34_0/tools/jam/src/build.sh boost_1_34_0_amiga/tools/jam/src/build.sh --- boost_1_34_0/tools/jam/src/build.sh 2006-02-03 09:57:42 +++ boost_1_34_0_amiga/tools/jam/src/build.sh 2007-05-12 20:00:14 @@ -29,8 +29,8 @@ echo "### ./build.sh gcc" echo "###" echo "### Toolsets supported by this script are:" - echo "### acc, como, darwin, gcc, intel-linux, kcc, kylix, mipspro," - echo "### mingw(msys), qcc, sunpro, tru64cxx, vacpp" + echo "### acc, amiga, como, darwin, gcc, intel-linux, kcc, kylix," + echo "### mipspro, mingw(msys), qcc, sunpro, tru64cxx, vacpp" echo "###" echo "### A special toolset; cc, is available which is used as a fallback" echo "### when a more specific toolset is not found and the cc command is" @@ -64,6 +64,7 @@ if test -r /mingw/bin/gcc ; then BOOST_JAM_TOOLSET=mingw BOOST_JAM_TOOLSET_ROOT=/mingw/ + elif test_uname AmigaOS; then BOOST_JAM_TOOLSET=amiga elif test_uname Darwin ; then BOOST_JAM_TOOLSET=darwin elif test_uname IRIX ; then BOOST_JAM_TOOLSET=mipspro elif test_uname IRIX64 ; then BOOST_JAM_TOOLSET=mipspro @@ -134,6 +135,11 @@ BOOST_JAM_CC=cc ;; + amiga) + BOOST_JAM_CC="gcc -mcrt=clib2" + BOOST_JAM_LIBS=-lunix + ;; + intel-linux) if test -r /opt/intel/cc/9.0/bin/iccvars.sh ; then BOOST_JAM_TOOLSET_ROOT=/opt/intel/cc/9.0/ @@ -233,7 +239,7 @@ strings.c filesys.c builtins.c pwd.c class.c native.c w32_getreg.c\ modules/set.c modules/path.c modules/regex.c modules/property-set.c\ modules/sequence.c modules/order.c\ - execnt.c filent.c" + execnt.c filent.c execamiga.c fileamiga.c pathamiga.c" BJAM_UPDATE= if test "$1" = "--update" -o "$2" = "--update" -o "$3" = "--update" -o "$4" = "--update" ; then @@ -247,7 +253,7 @@ echo_run rm -rf bootstrap echo_run mkdir bootstrap if test ! -r jamgram.y -o ! -r jamgramtab.h ; then - echo_run ${BOOST_JAM_CC} ${BOOST_JAM_OPT_YYACC} ${YYACC_SOURCES} + echo_run ${BOOST_JAM_CC} ${BOOST_JAM_OPT_YYACC} ${YYACC_SOURCES} ${BOOST_JAM_LIBS} if test -x "./bootstrap/yyacc0" ; then echo_run ./bootstrap/yyacc0 jamgram.y jamgramtab.h jamgram.yy fi @@ -261,12 +267,12 @@ mv -f y.tab.h jamgram.h fi if test ! -r jambase.c ; then - echo_run ${BOOST_JAM_CC} ${BOOST_JAM_OPT_MKJAMBASE} ${MKJAMBASE_SOURCES} + echo_run ${BOOST_JAM_CC} ${BOOST_JAM_OPT_MKJAMBASE} ${MKJAMBASE_SOURCES} ${BOOST_JAM_LIBS} if test -x "./bootstrap/mkjambase0" ; then echo_run ./bootstrap/mkjambase0 jambase.c Jambase fi fi - echo_run ${BOOST_JAM_CC} ${BOOST_JAM_OPT_JAM} ${BJAM_SOURCES} + echo_run ${BOOST_JAM_CC} ${BOOST_JAM_OPT_JAM} ${BJAM_SOURCES} ${BOOST_JAM_LIBS} fi if test -x "./bootstrap/jam0" ; then if test "${BJAM_UPDATE}" != "update" ; then diff -N -r -u -b boost_1_34_0/tools/jam/src/execamiga.c boost_1_34_0_amiga/tools/jam/src/execamiga.c --- boost_1_34_0/tools/jam/src/execamiga.c 2114-02-06 23:28:16 +++ boost_1_34_0_amiga/tools/jam/src/execamiga.c 2007-06-02 08:16:12 @@ -0,0 +1,204 @@ +/* + * This file is part of Jam - see jam.c for Copyright information. + */ + +#include "jam.h" + +#if defined(OS_AMIGA) + +#include "lists.h" +#include "execcmd.h" +#include "patchlevel.h" + +#include +#include + +#include +#include + +#include +#include +#include + +#define MAX_ENV_SIZE 1024 /* maximum number of environ entries */ + + +/* clib2 specific controls */ +int __minimum_os_lib_version = 52; +char * __minimum_os_lib_error = "Requires AmigaOS 4.0"; +BOOL __open_locale = FALSE; +BOOL __disable_dos_requesters = TRUE; + + +static const char* version __attribute__((used)) = + "$VER: bjam "VERSION"-1 (2.6.2007)"; /* dd.mm.yyyy */ + + +/* + * execamiga.c - execute a shell script + * + * Uses the abc-shell to execute all commands synchronously. + */ +void execcmd +( + char *string, + void (*func)(void *closure, int status, timing_info*), + void *closure, + LIST *shell +) +{ + timing_info time = {0, 0}; + + static char tmpbuf[128]; + tmpbuf[0] = '\0'; + strlcpy(tmpbuf, "/t/bjamXXXXXX", sizeof(tmpbuf)); + + int fd = mkstemp(tmpbuf); + if ( fd == -1 ) + { + printf("can't open command file\n"); + (*func)(closure, EXEC_CMD_FAIL, &time); + return; + } + + int len = strlen(string); + if ( write(fd, string, len) != len ) + { + printf("can't write command file\n"); + (*func)(closure, EXEC_CMD_FAIL, &time); + unlink(tmpbuf); + close(fd); + return; + } + + static char cmdbuf[128]; + cmdbuf[0] = '\0'; + snprintf(cmdbuf, sizeof(cmdbuf), "/sdk/c/sh %s", tmpbuf); + + if ( DEBUG_EXECCMD ) + { + printf("string = '%s'\n", string); + printf("cmdbuf = '%s'\n", cmdbuf); + } + + int status = system(cmdbuf); + + unlink(tmpbuf); + close(fd); + + if ( status == 0 ) + { + (*func)(closure, EXEC_CMD_OK, &time); + } + else + { + (*func)(closure, EXEC_CMD_FAIL, &time); + } +} + + +int execwait() +{ + return 0; +} + + +/* + * environ - AmigaOS environment support + * + * The following code implements environ support for AmigaOS. + */ +void make_environ() __attribute__((constructor)); +void free_environ() __attribute__((destructor)); + +char **environ = NULL; + + +int is_ascii_string(char* str) +{ + while ( *str != '\0' ) + { + if ( !isascii(*str) ) + { + return 0; + } + + ++str; + } + + return 1; +} + + +uint32 copy_env(struct Hook *hook, APTR data, struct ScanVarsMsg *msg) +{ + static uint32 env_size = 1; /* environ is null terminated */ + + if ( env_size == MAX_ENV_SIZE ) + { + return 0; + } + + if ( msg->sv_Name == 0 || + msg->sv_Var == 0 || + strlen(msg->sv_GDir) > 4 || /* excludes ENVARC: sub-directories */ + !is_ascii_string(msg->sv_Name) || + !is_ascii_string(msg->sv_Var) || + strstr(msg->sv_Name, ".prefs") != 0 || + strstr(msg->sv_Name, ".xml") != 0 || + strstr(msg->sv_Name, ".cfg") != 0 ) + + { + return 0; + } + + uint32 var_size = strlen(msg->sv_Name) + 1 + msg->sv_VarLen + 1; + char* var_buf = malloc(var_size); + if ( var_buf == 0 ) + { + return 0; + } + + snprintf(var_buf, var_size, "%s=%s", msg->sv_Name, msg->sv_Var); + + char **env = hook->h_Data; + env[env_size - 1] = var_buf; + ++env_size; + + return 0; +} + + +void make_environ() +{ + size_t environ_size = MAX_ENV_SIZE * sizeof(char*); + + environ = (char**)malloc(environ_size); + if ( environ == 0 ) + { + return; + } + + memset(environ, 0, environ_size); + + struct Hook hook; + memset(&hook, 0, sizeof(struct Hook)); + hook.h_Entry = copy_env; + hook.h_Data = environ; + (void) IDOS->ScanVars(&hook, 0, 0); +} + + +void free_environ() +{ + char **i; + for ( i = environ; *i != 0; ++i ) + { + free(*i); + } + + free(environ); +} + + +#endif diff -N -r -u -b boost_1_34_0/tools/jam/src/execnt.c boost_1_34_0_amiga/tools/jam/src/execnt.c --- boost_1_34_0/tools/jam/src/execnt.c 2006-07-24 22:50:44 +++ boost_1_34_0_amiga/tools/jam/src/execnt.c 2007-05-12 19:56:17 @@ -40,7 +40,7 @@ * If $(JAMSHELL) is defined, uses that to formulate execvp()/spawnvp(). * The default is: * - * /bin/sh -c % [ on UNIX/AmigaOS ] + * /bin/sh -c % [ on UNIX ] * cmd.exe /c % [ on Windows NT ] * * Each word must be an individual element in a jam variable value. diff -N -r -u -b boost_1_34_0/tools/jam/src/execunix.c boost_1_34_0_amiga/tools/jam/src/execunix.c --- boost_1_34_0/tools/jam/src/execunix.c 2005-10-16 08:34:27 +++ boost_1_34_0_amiga/tools/jam/src/execunix.c 2007-05-12 19:56:29 @@ -23,12 +23,12 @@ # endif /* - * execunix.c - execute a shell script on UNIX/WinNT/OS2/AmigaOS + * execunix.c - execute a shell script on UNIX/WinNT/OS2 * * If $(JAMSHELL) is defined, uses that to formulate execvp()/spawnvp(). * The default is: * - * /bin/sh -c % [ on UNIX/AmigaOS ] + * /bin/sh -c % [ on UNIX ] * cmd.exe /c % [ on OS2/WinNT ] * * Each word must be an individual element in a jam variable value. diff -N -r -u -b boost_1_34_0/tools/jam/src/fileamiga.c boost_1_34_0_amiga/tools/jam/src/fileamiga.c --- boost_1_34_0/tools/jam/src/fileamiga.c 2114-02-06 23:28:16 +++ boost_1_34_0_amiga/tools/jam/src/fileamiga.c 2007-06-02 08:11:27 @@ -0,0 +1,132 @@ +/* + * This file is part of Jam - see jam.c for Copyright information. + */ + +#include "jam.h" + +#if defined(OS_AMIGA) + +#include "filesys.h" +#include "strings.h" +#include "pathsys.h" + +#include +#include +#include +#include + +/* + * fileamiga.c - manipulate file names and scan directories on AmigaOS + * + * External routines: + * + * file_dirscan() - scan a directory for files + * file_time() - get timestamp of file, if not done by file_dirscan() + * file_archscan() - scan an archive for files + * + * File_dirscan() and file_archscan() call back a caller provided function + * for each file found. A flag to this callback function lets file_dirscan() + * and file_archscan() indicate that a timestamp is being provided with the + * file. If file_dirscan() or file_archscan() do not provide the file's + * timestamp, interested parties may later call file_time(). + */ + +/* + * file_dirscan() - scan a directory for files + */ +void file_dirscan(char *dir, scanback func, void *closure) +{ + PATHNAME f; + DIR *d; + struct dirent *dirent; + string filename[1]; + + /* First enter directory itself */ + memset((char*)&f, '\0', sizeof(f)); + f.f_dir.ptr = dir; + f.f_dir.len = strlen(dir); + + dir = *dir ? dir : "."; + + /* Special case / : enter it */ + if ( f.f_dir.len == 1 && f.f_dir.ptr[0] == '/' ) + { + (*func)(closure, dir, 0 /* not stat()'ed */, (time_t)0); + } + + /* Now enter contents of directory */ + if ( !(d = opendir(dir)) ) + { + return; + } + + if ( DEBUG_BINDSCAN ) + { + printf("scan directory %s\n", dir); + } + + string_new(filename); + + while ( dirent = readdir(d) ) + { + f.f_base.ptr = dirent->d_name; + f.f_base.len = strlen(f.f_base.ptr); + + string_truncate(filename, 0); + path_build(&f, filename, 0); + + (*func)(closure, filename->value, 0 /* not stat()'ed */, (time_t)0); + } + + string_free(filename); + + closedir(d); +} + + +/* + * file_time() - get timestamp of file, if not done by file_dirscan() + */ +int file_time(char *filename, time_t *time) +{ + struct stat statbuf; + + if ( stat(filename, &statbuf) < 0 ) + { + return -1; + } + + *time = statbuf.st_mtime; + + return 0; +} + + +int file_is_file(char* filename) +{ + struct stat statbuf; + + if( stat( filename, &statbuf ) < 0 ) + { + return -1; + } + + if (S_ISREG(statbuf.st_mode)) + { + return 1; + } + else + { + return 0; + } +} + + +/* + * file_archscan() - scan an archive for files + */ +void file_archscan(char *archive, scanback func, void *closure ) +{ +} + +#endif diff -N -r -u -b boost_1_34_0/tools/jam/src/fileunix.c boost_1_34_0_amiga/tools/jam/src/fileunix.c --- boost_1_34_0/tools/jam/src/fileunix.c 2005-10-16 08:34:27 +++ boost_1_34_0_amiga/tools/jam/src/fileunix.c 2007-05-12 19:56:35 @@ -99,7 +99,7 @@ # endif /* - * fileunix.c - manipulate file names and scan directories on UNIX/AmigaOS + * fileunix.c - manipulate file names and scan directories on UNIX * * External routines: * diff -N -r -u -b boost_1_34_0/tools/jam/src/jam.h boost_1_34_0_amiga/tools/jam/src/jam.h --- boost_1_34_0/tools/jam/src/jam.h 2005-10-16 08:34:27 +++ boost_1_34_0_amiga/tools/jam/src/jam.h 2007-05-12 20:01:13 @@ -205,6 +205,23 @@ # endif /* + * AmigaOS SDK + */ +# if defined(__amigaos__) + +# include +# include +# include +# include + +# define OSMAJOR "AMIGA=true" +# define OSMINOR "OS=AMIGA" +# define OS_AMIGA +# define PATH_DELIM '/' + +# endif + +/* * God fearing UNIX */ @@ -222,10 +239,6 @@ # define OS_AIX # define NO_VFORK # endif -# ifdef AMIGA -# define OSMINOR "OS=AMIGA" -# define OS_AMIGA -# endif # ifdef __BEOS__ # define unix # define OSMINOR "OS=BEOS" diff -N -r -u -b boost_1_34_0/tools/jam/src/Jambase boost_1_34_0_amiga/tools/jam/src/Jambase --- boost_1_34_0/tools/jam/src/Jambase 2006-03-15 01:43:12 +++ boost_1_34_0_amiga/tools/jam/src/Jambase 2007-05-12 20:03:48 @@ -854,6 +854,22 @@ NOARSCAN ?= true ; STDHDRS ?= /boot/develop/headers/posix ; } +else if $(OS) = AMIGA +{ + BINDIR ?= /sdk/local/c ; + C++ ?= g++ ; + C++FLAGS ?= -mcrt=clib2 ; + CC ?= gcc ; + CCFLAGS ?= -mcrt=clib2 ; + EXEMODE ?= ; + FILEMODE ?= ; + LIBDIR ?= /sdk/local/clib2/lib ; + LINKLIBS ?= -lunix ; + NOARSCAN ?= true ; + YACC ?= yacc ; + YACCFILES ?= y.tab ; + YACCFLAGS ?= -d ; +} else if $(UNIX) { switch $(OS) @@ -861,10 +877,6 @@ case AIX : LINKLIBS ?= -lbsd ; - case AMIGA : - CC ?= gcc ; - YACC ?= "bison -y" ; - case CYGWIN : CC ?= gcc ; CCFLAGS += -D__cygwin__ ; @@ -2433,6 +2445,18 @@ } # +# AmigaOS specific actions +# + +else if $(AMIGA) +{ + actions Link bind NEEDLIBS + { + $(LINK) $(LINKFLAGS) -o $(<) $(UNDEFS) $(>) $(NEEDLIBS) $(LINKLIBS) -lunix + } +} + +# # Backwards compatibility with jam 1, where rules were uppercased. # diff -N -r -u -b boost_1_34_0/tools/jam/src/jambase.c boost_1_34_0_amiga/tools/jam/src/jambase.c --- boost_1_34_0/tools/jam/src/jambase.c 2006-03-15 01:43:12 +++ boost_1_34_0_amiga/tools/jam/src/jambase.c 2007-05-12 20:09:58 @@ -555,15 +555,28 @@ "NOARSCAN ?= true ;\n", "STDHDRS ?= /boot/develop/headers/posix ;\n", "}\n", +"else if $(OS) = AMIGA\n", +"{\n", +"BINDIR ?= /sdk/local/c ;\n", +"C++ ?= g++ ;\n", +"C++FLAGS ?= -mcrt=clib2 ;\n", +"CC ?= gcc ;\n", +"CCFLAGS ?= -mcrt=clib2 ;\n", +"EXEMODE ?= ;\n", +"FILEMODE ?= ;\n", +"LIBDIR ?= /sdk/local/clib2/lib ;\n", +"LINKLIBS ?= -lunix ;\n", +"NOARSCAN ?= true ;\n", +"YACC ?= yacc ;\n", +"YACCFILES ?= y.tab ;\n", +"YACCFLAGS ?= -d ;\n", +"}\n", "else if $(UNIX)\n", "{\n", "switch $(OS)\n", "{\n", "case AIX :\n", "LINKLIBS ?= -lbsd ;\n", -"case AMIGA :\n", -"CC ?= gcc ;\n", -"YACC ?= \"bison -y\" ;\n", "case CYGWIN : \n", "CC ?= gcc ;\n", "CCFLAGS += -D__cygwin__ ;\n", @@ -1660,6 +1673,13 @@ "$(LINK) -o $(<) $(LINKFLAGS) $(>) $(NEEDLIBS) \"$(LINKLIBS)\"\n", "}\n", "}\n", +"else if $(AMIGA)\n", +"{\n", +"actions Link bind NEEDLIBS\n", +"{\n", +"$(LINK) $(LINKFLAGS) -o $(<) $(UNDEFS) $(>) $(NEEDLIBS) $(LINKLIBS) -lunix\n", +"}\n", +"}\n", "rule BULK { Bulk $(<) : $(>) ; }\n", "rule FILE { File $(<) : $(>) ; }\n", "rule HDRRULE { HdrRule $(<) : $(>) ; }\n", diff -N -r -u -b boost_1_34_0/tools/jam/src/pathamiga.c boost_1_34_0_amiga/tools/jam/src/pathamiga.c --- boost_1_34_0/tools/jam/src/pathamiga.c 2114-02-06 23:28:16 +++ boost_1_34_0_amiga/tools/jam/src/pathamiga.c 2007-06-02 08:10:21 @@ -0,0 +1,208 @@ +/* + * This file is part of Jam - see jam.c for Copyright information. + */ + +#include "jam.h" + +#if defined(OS_AMIGA) + +#include "pathsys.h" +#include "strings.h" +#include "newstr.h" +#include "filesys.h" + +#include +#include + + +/* + * pathamiga.c - manipulate file names on AmigaOS + * + * External routines: + * + * path_parse() - split a file name into dir/base/suffix/member + * path_build() - build a filename given dir/base/suffix/member + * path_parent() - make a PATHNAME point to its parent dir + * + * file_parse() and path_build() just manipuate a string and a structure; + * they do not make system calls. + */ + + +/* + * path_parse() - split a file name into dir/base/suffix/member + */ +void path_parse(char *file, PATHNAME *f) +{ + char *p, *q; + char *end; + + memset( (char *)f, 0, sizeof( *f ) ); + + /* Look for */ + if( file[0] == '<' && ( p = strchr( file, '>' ) ) ) + { + f->f_grist.ptr = file; + f->f_grist.len = p - file; + file = p + 1; + } + + /* Look for dir/ */ + p = strrchr( file, '/' ); + + if( p ) + { + f->f_dir.ptr = file; + f->f_dir.len = p - file; + + /* Special case for / - dirname is /, not "" */ + if( !f->f_dir.len ) + f->f_dir.len = 1; + + file = p + 1; + } + + end = file + strlen( file ); + + /* Look for (member) */ + if( ( p = strchr( file, '(' ) ) && end[-1] == ')' ) + { + f->f_member.ptr = p + 1; + f->f_member.len = end - p - 2; + end = p; + } + + /* Look for .suffix */ + /* This would be memrchr() */ + p = 0; + q = file; + + while( q = (char *)memchr( q, '.', end - q ) ) + p = q++; + + if( p ) + { + f->f_suffix.ptr = p; + f->f_suffix.len = end - p; + end = p; + } + + /* Leaves base */ + f->f_base.ptr = file; + f->f_base.len = end - file; +} + + +/* + * is_path_delim() - true iff c is a path delimiter + */ +static int is_path_delim(char c) +{ + return c == PATH_DELIM; +} + + +/* + * as_path_delim() - convert c to a path delimiter if it isn't one + * already + */ +static char as_path_delim( char c ) +{ + return is_path_delim(c) ? c : PATH_DELIM; +} + + +/* + * path_build() - build a filename given dir/base/suffix/member + */ +void path_build(PATHNAME *f, string *file, int binding) +{ + file_build1( f, file ); + + /* Don't prepend root if it's . or directory is rooted */ + if( f->f_root.len + && !( f->f_root.len == 1 && f->f_root.ptr[0] == '.' ) + && !( f->f_dir.len && f->f_dir.ptr[0] == '/' ) ) + { + string_append_range( file, f->f_root.ptr, f->f_root.ptr + f->f_root.len ); + /* If 'root' already ends with path delimeter, don't add yet another one. */ + if( ! is_path_delim( f->f_root.ptr[f->f_root.len-1] ) ) + string_push_back( file, as_path_delim( f->f_root.ptr[f->f_root.len] ) ); + } + + if( f->f_dir.len ) + { + string_append_range( file, f->f_dir.ptr, f->f_dir.ptr + f->f_dir.len ); + } + + /* Put / between dir and file */ + if( f->f_dir.len && ( f->f_base.len || f->f_suffix.len ) ) + { + /* Special case for dir / : don't add another / */ + if( !( f->f_dir.len == 1 && is_path_delim( f->f_dir.ptr[0] ) ) ) + string_push_back( file, as_path_delim( f->f_dir.ptr[f->f_dir.len] ) ); + } + + if( f->f_base.len ) + { + string_append_range( file, f->f_base.ptr, f->f_base.ptr + f->f_base.len ); + } + + if( f->f_suffix.len ) + { + string_append_range( file, f->f_suffix.ptr, f->f_suffix.ptr + f->f_suffix.len ); + } + + if( f->f_member.len ) + { + string_push_back( file, '(' ); + string_append_range( file, f->f_member.ptr, f->f_member.ptr + f->f_member.len ); + string_push_back( file, ')' ); + } +} + + +/* + * path_parent() - make a PATHNAME point to its parent dir + */ +void path_parent(PATHNAME *f) +{ + f->f_base.ptr = ""; + f->f_suffix.ptr = ""; + f->f_member.ptr = ""; + + f->f_base.len = 0; + f->f_suffix.len = 0; + f->f_member.len = 0; +} + + +const char * path_tmpdir() +{ + return "\t"; +} + + +const char * path_tmpnam(void) +{ + static char tmpbuf[64]; + uint32 pid = ((struct Process*)IExec->FindTask(0))->pr_ProcessID; + snprintf(tmpbuf, sizeof(tmpbuf), "jam.%u.XXXXXX", pid); + (void) mktemp(tmpbuf); + + return newstr(tmpbuf); +} + + +const char * path_tmpfile(void) +{ + const char * result = 0; + + static char pathbuf[4096]; + snprintf(pathbuf, sizeof(pathbuf), "%s%c%s", + path_tmpdir(), PATH_DELIM, path_tmpnam()); + + return newstr(pathbuf); +} + +#endif diff -N -r -u -b boost_1_34_0/tools/jam/src/pathunix.c boost_1_34_0_amiga/tools/jam/src/pathunix.c --- boost_1_34_0/tools/jam/src/pathunix.c 2006-05-25 01:14:57 +++ boost_1_34_0_amiga/tools/jam/src/pathunix.c 2007-05-12 19:56:48 @@ -25,7 +25,7 @@ # ifdef USE_PATHUNIX /* - * pathunix.c - manipulate file names on UNIX, NT, OS2, AmigaOS + * pathunix.c - manipulate file names on UNIX, NT, OS2 * * External routines: * @@ -458,4 +458,4 @@ } -# endif /* unix, NT, OS/2, AmigaOS */ +# endif /* unix, NT, OS/2 */