[Libreoffice-commits] .: 2 commits - avmedia/source solenv/bin

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri Oct 12 09:47:48 PDT 2012


 avmedia/source/gstreamer/gstframegrabber.hxx |    2 
 solenv/bin/concat-deps.c                     |  124 +++++++++++++++++++++++----
 2 files changed, 109 insertions(+), 17 deletions(-)

New commits:
commit d0bf1510632801e15f1f498320c90efb6d773d6e
Author: Michael Meeks <michael.meeks at suse.com>
Date:   Thu Oct 11 19:14:39 2012 +0100

    detect and collapse internal boost dependencies to a single header
    
    Change-Id: I18281f9cdf4c20ab4f939b2f7d3b0a6c3bf5387b

diff --git a/solenv/bin/concat-deps.c b/solenv/bin/concat-deps.c
index 11571ee..81a4792 100644
--- a/solenv/bin/concat-deps.c
+++ b/solenv/bin/concat-deps.c
@@ -109,9 +109,9 @@
 #define FALSE 0
 #endif
 
-static char* base_dir_var = "$(SRCDIR)";
-#define kBASE_DIR_VAR_LENGTH 9
+int internal_boost = 0;
 static char* base_dir;
+static char* out_dir;
 
 #ifdef __GNUC__
 #define clz __builtin_clz
@@ -711,15 +711,23 @@ static inline void eat_space(char ** token)
 }
 
 /*
+ * Find substring in bounded length string
+ */
+static inline const char *find_substr(const char *key, int key_len,
+                                      const char *substr, int substr_len)
+{
+}
+
+/*
  * Prune LibreOffice specific duplicate dependencies to improve
  * gnumake startup time, and shrink the disk-space footprint.
  */
-static inline int elide_dependency(const char* key, int key_len)
+static inline int elide_dependency(const char* key, int key_len, int *boost_count)
 {
 #if 0
     {
         int i;
-        fprintf (stderr, "elide?!: '");
+        fprintf (stderr, "elide?%d!: '", internal_boost);
         for (i = 0; i < key_len; i++) {
             fprintf (stderr, "%c", key[i]);
         }
@@ -730,14 +738,48 @@ static inline int elide_dependency(const char* key, int key_len)
     /* .hdl files are always matched by .hpp */
     if (key_len > 4 && !strncmp(key + key_len - 4, ".hdl", 4))
         return 1;
+
+    /* boost brings a plague of header files */
+    if (internal_boost)
+    {
+        int i;
+        int hit = 0;
+        /* walk down path elements */
+        for (i = 0; i < key_len - 1; i++)
+        {
+            if (key[i] == '/')
+            {
+                if (!strncmp(key + i + 1, "solver/", 7))
+                    hit++;
+                if (hit > 0 && !strncmp(key + i + 1, "inc/external/boost/", 19))
+                {
+                    if (boost_count)
+                        (*boost_count)++;
+                    return 1;
+                }
+            }
+        }
+    }
+
     return 0;
 }
 
+/*
+ * We collapse tens of internal boost headers to a single one, such
+ * that you can re-compile / install boost and all is well.
+ */
+static void emit_single_boost_header(void)
+{
+#define BOOST_HEADER "/inc/external/boost/bind.hpp"
+    fprintf(stdout, "%s" BOOST_HEADER " ", out_dir);
+}
+
 /* prefix paths to absolute */
 static inline void print_fullpaths(char* line)
 {
     char* token;
     char* end;
+    int boost_count = 0;
 
     token = line;
     eat_space(&token);
@@ -748,18 +790,30 @@ static inline void print_fullpaths(char* line)
             ++end;
         }
         int token_len = end - token;
-        if(elide_dependency(token, token_len))
-            ; /* don't output it */
+        if(elide_dependency(token, token_len, &boost_count))
+        {
+            if (boost_count == 1)
+                emit_single_boost_header();
+            else
+            {
+                /* don't output, and swallow trailing \\\n if any */
+                token = end;
+                eat_space(&token);
+                if (token[0] == '\\' && token[1] == '\n')
+                    end = token + 2;
+            }
+        }
         else if(*token == ':' || *token == '\\' || *token == '/' ||
                 *token == '$' || ':' == token[1])
         {
             fwrite(token, token_len, 1, stdout);
+            fputc(' ', stdout);
         }
         else
         {
             fwrite(token, end - token, 1, stdout);
+            fputc(' ', stdout);
         }
-        fputc(' ', stdout);
         token = end;
         eat_space(&token);
     }
@@ -821,7 +875,7 @@ off_t size;
                              * duplicate out
                              */
                             int key_len = cursor_out - base;
