public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] Build tree paths
@ 2008-02-08 20:56 Timothy M. Schaeffer
  2008-02-11  9:11 ` [ECOS] " John Dallaway
  0 siblings, 1 reply; 5+ messages in thread
From: Timothy M. Schaeffer @ 2008-02-08 20:56 UTC (permalink / raw)
  To: Ecos Mailing List


Say I'm generating a build tree with x.ecc.  When I generate the build
tree in config tool, I get 3 directories: x_install, x_mlt, x_build.
But if I do 

  $ ecosconfig --config=x.ecc

I get everything that would have been in the x_build and x_install
directories in the current directory.

$ ecosconfig --config=x.ecc --prefix=x_install

can move the install stuff, but the build stuff still gets dumped into
the current directory.  This makes it difficult to move between using
configtool and ecosconfig.

- Why doesn't ecosconfig do what configtool does?

- How can I make it do what configtool does?


Thanks,

Tim S

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [ECOS] Re: Build tree paths
  2008-02-08 20:56 [ECOS] Build tree paths Timothy M. Schaeffer
@ 2008-02-11  9:11 ` John Dallaway
  2008-02-11 12:07   ` Gary Thomas
  0 siblings, 1 reply; 5+ messages in thread
From: John Dallaway @ 2008-02-11  9:11 UTC (permalink / raw)
  To: Timothy M. Schaeffer; +Cc: ecos-discuss

Hi Tim

Timothy M. Schaeffer wrote:

> Say I'm generating a build tree with x.ecc.  When I generate the build
> tree in config tool, I get 3 directories: x_install, x_mlt, x_build.
> But if I do 
> 
>   $ ecosconfig --config=x.ecc
> 
> I get everything that would have been in the x_build and x_install
> directories in the current directory.
> 
> $ ecosconfig --config=x.ecc --prefix=x_install
> 
> can move the install stuff, but the build stuff still gets dumped into
> the current directory.  This makes it difficult to move between using
> configtool and ecosconfig.
> 
> - Why doesn't ecosconfig do what configtool does?
> 
> - How can I make it do what configtool does?

ecosconfig assumes the the current working directory is the base of the
build tree. Try the following:

  $ cd /path/to/x_build
  $ ecosconfig --config=/path/to/x.ecc --prefix=/path/to/x_install

John Dallaway
eCosCentric Limited

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [ECOS] Re: Build tree paths
  2008-02-11  9:11 ` [ECOS] " John Dallaway
@ 2008-02-11 12:07   ` Gary Thomas
  2008-02-11 12:41     ` John Dallaway
  0 siblings, 1 reply; 5+ messages in thread
From: Gary Thomas @ 2008-02-11 12:07 UTC (permalink / raw)
  To: John Dallaway; +Cc: Timothy M. Schaeffer, ecos-discuss

John Dallaway wrote:
> Hi Tim
> 
> Timothy M. Schaeffer wrote:
> 
>> Say I'm generating a build tree with x.ecc.  When I generate the build
>> tree in config tool, I get 3 directories: x_install, x_mlt, x_build.
>> But if I do 
>>
>>   $ ecosconfig --config=x.ecc
>>
>> I get everything that would have been in the x_build and x_install
>> directories in the current directory.
>>
>> $ ecosconfig --config=x.ecc --prefix=x_install
>>
>> can move the install stuff, but the build stuff still gets dumped into
>> the current directory.  This makes it difficult to move between using
>> configtool and ecosconfig.
>>
>> - Why doesn't ecosconfig do what configtool does?
>>
>> - How can I make it do what configtool does?
> 
> ecosconfig assumes the the current working directory is the base of the
> build tree. Try the following:
> 
>   $ cd /path/to/x_build
>   $ ecosconfig --config=/path/to/x.ecc --prefix=/path/to/x_install

