Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
d0bf1510
Kaydet (Commit)
d0bf1510
authored
Eki 11, 2012
tarafından
Michael Meeks
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
detect and collapse internal boost dependencies to a single header
Change-Id: I18281f9cdf4c20ab4f939b2f7d3b0a6c3bf5387b
üst
14028189
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
78 additions
and
13 deletions
+78
-13
concat-deps.c
solenv/bin/concat-deps.c
+78
-13
No files found.
solenv/bin/concat-deps.c
Dosyayı görüntüle @
d0bf1510
...
...
@@ -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
...
...
@@ -710,16 +710,24 @@ 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
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment