]> cygwin.com Git - cygwin-apps/setup.git/commitdiff
* Makefile.in: Eliminate duplicate -nostdinc from CFLAGS.
authorChristopher Faylor <me@cgf.cx>
Thu, 13 Apr 2000 16:56:35 +0000 (16:56 +0000)
committerChristopher Faylor <me@cgf.cx>
Thu, 13 Apr 2000 16:56:35 +0000 (16:56 +0000)
* setup.c (create_uninstall): Create the uninstall .bat file in the "root" so
that we can remove the /bin directory.  Add bin\cygwin.bat to list of files to
be deleted.  Fix directory detection for determining when to use 'rmdir'.
(do_start_menu): Add /usr/local/bin to the path.
(main): Add slop to files.array allocation so that we don't have to worry about
reallocating the array when it grows too large when doing some trivial
"pushes".  Add /tmp and /usr/local/{bin,lib} to list of files.

ChangeLog
Makefile.in
setup.c

index b57a3e52ea22b755b82396848bf386a2cf3c8232..ed37f9ee33b22f19e55c89edf5a6829a59f06ba7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+Thu Apr 13 12:51:19 2000  Christopher Faylor <cgf@cygnus.com>
+
+       * Makefile.in: Eliminate duplicate -nostdinc from CFLAGS.
+       * setup.c (create_uninstall): Create the uninstall .bat file in the
+       "root" so that we can remove the /bin directory.  Add bin\cygwin.bat to
+       list of files to be deleted.  Fix directory detection for determining
+       when to use 'rmdir'.
+       (do_start_menu): Add /usr/local/bin to the path.
+       (main): Add slop to files.array allocation so that we don't have to
+       worry about reallocating the array when it grows too large when doing
+       some trivial "pushes".  Add /tmp and /usr/local/{bin,lib} to list of
+       files.
+
 Thu Apr 13 01:59:44 2000  Christopher Faylor <cgf@cygnus.com>
 
        * setup.c (processdirlisting): Fix handling of "A" for "A"lways
index 0de5d9710e6b55af75d7e17b60473998e6fdc741..a4c955733c4a02b5031f1ac3253833ccea146e51 100644 (file)
@@ -38,8 +38,8 @@ include $(srcdir)/../Makefile.common
 
 MINGW_INCLUDES:=-I$(mingw_source)/include -I$(w32api_include)
 
-MINGW_CXXFLAGS:=$(CXXFLAGS) -nostdinc++ -mno-cygwin $(MINGW_INCLUDES)
-MINGW_CFLAGS:=$(CFLAGS) -nostdinc -mno-cygwin $(MINGW_INCLUDES)
+MINGW_CXXFLAGS:=$(CXXFLAGS) -mno-cygwin $(MINGW_INCLUDES)
+MINGW_CFLAGS:=$(CFLAGS) -mno-cygwin $(MINGW_INCLUDES)
 
 ZLIB=zlib/libzcygw.a
 libmingw32.a:=$(mingw_build)/libmingw32.a
diff --git a/setup.c b/setup.c
index 2fcf0195e8e298e89e8b2df05087b6d9e7e16a11..4a5d216b4da8f3740e5cf936a49c2060930168bb 100644 (file)
--- a/setup.c
+++ b/setup.c
 #define NFILE_LIST 10000
 #endif
 
+#ifndef NFILE_SLOP
+#define NFILE_SLOP 20
+#endif
+
 char *wd;
 
 int downloaddir (HINTERNET session, const char *url);
@@ -197,7 +201,7 @@ tarx (const char *dir, const char *fn, FILE *logfp)
        {
          if (++files.index >= files.count)
            files.array = realloc (files.array,
-                                      files.count += NFILE_LIST);
+                                  NFILE_SLOP + (files.count += NFILE_LIST));
          s = buffer;
          if (*s != '/')
            *--s = '/';