But (and I've asked this myself for many years now) are they different
in the first place?


-- 
------------------------------------------------------------
Gary Thomas                 |  Consulting for the
MLB Associates              |    Embedded world
------------------------------------------------------------

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [ECOS] Re: Build tree paths
  2008-02-11 12:07   ` Gary Thomas
@ 2008-02-11 12:41     ` John Dallaway
  2008-02-13 23:32       ` Timothy M. Schaeffer
  0 siblings, 1 reply; 5+ messages in thread
From: John Dallaway @ 2008-02-11 12:41 UTC (permalink / raw)
  To: Gary Thomas; +Cc: Timothy M. Schaeffer, ecos-discuss

Hi Gary

Gary Thomas wrote:

> John Dallaway wrote:
> 
>> Timothy M. Schaeffer wrote:
>>>
>>> - Why doesn't ecosconfig do what configtool does?
>>>
>>> - How can I make it do what configtool does?
>>
>> ecosconfig assumes the the current working directory is the base of the
>> build tree. Try the following:
>>
>>   $ cd /path/to/x_build
>>   $ ecosconfig --config=/path/to/x.ecc --prefix=/path/to/x_install
> 
> But (and I've asked this myself for many years now) are they different
> in the first place?

The question has indeed been debated on many occasions. The best answer
I can offer is that command line development tools tend to manipulate
content with implicit reference the current working directory while
graphical tools tend to be "document centric".

The eCos Configuration Tool treats an eCos configuration file (*.ecc) as
it's document and generates sub-directories to hold the eCos build tree
and eCos install tree. This allows multiple documents to be saved in the
same directory with different names. In this context, it seems sensible
to save the eCos build and eCos install trees in parallel directories
with names derived from the document name.

The ecosconfig command-line tool assumes that the current working
directory is the root of the eCos build tree and uses the same directory
to hold the eCos install tree by default. This is reasonable for a
command-line tool, although it becomes slightly more difficult to delete
the eCos build tree while leaving the eCos install tree in place.

Both tools provide an operating paradigm which is familiar to their
respective users and I suspect there would anticipate considerable
resistance to change.

John Dallaway
eCosCentric Limited

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [ECOS] Re: Build tree paths
  2008-02-11 12:41     ` John Dallaway
@ 2008-02-13 23:32       ` Timothy M. Schaeffer
  0 siblings, 0 replies; 5+ messages in thread
From: Timothy M. Schaeffer @ 2008-02-13 23:32 UTC (permalink / raw)
  To: Ecos Mailing List

[-- Attachment #1: Type: text/plain, Size: 2467 bytes --]

On Mon, 2008-02-11 at 12:41 +0000, John Dallaway wrote:
> Hi Gary
> 
> Gary Thomas wrote:
> 
> > John Dallaway wrote:
> > 
> >> Timothy M. Schaeffer wrote:
> >>>
> >>> - Why doesn't ecosconfig do what configtool does?
> >>>
> >>> - How can I make it do what configtool does?
> >>
> >> ecosconfig assumes the the current working directory is the base of the
> >> build tree. Try the following:
> >>
> >>   $ cd /path/to/x_build
> >>   $ ecosconfig --config=/path/to/x.ecc --prefix=/path/to/x_install
> > 
> > But (and I've asked this myself for many years now) are they different
> > in the first place?
> 
...
> Both tools provide an operating paradigm which is familiar to their
> respective users and I suspect there would anticipate considerable
> resistance to change.
> 
> John Dallaway
> eCosCentric Limited


I have made some modifications to the source which should do what I want
without changing existing usage.  This is from the ecos repo as of
yesterday.

In summary:

I added a --build-prefix=<build_dir> option, which puts the build files
into <build_dir> instead of the current directory.  If --prefix is not
given, the install tree will be in <build_dir>/install.

I added a --install-prefix=<install_dir> as a synonym for --prefix,
because I like it better :-)

I added a -C, --use-configtool-paths option, which uses the base name of
the config file to determine the default build and install prefixes.
E.g. if  I give 
 $ ecosconfig -C tree 
I get ecos_build, ecos_install in the current directory, just as
configtool does.  
 $ ecosconfig --config=this_project.ecc
gives me this_project_(install|build) in the current directory, 
 $ econconfig --config=/path/to/my_project.ecc
gives my /path/to/my_project_(install|build)/, and so on.
The --(build|install)-prefix options override these severally, so you
can still do weird things if you want.

Using ecosconfig w/o these options should work like it did before.
Except that it will reject project files which don't have the .ecc
extension, like configtool does.

I have not tested it under MSVC or cygwin, but I think it should work;
the change doesn't do any unixish file-name frobbing.

You still have to provide absolute paths to the --(build|install)-prefix
options, or the makefiles will fail.  I think this should change to but
I didn't have time to fix it now, as it will involve some non-trivial
file-name munging and probably some non-portable stuff too.

Ars longa, vita brevis.


Tim S

[-- Attachment #2: ecos.diff --]
[-- Type: text/x-patch, Size: 19739 bytes --]

Index: doc/sgml/user-guide/configuration.sgml
===================================================================
RCS file: /cvs/ecos/ecos/doc/sgml/user-guide/configuration.sgml,v
retrieving revision 1.3
diff -u -r1.3 configuration.sgml
--- doc/sgml/user-guide/configuration.sgml	12 Feb 2003 18:36:13 -0000	1.3
+++ doc/sgml/user-guide/configuration.sgml	13 Feb 2008 22:59:31 -0000
@@ -138,6 +138,7 @@
 </VARLISTENTRY>
 <VARLISTENTRY>
 <TERM><OPTION>--prefix=&lt;dir&gt;</OPTION></TERM>
+<TERM><OPTION>--install-prefix=&lt;dir&gt;</OPTION></TERM>
 <LISTITEM>
 <PARA>Specifies an alternative location for the
 		  install tree. By default, the install tree resides
@@ -145,7 +146,36 @@
 		  directory in the build tree. Developers may prefer
 		  to locate the build tree in a temporary file
 		  hierarchy but keep the install tree in a more
-		  permanent location.</PARA>
+		  permanent location.  The argument should be an
+		  absolute path name.</PARA>
+</LISTITEM>
+</VARLISTENTRY>
+<VARLISTENTRY>
+<TERM><OPTION>--build-prefix=&lt;dir&gt;</OPTION></TERM>
+<LISTITEM>
+<PARA>Specifies an alternative location for the build tree. By
+		  default, the build tree is the current
+		  directory. Developers may prefer to locate the build
+		  tree separate from the install tree.  The argument
+		  should be an absolute path name.</PARA>
+</LISTITEM>
+</VARLISTENTRY>
+<VARLISTENTRY>
+<TERM><OPTION>--use-configtool-paths</OPTION></TERM>
+<TERM><OPTION>-C</OPTION></TERM>
+<LISTITEM>
+<PARA>Change the default build prefix (the current directory) and
+  install prefix (install directory in the build tree) to mimic the
+  paths used by <COMMAND>configtool</COMMAND>.  Specifically, if the
+  config file is given by <OPTION>--config=/path/to/X.ecc</OPTION>,
+  the build tree is built in
+  <filename>/path/to/X_build</filename> and the install tree is put in
+  <filename>/path/to/X_install</filename>. If <filename>X.ecc</filename>
+  is in the current directory, <filename>X_build</filename>
+  and <filename>X_install</filename> will be also; you needn't give
+  the path of <filename>X.ecc</filename>. An explicit <OPTION>--build-prefix</OPTION> or
+  <OPTION>--install-prefix</OPTION> (or <OPTION>--prefix</OPTION>)
+  will overide these defaults.</PARA>
 </LISTITEM>
 </VARLISTENTRY>
 <VARLISTENTRY>
Index: host/tools/configtool/standalone/common/cdl_exec.cxx
===================================================================
RCS file: /cvs/ecos/ecos/host/tools/configtool/standalone/common/cdl_exec.cxx,v
retrieving revision 1.15
diff -u -r1.15 cdl_exec.cxx
--- host/tools/configtool/standalone/common/cdl_exec.cxx	2 Jan 2006 21:14:22 -0000	1.15
+++ host/tools/configtool/standalone/common/cdl_exec.cxx	13 Feb 2008 22:59:31 -0000
@@ -62,10 +62,12 @@
 int  cdl_exec::debug_level      = 0;
 
 cdl_exec::cdl_exec (const std::string repository_arg, const std::string savefile_arg,
-                    const std::string install_arg, bool no_resolve_arg)
+                    const std::string install_arg, const std::string build_tree_arg,
+                    bool no_resolve_arg)
     : repository(repository_arg),
       savefile(savefile_arg),
       install_prefix(install_arg),
+      build_tree(build_tree_arg),
       no_resolve(no_resolve_arg),
       pkgdata (NULL),
       interp (NULL),
@@ -480,20 +482,8 @@
             // Do nothing
         }
         else if (ignore_errors || (0 == config->get_all_conflicts().size())) {
-#ifdef _MSC_VER
-            char cwd [_MAX_PATH + 1];
-#else
-            char cwd [PATH_MAX + 1];
-#endif
-            getcwd (cwd, sizeof cwd);
-#ifdef __CYGWIN__
-            char cwd_win32 [MAXPATHLEN + 1];
-            cygwin_conv_to_win32_path (cwd, cwd_win32);
-            generate_build_tree (config, cwd_win32, install_prefix);
-#else
-            generate_build_tree (config, cwd, install_prefix);
-#endif
-            config->generate_config_headers (install_prefix.empty () ? "install/include/pkgconf" : install_prefix + "/include/pkgconf");
+            generate_build_tree (config, build_tree, install_prefix);
+            config->generate_config_headers (install_prefix + "/include/pkgconf");
             status = true;
 #ifdef __CYGWIN__
             char buf[100];
Index: host/tools/configtool/standalone/common/cdl_exec.hxx
===================================================================
RCS file: /cvs/ecos/ecos/host/tools/configtool/standalone/common/cdl_exec.hxx,v
retrieving revision 1.4
diff -u -r1.4 cdl_exec.hxx
--- host/tools/configtool/standalone/common/cdl_exec.hxx	20 May 2002 22:19:28 -0000	1.4
+++ host/tools/configtool/standalone/common/cdl_exec.hxx	13 Feb 2008 22:59:31 -0000
@@ -26,7 +26,9 @@
 
 class cdl_exec {
 public:
-    cdl_exec (const std::string repository_tree, const std::string savefile_name, const std::string install_tree, bool no_resolve);
+    cdl_exec (const std::string repository_tree, const std::string savefile_name,
+              const std::string install_tree, const std::string build_tree,
+              bool no_resolve);
     bool cmd_new (const std::string cdl_hardware, const std::string cdl_template = "default", const std::string cdl_version = "");
     bool cmd_tree ();
     bool cmd_check ();
@@ -54,6 +56,7 @@
     std::string repository;
     std::string savefile;
     std::string install_prefix;
+    std::string build_tree;
     bool no_resolve;
     static bool debug_level_set;
     static int  debug_level;
Index: host/tools/configtool/standalone/common/ecosconfig.cxx
===================================================================
RCS file: /cvs/ecos/ecos/host/tools/configtool/standalone/common/ecosconfig.cxx,v
retrieving revision 1.15
diff -u -r1.15 ecosconfig.cxx
--- host/tools/configtool/standalone/common/ecosconfig.cxx	11 Jul 2006 09:56:14 -0000	1.15
+++ host/tools/configtool/standalone/common/ecosconfig.cxx	13 Feb 2008 22:59:31 -0000
@@ -57,12 +57,85 @@
 #define DEFAULT_SAVE_FILE "ecos.ecc"
 static char* tool = "ecosconfig";
 
+
+static bool
+get_arg_parm(const char * parmname, const char * parmdesc,
+             std::string & outval,  int & command_index,
+             const int argc, char * argv [])
+                       
+{
+    bool args_ok = true;
+    const char * arg = argv[command_index];
+    size_t parmlen = strlen(parmname);
+    if ("" != outval) {
+        fprintf(stderr, "%s: the `%s' option should be used only once.\n", tool, parmname);
+        args_ok = false;
+    } else {
+        if ('=' == arg[parmlen]) {
+            outval = std::string(arg + parmlen + 1);
+            if ("" == outval) {
+                fprintf(stderr, "%s: missing %s after `%s='\n", tool, parmdesc, parmname);
+                args_ok = false;
+            }
+        } else if ('\0' == arg[parmlen]) {
+            command_index++;
+            if (command_index == argc) {
+                fprintf(stderr, "%s: missing %s after `%s'\n", tool, parmdesc, parmname);
+                args_ok = false;
+            } else {
+                outval = argv[command_index];
+            }
+        } else {
+            fprintf(stderr, "%s: invalid option `%s'\n", tool, arg);
+            args_ok = false;
+        }
+    }
+    return args_ok;
+}
+
+
+// The path must already exist for this to work.
+static std::string get_full_path(const std::string & path)
+{
+    char * fp = NULL;
+#ifdef _MSC_VER
+    char toolpath [_MAX_PATH + 1];
+    fp = _fullpath (toolpath, path.c_str(), sizeof (toolpath)); // get the absolute path to the tool
+#else
+    char toolpath [MAXPATHLEN + 1];
+    fp = realpath (path.c_str(), toolpath); // get the absolute path to the tool
+#endif
+    return std::string(fp != NULL ? fp : "");
+}
+
+
+static std::string get_cwd()
+{
+    char * pcwd;
+#ifdef _MSC_VER
+    char cwd [_MAX_PATH + 1];
+#else
+    char cwd [PATH_MAX + 1];
+#endif
+    getcwd (cwd, sizeof cwd);
+#ifdef __CYGWIN__
+    char cwd_win32 [MAXPATHLEN + 1];
+    cygwin_conv_to_win32_path (cwd, cwd_win32);
+    pcwd = cwd_win32;
+#else
+    pcwd = cwd;
+#endif
+    return std::string(pcwd);
+}
+
+
 int main (int argc, char * argv []) {
 
     // process command qualifiers
     std::string repository;     // --srcdir=
     std::string savefile;       // --config=
-    std::string install_prefix; // --prefix=
+    std::string install_prefix; // --(install-)?prefix=
+    std::string build_prefix;   // --build-prefix=
     bool version = false;       // --version
     bool no_resolve = false;    // --no-resolve
     bool quiet = false;         // -q, --quiet
@@ -71,6 +144,7 @@
     bool no_updates = false;    // -n, --no-updates,
     bool help = false;          // --help
     bool enable_debug_set = false;  // --enable-debug or --disable-debug
+    bool use_configtool_paths = false; // --use-configtool-paths or -C
     int  debug_level = 0;       // --enable-debug=[0|1|2]
 
 #ifdef __CYGWIN__
@@ -97,6 +171,8 @@
         } else if ((0 == strcmp(arg, "-v")) || (0 == strcmp(arg, "--verbose"))) {
             verbose = true;
             quiet = false;
+        } else if ((0 == strcmp(arg, "-C")) || (0 == strcmp(arg, "--use-configtool-paths"))) {
+            use_configtool_paths = true;
         } else if ((0 == strcmp(arg, "-i")) || (0 == strcmp(arg, "--ignore-errors"))) {
             // Duplicate use of -i and the other flags is harmless.
             ignore_errors = true;
@@ -113,79 +189,30 @@
             enable_debug_set = true;
             debug_level = 0;
         } else if (0 == strncmp(arg, "--srcdir", 8)) {
-            // Duplicate use of --srcdir and other data-containing options should
-            // be marked as an error.
-            if ("" != repository) {
-                fprintf(stderr, "%s: the `--srcdir' option should be used only once.\n", tool);
-                args_ok = false;
-            } else {
-                if ('=' == arg[8]) {
-                    repository = std::string(arg + 9);
-                    if ("" == repository) {
-                        fprintf(stderr, "%s: missing component repository after `--srcdir='\n", tool);
-                        args_ok = false;
-                    }
-                } else if ('\0' == arg[8]) {
-                    command_index++;
-                    if (command_index == argc) {
-                        fprintf(stderr, "%s: missing component repository after `--srcdir'\n", tool);
-                        args_ok = false;
-                    } else {
-                        repository = argv[command_index];
-                    }
-                } else {
-                    fprintf(stderr, "%s: invalid option `%s'\n", tool, arg);
-                    args_ok = false;
-                }
-            }
+            bool this_arg_ok = get_arg_parm("--srcdir", "component repository",
+                                            repository, command_index,
+                                            argc, argv);
+            args_ok = args_ok && this_arg_ok;
         } else if (0 == strncmp(arg, "--config", 8)) {
-            if ("" != savefile) {
-                fprintf(stderr, "%s: the `--config' option should be used only once.\n", tool);
-                args_ok = false;
-            } else {
-                if ('=' == arg[8]) {
-                    savefile = std::string(arg + 9);
-                    if ("" == savefile) {
-                        fprintf(stderr, "%s: missing configuration savefile after `--config='\n", tool);
-                        args_ok = false;
-                    }
-                } else if ('\0' == arg[8]) {
-                    command_index++;
-                    if (command_index == argc) {
-                        fprintf(stderr, "%s: missing configuration savefile after `--config'\n", tool);
-                        args_ok = false;
-                    } else {
-                        savefile = argv[command_index];
-                    }
-                } else {
-                    fprintf(stderr, "%s: invalid option `%s'\n", tool, arg);
-                    args_ok = false;
-                }
-            }
+            bool this_arg_ok = get_arg_parm("--config", "configuration savefile",
+                                            savefile, command_index,
+                                            argc, argv);
+            args_ok = args_ok && this_arg_ok;
         } else if (0 == strncmp(arg, "--prefix", 8)) {
-            if ("" != install_prefix) {
-                fprintf(stderr, "%s: the `--prefix' option should be used only once.\n", tool);
-                args_ok = false;
-            } else {
-                if ('=' == arg[8]) {
-                    install_prefix = std::string(arg + 9);
-                    if ("" == install_prefix) {
-                        fprintf(stderr, "%s: missing install prefix after `--prefix='\n", tool);
-                        args_ok = false;
-                    }
-                } else if ('\0' == arg[8]) {
-                    command_index++;
-                    if (command_index == argc) {
-                        fprintf(stderr, "%s: missing install prefix after `--prefix'\n", tool);
-                        args_ok = false;
-                    } else {
-                        install_prefix = argv[command_index];
-                    }
-                } else {
-                    fprintf(stderr, "%s: invalid option `%s'\n", tool, arg);
-                    args_ok = false;
-                }
-            }
+            bool this_arg_ok = get_arg_parm("--prefix", "install prefix",
+                                            install_prefix,  command_index,
+                                            argc, argv);
+            args_ok = args_ok && this_arg_ok;
+        } else if (0 == strncmp(arg, "--install-prefix", 16)) {
+            bool this_arg_ok = get_arg_parm("--install-prefix", "install prefix",
+                                            install_prefix,  command_index,
+                                            argc, argv);
+            args_ok = args_ok && this_arg_ok;
+        } else if (0 == strncmp(arg, "--build-prefix", 14)) {
+            bool this_arg_ok = get_arg_parm("--build-prefix", "build prefix",
+                                            build_prefix, command_index,
+                                            argc, argv);
+            args_ok = args_ok && this_arg_ok;
         } else {
             // The argument is not a qualifier
             // However, none of the sub-commands begin with a -
@@ -197,20 +224,6 @@
         }
     }
 