-                            if(!elide_dependency(base,key_len - 1) &&
+                            if(!elide_dependency(base,key_len - 1, NULL) &&
                                hash_store(dep_hash, base, key_len))
                             {
                                 /* DO NOT modify base after it has been added
@@ -887,6 +941,17 @@ static void _usage(void)
 
 #define kDEFAULT_HASH_SIZE 4096
 
+static int get_var(char **var, const char *name)
+{
+    *var = (char *)getenv(name);
+    if(!*var)
+    {
+        fprintf(stderr,"Error: %s is missing in the environement\n", name);
+        return 1;
+    }
+    return 0;
+}
+
 int main(int argc, char** argv)
 {
 int rc = 0;
@@ -895,18 +960,18 @@ char* in_list;
 char* in_list_cursor;
 char* in_list_base;
 struct hash* dep_hash;
+const char *env_str;
 
     if(argc < 2)
     {
         _usage();
         return 1;
     }
-    base_dir = getenv("SRCDIR");
-    if(!base_dir)
-    {
-        fputs("Error: SRCDIR is missing in the environement\n", stderr);
+    if(get_var(&base_dir, "SRCDIR") || get_var(&out_dir, "OUTDIR"))
         return 1;
-    }
+
+    env_str = getenv("SYSTEM_BOOST");
+    internal_boost = !env_str || strcmp(env_str,"TRUE");
 
     in_list = file_load(argv[1], &in_list_size, &rc);
     if(!rc)
commit 140281898f21f707582f395918e5234bdb67e435
Author: Michael Meeks <michael.meeks at suse.com>
Date:   Thu Oct 11 18:45:38 2012 +0100

    elide all dependencies on .hdl files, they're ~all duplicated by .hpp
    
    Also - verified that codemaker touches both .hdl and .hpp regardless
    of whether the contents changed in anyway under gbuild.
    
    Change-Id: I391e9cf952c61a6c59087cd7cd0ddc8c54a14df3

diff --git a/avmedia/source/gstreamer/gstframegrabber.hxx b/avmedia/source/gstreamer/gstframegrabber.hxx
index 0b87c74..e5ce553 100644
--- a/avmedia/source/gstreamer/gstframegrabber.hxx
+++ b/avmedia/source/gstreamer/gstframegrabber.hxx
@@ -21,7 +21,7 @@
 #define _FRAMEGRABBER_HXX
 
 #include "gstplayer.hxx"
-#include "com/sun/star/media/XFrameGrabber.hdl"
+#include <com/sun/star/media/XFrameGrabber.hpp>
 #include <cppuhelper/implbase2.hxx>
 
 namespace avmedia { namespace gstreamer {
diff --git a/solenv/bin/concat-deps.c b/solenv/bin/concat-deps.c
index 5180f46..11571ee 100644
--- a/solenv/bin/concat-deps.c
+++ b/solenv/bin/concat-deps.c
@@ -710,11 +710,34 @@ static inline void eat_space(char ** token)
     }
 }
 
+/*
+ * Prune LibreOffice specific duplicate dependencies to improve
+ * gnumake startup time, and shrink the disk-space footprint.
+ */
+static inline int elide_dependency(const char* key, int key_len)
+{
+#if 0
+    {
+        int i;
+        fprintf (stderr, "elide?!: '");
+        for (i = 0; i < key_len; i++) {
+            fprintf (stderr, "%c", key[i]);
+        }
+        fprintf (stderr, "'\n");
+    }
+#endif
+
+    /* .hdl files are always matched by .hpp */
+    if (key_len > 4 && !strncmp(key + key_len - 4, ".hdl", 4))
+        return 1;
+    return 0;
+}
+
 /* prefix paths to absolute */
 static inline void print_fullpaths(char* line)
 {
-char* token;
-char* end;
+    char* token;
+    char* end;
 
     token = line;
     eat_space(&token);
@@ -724,15 +747,16 @@ char* end;
         while (*end && (' ' != *end) && ('\t' != *end)) {
             ++end;
         }
-        if(*token == ':' || *token == '\\' || *token == '/' || *token == '$'
-            || ':' == token[1])
+        int token_len = end - token;
+        if(elide_dependency(token, token_len))
+            ; /* don't output it */
+        else if(*token == ':' || *token == '\\' || *token == '/' ||
+                *token == '$' || ':' == token[1])
         {
-            fwrite(token, end - token, 1, stdout);
+            fwrite(token, token_len, 1, stdout);
         }
         else
         {
-            fputs(base_dir_var, stdout);
-            fputc('/', stdout);
             fwrite(token, end - token, 1, stdout);
         }
         fputc(' ', stdout);
@@ -741,6 +765,7 @@ char* end;
     }
 }
 
+
 static int _process(struct hash* dep_hash, char* fn)
 {
 int rc;
@@ -795,7 +820,9 @@ off_t size;
                              * these are the one for which we want to filter
                              * duplicate out
                              */
-                            if(hash_store(dep_hash, base, (int)(cursor_out - base)))
+                            int key_len = cursor_out - base;
+                            if(!elide_dependency(base,key_len - 1) &&
+                               hash_store(dep_hash, base, key_len))
                             {
                                 /* DO NOT modify base after it has been added
                                    as key by hash_store */


More information about the Libreoffice-commits mailing list