@@ -739,19 +743,22 @@ create_uninstall (const char *wd, const char *folder, const char *shellscut,
     {
       size_t n;
       FILE *uninst;
+      char cwd[MAX_PATH];
+      char *uninstfile;
 
-      files.count = files.index + 1;
-      qsort (files.array, files.count, sizeof (char *), reverse_sort);
-
-      uninst = fopen ("bin\\uninst.bat", "wt");
+      getcwd (cwd, sizeof (cwd));
+      uninstfile = pathcat (cwd, "uninst.bat");
+      uninst = fopen (uninstfile, "wt");
 
       if (uninst)
        {
-         char cwd[MAX_PATH];
-         char *uninstfile;
          unsigned percent = 0;
+         struct _stat st;
+
+         files.array[++files.index] = pathcat (cwd, "bin\\cygwin.bat");
+         files.count = files.index + 1;
+         qsort (files.array, files.count, sizeof (char *), reverse_sort);
 
-         getcwd (cwd, sizeof (cwd));
          fprintf (uninst,
                   "@echo off\n" "%c:\n" "cd \"%s\"\n", *cwd, cwd);
          for (n = 0; n < files.count; ++n)
@@ -763,7 +770,7 @@ create_uninstall (const char *wd, const char *folder, const char *shellscut,
 
              dpath = files.array[n];
 
-             if (files.array[n][strlen (files.array[n]) - 1] == '\\')
+             if (_stat (dpath, &st) == 0 && st.st_mode & _S_IFDIR)
                fprintf (uninst, "rmdir \"%s\"\n", dpath);
              else
                {
@@ -776,15 +783,11 @@ create_uninstall (const char *wd, const char *folder, const char *shellscut,
                   "del \"%s\"\n"
                   "del \"%s\"\n"
                   "rmdir \"%s\"\n"
-                  "del bin\\uninst.bat\n", shortcut, shellscut,
-                  folder);
+                  "del %s\n", shortcut, shellscut,
+                  folder, uninstfile);
          fclose (uninst);
 
-         uninstfile = pathcat (cwd, "bin\\uninst.bat");
-         if (uninstfile)
-           {
-             create_shortcut (uninstfile, shortcut);
-           }
+         create_shortcut (uninstfile, shortcut);
        }
       sa_cleanup (&files);
       retval = 1;
@@ -819,7 +822,7 @@ do_start_menu (const char *root)
          fprintf (batch,
                   "@echo off\n"
                   "SET MAKE_MODE=unix\n"
-                  "SET PATH=%s\\bin;%%PATH%%\n"
+                  "SET PATH=%s\\bin;%s\\usr\\local\\bin;%%PATH%%\n"
                   "bash\n", root, root);
          fclose (batch);
 
@@ -1138,7 +1141,7 @@ main ()
              mkmount (wd, root, "lib", "/usr/lib", 1);
 
              files.count = NFILE_LIST;
-             files.array = calloc (sizeof (char *), NFILE_LIST);
+             files.array = calloc (sizeof (char *), NFILE_LIST + NFILE_SLOP);
              files.index = -1;
 
              /* Extract all of the packages that are stored with setup or in
@@ -1160,16 +1163,23 @@ main ()
                    }
                  else
                    {
+                     char **a;
                      /* bash expects a /tmp */
                      char *tmpdir = pathcat (root, "tmp");
 
                      if (tmpdir)
                        {
+                         files.array[++files.index] = tmpdir;
                          mkdir (tmpdir);       /* Ignore the result, it may
                                                   exist. */
-                         xfree (tmpdir);
                        }
 
+                     files.array[++files.index] = pathcat (root, "usr\\local");
+                     files.array[++files.index] = pathcat (root, "usr\\local\\bin");
+                     files.array[++files.index] = pathcat (root, "usr\\local\\lib");
+                     mkdirp (files.array[files.index]);
+                     mkdir (files.array[files.index - 1]);
+
                      if (do_start_menu (root))
                        retval = 0;     /* Everything worked return
                                           successful code */
This page took 0.040713 seconds and 5 git commands to generate.