I've been having a look at my patch to split up the RPCEmu directory tree
into different paths, for ease of packaging.  I've made most of the changes
as various people have suggested, but I thought before I go any further it
was worth discussing the design.  So I've put together a basic specification
below.  Comments would be welcome.

The outline is that users should be able to configure their own RPCEmu as
they wish, and the configuration file lives at ~/.rpcemu/rpc.cfg.  If they
don't do that, RPCEmu should look for files in their home directory at
~/.rpcemu/  If they can't be found there, it should look system-wide in
various directories whose position depends on the distribution, and is
determined by the parameters supplied to ./configure

Old-style installs, being those compiled without autoconf (ie on Windows) or
that are configured with --enable-portableinstall, should find all the files
in the executable's directory.  They'll still look in ~/.rpcemu/* but if
they don't find what they need (which is likely) they'll drop back to the
executable's directory.

Specification is below.  One thing I'm not yet happy with is the naming of
ARMCODE_DIR and similar - it's not very obvious and I'd prefer ROM_DIR.  The
trouble is that 'roms' currently doesn't cover all ROMs.  Perhaps we could
have a hierarchy that looks something like this:
roms/
roms/systemroms/
roms/systemroms/riscos402
roms/poduleroms/
roms/poduleroms/EtherRPCEm,ffa

And then define ROM_DIR to be the top level roms/
How does that sound?

I'm probably not going to have much of a chance to work on this between now
and February, so if anyone wants to work on this I can post a patch of where
I am right now.

Theo


RPCEmu filesystem specification
-------------------------------


Notation a bit vague, roughly:
$FOO = Unix environment variable 'FOO'
%FOO% = Windows environment variable 'FOO' (these two are both read with 
getenv())
--foo = Result of defining --foo on autoconf ./configure command line, or 
inherited
  from other ./configure settings.  If we supplied --foo=/bar/baz on the
  command line, here --foo/joe denotes /bar/baz/joe
FOO = C preprocessor definition passed in on compiler command line from 
./configure
@foo = C language variable (just for this algorithm)

{
  If we didn't configure with autoconfed paths
    define all the autoconfed paths 
CONFIG_DIR/ARMCODE_DIR/CMOS_DIR/LOG_DIR/DRIVES_DIR
    to point to the executable's directory

  Configuration file search:
  try @configfile=$HOME/.rpcemu/rpc.cfg
  if @configfile doesn't exist
  {
    try @configfile=%HOMEPATH%/.rpcemu/rpc.cfg
    if @configfile doesn't exist
    {
      @configfile=CONFIG_DIR/rpc.cfg
      (CONFIG_DIR comes from autoconf, --sysconfdir/rpcemu)
    }
  }
  if @configfile exists
    @configdir=~/.rpcemu
  
  if @configfile doesn't exist (ie nothing in CONFIG_DIR)
    we can't read the configuration file, so assume the autoconfed defaults 
(last resorts below)
  else
  {
    we try to read the following tags:
    
      try @armcodedir=value of "armcode_dir" tag
      if tag exists, read all armcode files from @armcode dir
        else
          try to read armcode files from @configdir/
          if that fails, on last resort:
            read from @armcodedir = ARMCODE_DIR from autoconf, --datadir/rpcemu
      The same for:
      try @cmosdir=value of "cmos_dir" tag
        last resort, @cmosdir = CMOS_DIR from autoconf, 
--localstatedir/lib/rpcemu
      try @drivesdir=value of "drives_dir" tag
        last resort, @drivesdir = DRIVES_DIR from autoconf, 
--localstatedir/lib/rpcemu
      try @logdir=value of "log_dir" tag
        last resort, @logdir = LOG_DIR from autoconf, --localstatedir/log/rpcemu
  }    

}

_______________________________________________
Rpcemu mailing list
[email protected]
http://www.riscos.info/cgi-bin/mailman/listinfo/rpcemu

Reply via email to