[gnome-settings-daemon/wip/inigomartinez/meson: 2/5] build: Add support for command line arguments



commit b29700182ab3e0e21c0572d9c3df581c20907c35
Author: Iñigo Martínez <inigomartinez gmail com>
Date:   Thu Feb 1 08:47:31 2018 +0100

    build: Add support for command line arguments
    
    The `gsd-power-constants-update.pl` has the files it uses hardcoded.
    
    This patch modifies those hardcoded files so they can be specified
    from the command line.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=793087

 plugins/power/Makefile.am                   |    2 +-
 plugins/power/gsd-power-constants-update.pl |    9 ++++++---
 2 files changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/plugins/power/Makefile.am b/plugins/power/Makefile.am
index 94606ad..7a7ba8d 100644
--- a/plugins/power/Makefile.am
+++ b/plugins/power/Makefile.am
@@ -99,7 +99,7 @@ gsd-power-enums.c: gsd-power-constants.h gsm-inhibitor-flag.h gsm-presence-flag.
 BUILT_SOURCES += $(GSD_POWER_ENUM_FILES)
 
 gsdpowerconstants.py: gsd-power-constants-update.pl gsd-power-constants.h
-       $(AM_V_GEN) $(srcdir)/gsd-power-constants-update.pl
+       $(AM_V_GEN) $(srcdir)/gsd-power-constants-update.pl gsd-power-constants.h $@
 
 gsdpowerenums.py: gsd-power-enums-update gsd-power-enums.h gsd-power-enums.c
        $(AM_V_GEN) $(builddir)/gsd-power-enums-update > $@
diff --git a/plugins/power/gsd-power-constants-update.pl b/plugins/power/gsd-power-constants-update.pl
index cd7bb1a..1615131 100755
--- a/plugins/power/gsd-power-constants-update.pl
+++ b/plugins/power/gsd-power-constants-update.pl
@@ -12,10 +12,13 @@ use strict;
 # Used for reading the keysymdef symbols.
 my @constantselements;
 
-die "Could not open file gsd-power-constants.h: $!\n" unless open(IN_CONSTANTS, "<:utf8", 
"gsd-power-constants.h");
+(scalar @ARGV >= 2) or die "Usage: $0 <input> <output>\n";
+my ($input, $output) = @ARGV;
+
+die "Could not open file gsd-power-constants.h: $!\n" unless open(IN_CONSTANTS, "<:utf8", $input);
 
 # Output: gtk+/gdk/gdkkeysyms.h
-die "Could not open file gsdpowerconstants.py: $!\n" unless open(OUT_CONSTANTS, ">:utf8", 
"gsdpowerconstants.py");
+die "Could not open file gsdpowerconstants.py: $!\n" unless open(OUT_CONSTANTS, ">:utf8", $output);
 
 print OUT_CONSTANTS<<EOF;
 
@@ -43,4 +46,4 @@ while (<IN_CONSTANTS>)
 
 close IN_CONSTANTS;
 
-printf "We just finished converting gsd-power-constants.h to gsdpowerconstants.py\nThank you\n";
+printf "We just finished converting $input to $output\nThank you\n";


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]