[gtk-doc] gtkdoc-scan*obj: allow to pass compiler/link setup via flags
- From: Stefan Kost <stefkost src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk-doc] gtkdoc-scan*obj: allow to pass compiler/link setup via flags
- Date: Fri, 31 May 2013 11:53:51 +0000 (UTC)
commit 39afed2894254d33150cd6e3799ae52600d39ccf
Author: Henrik Stokseth <henrik hshq net>
Date: Thu May 30 21:34:17 2013 +0200
gtkdoc-scan*obj: allow to pass compiler/link setup via flags
CMake can't export environment variables, so I added --cflags, --ldflags etc.
parameters to gtkdoc-scanobj and gtkdoc-scangobj so that compiler flags can
be passed on the command line.
Fixes: #686148
gtkdoc-scangobj.in | 38 ++++++++++++++++++++++++++++++++------
gtkdoc-scanobj.in | 38 ++++++++++++++++++++++++++++++++------
2 files changed, 64 insertions(+), 12 deletions(-)
---
diff --git a/gtkdoc-scangobj.in b/gtkdoc-scangobj.in
index 5a1a001..d0e8b7c 100644
--- a/gtkdoc-scangobj.in
+++ b/gtkdoc-scangobj.in
@@ -41,6 +41,12 @@ my $PRINT_HELP;
my $TYPE_INIT_FUNC="#if !GLIB_CHECK_VERSION(2,35,0)\n g_type_init();\n #endif\n
g_type_class_ref(G_TYPE_OBJECT)";
my $QUERY_CHILD_PROPERTIES;
+my $CC;
+my $LD;
+my $CFLAGS;
+my $LDFLAGS;
+my $RUN;
+
# --nogtkinit is deprecated, as it is the default now anyway.
%optctl = (module => \$MODULE,
types => \$TYPES_FILE,
@@ -48,11 +54,16 @@ my $QUERY_CHILD_PROPERTIES;
'type-init-func' => \$TYPE_INIT_FUNC,
'query-child-properties' => \$QUERY_CHILD_PROPERTIES,
'output-dir' => \$OUTPUT_DIR,
+ 'cc' => \$CC,
+ 'ld' => \$LD,
+ 'cflags' => \$CFLAGS,
+ 'ldflags' => \$LDFLAGS,
+ 'run' => \$RUN,
'verbose' => \$VERBOSE,
'version' => \$PRINT_VERSION,
'help' => \$PRINT_HELP);
-GetOptions(\%optctl, "module=s", "types:s", "output-dir:s", "nogtkinit", "type-init-func:s",
"query-child-properties:s", "verbose", "version", "help");
+GetOptions(\%optctl, "module=s", "types:s", "output-dir:s", "nogtkinit", "type-init-func:s",
"query-child-properties:s", "cc:s", "ld:s", "run:s", "cflags:s", "ldflags:s", "verbose", "version", "help");
if ($NO_GTK_INIT) {
# Do nothing. This just avoids a warning.
@@ -78,6 +89,11 @@ gtkdoc-scangobj version @VERSION@ - introspect g-objects
--query-child-properties=FUNC A function that returns a list of child
properties for a class
--output-dir=DIRNAME The directory where the results are stored
+--cc=COMPILER The compiler to use
+--ld=LINKER The linker to use
+--run=RUN Command for running the scanner
+--cflags=CFLAGS Compiler flags
+--ldflags=LDFLAGS Linker flags
--verbose Print extra output while processing
--version Print the version of this program
--help Print this help
@@ -1349,11 +1365,21 @@ close OUTPUT;
# Compile and run our file
-$CC = $ENV{CC} ? $ENV{CC} : "gcc";
-$LD = $ENV{LD} ? $ENV{LD} : $CC;
-$CFLAGS = $ENV{CFLAGS} ? $ENV{CFLAGS} : "";
-$LDFLAGS = $ENV{LDFLAGS} ? $ENV{LDFLAGS} : "";
-$RUN = $ENV{RUN} ? $ENV{RUN} : "";
+unless ($CC) {
+ $CC = $ENV{CC} ? $ENV{CC} : "gcc";
+}
+unless ($LD) {
+ $LD = $ENV{LD} ? $ENV{LD} : $CC;
+}
+unless ($CFLAGS) {
+ $CFLAGS = $ENV{CFLAGS} ? $ENV{CFLAGS} : "";
+}
+unless ($LDFLAGS) {
+ $LDFLAGS = $ENV{LDFLAGS} ? $ENV{LDFLAGS} : "";
+}
+unless ($RUN) {
+ $RUN = $ENV{RUN} ? $ENV{RUN} : "";
+}
my $o_file;
if ($CC =~ /libtool/) {
diff --git a/gtkdoc-scanobj.in b/gtkdoc-scanobj.in
index 5745cff..bd8bf22 100755
--- a/gtkdoc-scanobj.in
+++ b/gtkdoc-scanobj.in
@@ -37,14 +37,25 @@ my $MODULE;
my $OUTPUT_DIR;
my $PRINT_VERSION;
+my $CC;
+my $LD;
+my $CFLAGS;
+my $LDFLAGS;
+my $RUN;
+
%optctl = (module => \$MODULE,
types => \$TYPES_FILE,
nogtkinit => \$NO_GTK_INIT,
'output-dir' => \$OUTPUT_DIR,
+ 'cc' => \$CC,
+ 'ld' => \$LD,
+ 'cflags' => \$CFLAGS,
+ 'ldflags' => \$LDFLAGS,
+ 'run' => \$RUN,
'version' => \$PRINT_VERSION,
'help' => \$PRINT_HELP);
-GetOptions(\%optctl, "module=s", "types:s", "output-dir:s", "nogtkinit", "version", "help");
+GetOptions(\%optctl, "module=s", "types:s", "output-dir:s", "nogtkinit", "cc:s", "ld:s", "run:s",
"cflags:s", "ldflags:s", "version", "help");
if ($PRINT_VERSION) {
print "@VERSION \n";
@@ -62,6 +73,11 @@ gtkdoc-scanobj version @VERSION@ - introspect gtk-objects
--module=MODULE_NAME Name of the doc module being parsed
--types=FILE The name of the file to store the types in
--output-dir=DIRNAME The directory where the results are stored
+--cc=COMPILER The compiler to use
+--ld=LINKER The linker to use
+--run=RUN Command for running the scanner
+--cflags=CFLAGS Compiler flags
+--ldflags=LDFLAGS Linker flags
--version Print the version of this program
--help Print this help
EOF
@@ -518,11 +534,21 @@ close OUTPUT;
# Compile and run our file
-$CC = $ENV{CC} ? $ENV{CC} : "gcc";
-$LD = $ENV{LD} ? $ENV{LD} : $CC;
-$CFLAGS = $ENV{CFLAGS} ? $ENV{CFLAGS} : "";
-$LDFLAGS = $ENV{LDFLAGS} ? $ENV{LDFLAGS} : "";
-$RUN = $ENV{RUN} ? $ENV{RUN} : "";
+unless ($CC) {
+ $CC = $ENV{CC} ? $ENV{CC} : "gcc";
+}
+unless ($LD) {
+ $LD = $ENV{LD} ? $ENV{LD} : $CC;
+}
+unless ($CFLAGS) {
+ $CFLAGS = $ENV{CFLAGS} ? $ENV{CFLAGS} : "";
+}
+unless ($LDFLAGS) {
+ $LDFLAGS = $ENV{LDFLAGS} ? $ENV{LDFLAGS} : "";
+}
+unless ($RUN) {
+ $RUN = $ENV{RUN} ? $ENV{RUN} : "";
+}
my $o_file;
if ($CC =~ /libtool/) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]