-#if 0
-    printf("args_ok is %d\n", args_ok);
-    printf("help is %d\n", help);
-    printf("version is %d\n", version);
-    printf("no_resolve is %d\n", no_resolve);
-    printf("quiet is %d\n", quiet);
-    printf("verbose is %d\n", verbose);
-    printf("no-updates is %d\n", no_updates);
-    printf("ignore_errors is %d\n", ignore_errors);
-    printf("repository is %s\n", repository.c_str());
-    printf("savefile is %s\n", savefile.c_str());
-    printf("install_prefix is %s\n", install_prefix.c_str());
-    exit(EXIT_SUCCESS);
-#endif
     
     // Usually argv[command_index] will be a sub-command, unless
     // --help or --version has been used.
@@ -237,6 +250,29 @@
     if (savefile.empty ()) { // if the save file was not specified on the command line
         savefile = DEFAULT_SAVE_FILE; // use the default save file
     }
+    savefile = get_full_path(savefile);
+    if (savefile.size() < 4 || savefile.substr(savefile.size() - 4) != ".ecc") {
+        fprintf(stderr, "%s is not a project file.\n", savefile.c_str());
+        return EXIT_FAILURE;
+    }
+
+    if ( ! use_configtool_paths ) {
+        if (build_prefix.empty()) {
+            build_prefix = get_cwd();
+        }
+        if (install_prefix.empty()) {
+            install_prefix = build_prefix + "/install";
+        }
+    } else {
+        std::string ecc_prefix = savefile.substr(0, savefile.size() - 4);
+        if (build_prefix.empty()) {
+            build_prefix = ecc_prefix + "_build";
+        }
+        if (install_prefix.empty()) {
+            install_prefix = ecc_prefix + "_install";
+        }
+    }
+    
 
     // find the repository
     if (repository.empty ()) { // if the repository was not specified on the command line
@@ -245,16 +281,7 @@
             repository = env_var;
         } else { // the ECOS_REPOSITORY environment variable is not defined
             // assume that the tool is located in the root of the repository
-#ifdef _MSC_VER
-            char toolpath [_MAX_PATH + 1];
-            _fullpath (toolpath, argv [0], sizeof (toolpath)); // get the absolute path to the tool
-#else
-            // NOTE: portability problem. realpath() is not a POSIX function.
-            // Alternative code may be needed on some platforms.
-            char toolpath [MAXPATHLEN + 1];
-            realpath (argv [0], toolpath); // get the absolute path to the tool
-#endif
-            repository = toolpath;
+            repository = get_full_path(argv[0]);
             for (unsigned int n = repository.size () - 1; n > 0; n--) { // for each char starting at the tail
                 if (('\\' == repository [n]) || ('/' == repository [n])) { // if the char is a directory separator
                     repository.resize (n); // remove the filename from the filepath
@@ -273,9 +300,25 @@
     }
 #endif
 
+#if 0
+    printf("args_ok is %d\n", args_ok);
+    printf("help is %d\n", help);
+    printf("version is %d\n", version);
+    printf("no_resolve is %d\n", no_resolve);
+    printf("quiet is %d\n", quiet);
+    printf("verbose is %d\n", verbose);
+    printf("no-updates is %d\n", no_updates);
+    printf("ignore_errors is %d\n", ignore_errors);
+    printf("repository is %s\n", repository.c_str());
+    printf("savefile is %s\n", savefile.c_str());
+    printf("install_prefix is %s\n", install_prefix.c_str());
+    printf("build_prefix is %s\n", build_prefix.c_str());
+    exit(EXIT_SUCCESS);
+#endif
+
     // Initialize the cdl_exec code (not quite sure why this needs a
     // separate object rather than just a bunch of statics). 
-    cdl_exec exec (trim_path (repository), savefile, trim_path (install_prefix), no_resolve);
+    cdl_exec exec (trim_path (repository), savefile, trim_path (install_prefix), trim_path (build_prefix), no_resolve);
     cdl_exec::set_quiet_mode(quiet);
     cdl_exec::set_verbose_mode(verbose);
     cdl_exec::set_ignore_errors_mode(ignore_errors);
@@ -442,6 +485,9 @@
     printf ("  qualifiers are:\n");
     printf ("    --config=FILE                              : the configuration file\n");
     printf ("    --prefix=DIRECTORY                         : the install prefix\n");
+    printf ("    --install-prefix=DIRECTORY                 : the install prefix (same as --prefix)\n");
+    printf ("    --build-prefix=DIRECTORY                   : the build prefix\n");
+    printf ("    -C, --use-configtool-paths                 : make default install and build prefixes like configtool's\n");
     printf ("    --srcdir=DIRECTORY                         : the source repository\n");
     printf ("    --no-resolve                               : disable conflict resolution\n");
     printf ("    --version                                  : show version and copyright\n");

[-- Attachment #3: Type: text/plain, Size: 148 bytes --]

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-02-13 23:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-08 20:56 [ECOS] Build tree paths Timothy M. Schaeffer
2008-02-11  9:11 ` [ECOS] " John Dallaway
2008-02-11 12:07   ` Gary Thomas
2008-02-11 12:41     ` John Dallaway
2008-02-13 23:32       ` Timothy M. Schaeffer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).