GitLab has been upgraded to 13.11.3 If you encounter any issues mail code@riscosopen.org

Commit 0ba4aa30 authored by Richard Buckley's avatar Richard Buckley
Browse files

This commit was generated by cvs2git to track changes on a CVS vendor branch.

parents d6710134 3c7e339d
......@@ -13,4 +13,4 @@
| limitations under the License.
|
Dir <Obey$Dir>
amu_machine all
amu_machine all THROWBACK=-throwback
......@@ -13,4 +13,4 @@
| limitations under the License.
|
Dir <Obey$Dir>
amu_machine install
amu_machine install THROWBACK=-throwback INSTALL_DIR=ADFS::OffRoad.$.Apps
......@@ -40,11 +40,13 @@ LD = link
RM = remove
WIPE = -wipe
CD = dir
CHMOD = access
AFLAGS = -depend !Depend -Stamp -quit -To $@ -From
CFLAGS = -c -depend !Depend ${INCLUDES} ${DFLAGS}
CFLAGS = -c -depend !Depend ${THROWBACK} ${INCLUDES} ${DFLAGS}
CPFLAGS = ~cfr~v
WFLAGS = ~c~v
CHMODFLAGS = RW/R
#DFLAGS = -DDEBUG
#
......@@ -69,9 +71,9 @@ INCLUDES = -ITbox: -IC:
#
COMPONENT = Builder
TARGET = !RunImage
APP = <Build$Dir>.!${COMPONENT}
APP = ${INSTALL_DIR}.!${COMPONENT}
OBJS = o.main o.db o.msg o.env
OBJS = o.main o.db o.msg o.env o.file o.parse o.build
#
......@@ -91,10 +93,12 @@ clean:
${WIPE} ${TARGET} ${WFLAGS}
@echo ${COMPONENT}: cleaned
install:
install: ${TARGET}
${MKDIR} ${APP}
${CP} ${TARGET} ${APP}.${TARGET} ${CPFLAGS}
${CP} Resources.* ${APP}.* ${CPFLAGS}
${CHMOD} ${APP} ${CHMODFLAGS}
${CHMOD} ${APP}.* ${CHMODFLAGS}
@echo ${COMPONENT}: installed
#
# Target
......
!Builder
--------
!Help $Date$
!Help 22 Sep 1997
The application !Builder is a simple front end to the ROM building process. It
performs the following functions :
* maintains a list of multiple build trees
* provide menu access to environment files
* button click to edit current components file
* menu click to edit current components file
* menu click to edit master modules database
* option button selection of phases of build to perform
* saving of current options as default for next time
* button click to perform a build using currently ticked phases with the
current environment.
Environment files are hidden away in the !Builder.Env directory. This directory
is scanned before the environment list menu is popped up and the filenames
appear in the menu. When a menu entry is clicked, that environement file is
Wimp_StartTask'ed, sourcing the contents of the file.
Clicking on the build button Wimp_StartTask's the file !Builder.!build. This
file is used to set an appropriate wimpslot and run any pre-build scripts that
could be used to configure build names etc. Finally, srcbuild is run with the
parameters specified in the !Builder window.
Notes/Requirements :
* !Builder can be located in your Apps directory and can be shared across
different build trees.
* If !Builder is started with the command line argument "-quit", the default
build directory and env file is sourced and the application is exited.
* A new env file is sourced when the application started up and when a new
environment is selected off the menu.
* <Choices$Write> to point to somewhere useful to save defaults.
* <Build$Dir>.Env to contain all the environment files which in turn source
the !Common environment file. Use the construct :
Set Build$Dir <Obey$Dir>
<Build$Dir>.Library.canonical Build$Dir
to remove the pesky ^ that can be found in the path. canonical can be found
in the renaissa/Build/Library directory.
* Module database and component files to live in directory
<Build$Dir>.BuildSys.
* The Components file should have the same name as the <Build> environment
variable that is set in the Env file.
* When the "Build" button on the main window is clicked, the file
!Builder.!build is run with the appropriate command line options. This
file can be customised to run other scripts to set for example build name
environment variables.
Bug reports/comments to rbuckley@acorn.com
......@@ -11,7 +11,7 @@ RMEnsure Iconbar 1.08 System:Modules.Toolbox.Iconbar
RMEnsure Iconbar 1.08 Error Iconbar module missing from System path
RMEnsure Menu 0.17 System:Modules.Toolbox.Menu
WimpSlot -min 32K -max 32K
RMEnsure Menu 0.17 Error Menu module missing from System path
Run <Builder$Dir>.!RunImage %*0
RMEnsure ProgInfo 0.06 System:Modules.Toolbox.ProgInfo
RMEnsure ProgInfo 0.06 Error ProgInfo module missing from System path
Run <Builder$Dir>.!RunImage
......@@ -2,7 +2,6 @@
|
wimpslot 2048k
| Sort out the build names - will set srcbuild$name
dir <Build$Dir>.BuildSys
perl perl.buildname
| run any other scripts/utilities here before running srcbuild
srcbuild -v %*0
_TaskName:Builder
no_env:No environment currently defined. Select an environment and try again.
def_write:Problem writing defaults file, current options may not be available next time.
mem:Memory allocation error.
bld:No build directory currently defined. Select a directory and try again.
env:No environment currently defined. Select an environment and try again.
chk:Build directory specified does not exist or is not a directory.
dir:Cannot create directory <Choices$Dir>.Builder.
def:Problem writing defaults file in <Choices$Dir>.Builder, current options may not be available next time.
No preview for this file type
......@@ -52,7 +52,7 @@ db_printf (char *format, ...)
if (fileDebug)
vfprintf(fileDebug, format, list);
va_end(list);
fflush(fileDebug);
}
#else
......
......@@ -31,7 +31,8 @@
#include "constants.h"
extern char build_name[];
extern char *build_tree;
extern char *default_env;
/*
* Enumerate the env directory and present files as options in the stringset.
......@@ -39,33 +40,31 @@ extern char build_name[];
* variable.
*/
_kernel_oserror *
env_populate(char *path, int window, int gadget)
env_populate(int window, int gadget, char *default_env)
{
_kernel_swi_regs reg;
_kernel_oserror *err=NULL;
char buffer[96];
char strings_available[1024];
char directory[BUFFER_SIZE];
char strings_available[BUFFER_SIZE];
char *filename;
char *b=NULL;
sprintf(directory,"%s.%s",build_tree,ENV_DIR);
strcpy(strings_available,"");
reg.r[0] = 10;
reg.r[1] = (int)path;
reg.r[1] = (int)directory;
reg.r[2] = (int)buffer;
reg.r[3] = 1;
reg.r[4] = 0;
reg.r[5] = sizeof(buffer);
reg.r[6] = NULL;
do
{
do {
ERR_RETURN(err,_kernel_swi(OS_GBPB,&reg,&reg));
if (reg.r[4] != -1)
{
if (reg.r[4] != -1) {
filename = buffer+20;
if (strlen(strings_available)+strlen(filename)+1<
sizeof(strings_available))
{
sizeof(strings_available)) {
if (strlen(strings_available)>0) /* more than one, add , */
strcat(strings_available,",");
strcat(strings_available,filename);
......@@ -74,33 +73,28 @@ env_populate(char *path, int window, int gadget)
} while (reg.r[4] != -1);
ERR_RETURN(err,stringset_set_available(0,window,gadget,strings_available));
if ((b=getenv(BUILD_ENV))!=NULL)
{
strcpy(build_name,b);
if (strstr(strings_available,build_name)!=NULL)
{
ERR_RETURN(err,stringset_set_selected(0,window,gadget,build_name));
if (default_env) {
if (strstr(strings_available,default_env)!=NULL) {
ERR_RETURN(err,stringset_set_selected(0,window,gadget,default_env));
}
}
else
{
strcpy(build_name,"");
ERR_RETURN(err,stringset_set_selected(0,window,gadget,build_name));
} else {
ERR_RETURN(err,stringset_set_selected(0,window,gadget,""));
}
return (NULL);
}
_kernel_oserror *
env_source(char *path, int window, int gadget)
env_source(void)
{
_kernel_swi_regs reg;
_kernel_oserror *err=NULL;
int i;
char cmd[BUILD_NAME_SIZE];
char cmd[BUFFER_SIZE];
if (!default_env) {
return (NULL);
}
ERR_RETURN(err,stringset_get_selected(0,window,gadget,build_name,
BUILD_NAME_SIZE,&i));
sprintf(cmd,"%s.%s",ENV_DIR,build_name);
sprintf(cmd,"%s.%s.%s",build_tree,ENV_DIR,default_env);
reg.r[0] = (int)cmd;
ERR_RETURN(err,_kernel_swi(Wimp_StartTask,&reg,&reg));
......
......@@ -41,6 +41,9 @@
#include "constants.h"
#include "msg.h"
#include "env.h"
#include "file.h"
#include "parse.h"
#include "build.h"
#define WimpVersion 350
......@@ -49,120 +52,233 @@ static MessagesFD messages;
static IdBlock id_block;
int task_handle = 0; /* Wimp task handle */
int iconbar_id = 0; /* ID iconbar object */
int menu_iconbar_id = 0; /* ID of iconbar menu object */
int window_options_id = 0; /* ID of build options window */
int proginfo_id = 0; /* ID of proginfo window */
char build_name[BUILD_NAME_SIZE];
int defaults_read = 0;
int iconbar_id = 0; /* object ids */
int menu_iconbar_id = 0;
int menu_option_id = 0;
int menu_view_id = 0;
int window_options_id = 0;
int window_build_id = 0;
int proginfo_id = 0;
char *build_tree = NULL;
char *default_env = NULL;
build_list_t *build_list = NULL;
/*
* clean up before exit
*/
int
quit_all(void)
{
build_free();
if (build_tree)
free(build_tree);
if (default_env)
free(default_env);
debug db_file_init(NULL);
exit(0);
return (1);
}
/*
* quit_event
*
* Event handler to be called when toolbox event 1 is generated (by click on the
* 'Quit' entry of the iconbar menu.
*/
int
quit_event(int event_code, ToolboxEvent *event, IdBlock *id_block, void *handle)
event_quit(int event_code, ToolboxEvent *event, IdBlock *id_block, void *handle)
{
event_code = event_code;
event = event;
id_block = id_block;
handle = handle;
debug db_file_init(NULL);
exit(0);
return(1);
return(quit_all());
}
/*
* quit_message
*
* Message handler to be called on receipt of a Quit or PreQuit message from the
* Wimp.
*/
int
quit_message(WimpMessage *message, void *handle)
message_quit(WimpMessage *message, void *handle)
{
message = message;
handle = handle;
debug db_file_init(NULL);
exit(0);
return(1);
return(quit_all());
}
/*
* read defaults file (if it exists) and populate window option buttons and
* environment
* Validate filetype of file then initiate a load and open the main window
*/
int
read_defaults(void)
message_data_open(WimpMessage *message, void *handle)
{
_kernel_oserror *err=NULL;
FILE *fh=NULL;
char str[1024];
char *cp,*wd;
int end_of_string=0;
int i;
_kernel_oserror *err;
WimpMessage msg;
char *path;
int toolbox_object;
int component_id;
handle=handle;
if ((fh=fopen(DEFAULTS_FILE,"r"))!=NULL)
if (message->hdr.sender == task_handle)
return 0;
path = message->data.data_load_ack.leaf_name;
ERR_CHECK(err,window_wimp_to_toolbox(0,
message->data.data_load_ack.destination_window,
message->data.data_load_ack.destination_icon,
&toolbox_object,&component_id));
if (toolbox_object == window_build_id)
{
/*
* set all options off
*/
for (i=0; i<(sizeof(options)/sizeof(option_t)); i++)
if (file_exists(path)==2)
{
ERR_GOTO(err,optionbutton_set_state(0,window_options_id,
options[i].id,0));
ERR_CHECK(err,stringset_set_selected(0,window_build_id,
BUILD_GADGET_TREE,path));
ERR_CHECK_RETURN(err,build_add_entry(path));
ERR_CHECK_RETURN(err,build_populate(window_build_id,
BUILD_GADGET_TREE));
}
/*
* read in line from file
*/
fgets(str,sizeof(str),fh);
if (!feof(fh))
{
cp=str;
while (*cp!=0 && *cp!='\n') /* terminate string */
cp++;
*cp=0;
/*
* for each word in line
*/
cp=str;
do
{
while ((*cp==' ') || (*cp==9)) /* skip space chars */
cp++;
wd=cp;
while ((*cp!=' ') && (*cp!=9) && (*cp!=0)) /* find end of word */
cp++;
if (*cp==0)
end_of_string=1;
else
*cp=0;
for (i=0; i<(sizeof(options)/sizeof(option_t)); i++)
{
if (strcmp(options[i].name,wd)==0)
{
ERR_GOTO(err,optionbutton_set_state(0,window_options_id,
options[i].id,1));
break;
}
}
cp++;
} while (!end_of_string);
}
/*
* acknowledge message
*/
msg = *message;
msg.hdr.your_ref = msg.hdr.my_ref;
if (message->hdr.action_code == Wimp_MDataLoad)
msg.hdr.action_code = Wimp_MDataLoadAck;
wimp_send_message(Wimp_EUserMessage, &msg, msg.hdr.sender,0,0);
return 1;
}
/*
* set build tree
*/
void
set_build_tree(char *name)
{
if (build_tree) {
if (strlen(name)>strlen(build_tree)) { /* will it fit */
free(build_tree);
} else {
strcpy(build_tree,name);
debug db_printf("build_tree set to '%s'\n",build_tree);
return;
}
}
exit_gracefully:
if (fh)
fclose(fh);
if (err)
wimp_report_error(err,0,0);
defaults_read = 1;
build_tree = strdup(name);
}
/*
* read in contents of defaults file
*/
int
read_defaults(void)
{
FILE *fh=NULL;
char buffer[BUFFER_SIZE];
int argc,i,j;
char *argv[25];
if ((fh=fopen(DEFAULTS_FILE,"r"))==NULL)
return 0;
debug db_printf("read_defaults\n");
while (!feof(fh)) {
fgets(buffer,sizeof(buffer),fh);
if (!feof(fh)) {
chop_newline(buffer);
debug db_printf(" %s\n",buffer);
argc=parse_getargs(buffer,argv);
if (argc>0) {
if (cstrcmp(argv[0],"bld")==0) {
set_build_tree(argv[1]);
} else if (cstrcmp(argv[0],"env")==0) {
default_env = strdup(argv[1]);
} else if (cstrcmp(argv[0],"opt")==0) {
for (i=1; i<argc; i++) {
for (j=0; j<(sizeof(options)/sizeof(option_t)); j++) {
if (strcmp(options[j].name,argv[i])==0) {
options[j].def = 1;
break;
}
}
}
}
}
}
}
fclose(fh);
return 0;
}
/*
* read in contents of build trees file
*/
int
read_builds(void)
{
FILE *fh=NULL;
char buffer[BUFFER_SIZE];
if ((fh=fopen(BUILDS_FILE,"r"))==NULL)
return 0;
while (!feof(fh)) {
fgets(buffer,sizeof(buffer),fh);
if (!feof(fh)) {
chop_newline(buffer);
debug db_printf(" %s\n",buffer);
build_add_entry(buffer);
}
}
fclose(fh);
return 0;
}
/*
* write the list of build directories to the defaults file
*/
int
write_builds(void)
{
_kernel_oserror *err=NULL;
FILE *fh=NULL;
build_list_t *entry;
switch (file_exists(CHOICES_DIR))
{
case 0 :
if (mkdir(CHOICES_DIR,0)==0)
break;
/* else drop though to */
case 1 :
ERR_CHECK_RETURN(err,msg_error_construct("dir"));
/* macro will exit */
}
if ((fh=fopen(BUILDS_FILE,"w"))==NULL) {
ERR_CHECK_RETURN(err,msg_error_construct("def"));
}
entry = build_list;
while (entry) {
fprintf(fh,"%s\n",entry->name);
entry = entry->next;
}
fclose(fh);
return 0;
}
......@@ -175,22 +291,39 @@ write_defaults(void)
{
_kernel_oserror *err=NULL;
FILE *fh=NULL;
int state;
int i;
int i,state;
char buffer[BUFFER_SIZE];
if ((fh=fopen(DEFAULTS_FILE,"w"))==NULL)
switch (file_exists(CHOICES_DIR))
{
ERR_CHECK_RETURN(err,msg_error_construct("def_write"));
case 0 :
if (mkdir(CHOICES_DIR,0)==0)
break;
/* else drop though to */
case 1 :
ERR_CHECK_RETURN(err,msg_error_construct("dir"));
/* macro will exit */
}
for (i=0; i<(sizeof(options)/sizeof(option_t)); i++)
{
if ((fh=fopen(DEFAULTS_FILE,"w"))==NULL) {
ERR_CHECK_RETURN(err,msg_error_construct("def"));
}
fprintf(fh,"opt");
for (i=0; i<(sizeof(options)/sizeof(option_t)); i++) {
ERR_CHECK_RETURN(err,optionbutton_get_state(0,window_options_id,
options[i].id,&state));
if (state)
fprintf(fh,"%s ",options[i].name);
fprintf(fh," %s",options[i].name);
}
fprintf(fh,"\n");
ERR_CHECK_RETURN(err,stringset_get_selected(0,window_options_id,
OPTIONS_GADGET_TREE,buffer,sizeof(buffer),&i));
fprintf(fh,"bld %s\n",buffer);
ERR_CHECK_RETURN(err,stringset_get_selected(0,window_options_id,
OPTIONS_GADGET_ENV,buffer,sizeof(buffer),&i));
fprintf(fh,"env %s\n",buffer);
fclose(fh);
return 0;
......@@ -218,8 +351,13 @@ attach_other_handlers(int event_code,ToolboxEvent *event,
window_options_id = id_block->self_id;
} else if (strcmp(template_name, PROGINFO_NAME) ==0) {
proginfo_id = id_block->self_id;
} else if (strcmp(template_name, MENU_OPTION_NAME) ==0) {
menu_option_id = id_block->self_id;
} else if (strcmp(template_name, MENU_VIEW_NAME) ==0) {
menu_view_id = id_block->self_id;
} else if (strcmp(template_name, WINDOW_BUILDS_NAME) ==0) {
window_build_id = id_block->self_id;
}
return 0;
}
......@@ -242,15 +380,29 @@ window_show(int event_code,ToolboxEvent *event,
IdBlock *id_block, void *handle)
{
_kernel_oserror *err=NULL;
int i;