summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2017-04-11 10:25:34 -0400
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2017-04-23 21:47:27 -0400
commit9cc0e6e99ca3645b87c22fecdaa9ba9965a12e4f (patch)
treed2983b55e3e36dd00095d1593b559a1effa9128d
parent3131bfe302d3d2657576499a86827ca979846b81 (diff)
meson: make cpp invocations cross-compilation friendly
This implementation assumes that the arguments in compiler.cmd_array() don't contain any spaces. Since we are only interested in compilation on Linux, I think this is a safe assumption. Solution suggested by Nirbheek Chauhan.
-rw-r--r--meson.build2
-rw-r--r--src/basic/generate-af-list.sh2
-rw-r--r--src/basic/generate-arphrd-list.sh2
-rw-r--r--src/basic/generate-cap-list.sh2
-rw-r--r--src/basic/generate-errno-list.sh2
-rw-r--r--src/basic/meson.build8
-rw-r--r--src/journal/generate-audit_type-list.sh6
-rw-r--r--src/journal/meson.build2
-rw-r--r--src/udev/generate-keyboard-keys-list.sh2
-rw-r--r--src/udev/meson.build2
10 files changed, 18 insertions, 12 deletions
diff --git a/meson.build b/meson.build
index 57e439e733..8c01872a26 100644
--- a/meson.build
+++ b/meson.build
@@ -295,6 +295,8 @@ foreach arg : ['-Wl,-z,relro',
endif
endforeach
+cpp = ' '.join(cc.cmd_array()) + ' -E'
+
#####################################################################
# compilation result tests
diff --git a/src/basic/generate-af-list.sh b/src/basic/generate-af-list.sh
index e4f9f68312..3fdfe2ea60 100644
--- a/src/basic/generate-af-list.sh
+++ b/src/basic/generate-af-list.sh
@@ -1,5 +1,5 @@
#!/bin/sh
-cpp -dM -include sys/socket.h - </dev/null | \
+$1 -E -dM -include sys/socket.h - </dev/null | \
grep -Ev 'AF_UNSPEC|AF_MAX' | \
awk '/^#define[ \t]+AF_[^ \t]+[ \t]+PF_[^ \t]/ { print $2; }'
diff --git a/src/basic/generate-arphrd-list.sh b/src/basic/generate-arphrd-list.sh
index e4cd8ab6d2..9911f315fa 100644
--- a/src/basic/generate-arphrd-list.sh
+++ b/src/basic/generate-arphrd-list.sh
@@ -1,5 +1,5 @@
#!/bin/sh -e
-cpp -dM -include net/if_arp.h - </dev/null | \
+$1 -dM -include net/if_arp.h - </dev/null | \
awk '/^#define[ \t]+ARPHRD_[^ \t]+[ \t]+[^ \t]/ { print $2; }' | \
sed -e 's/ARPHRD_//'
diff --git a/src/basic/generate-cap-list.sh b/src/basic/generate-cap-list.sh
index de4b44661e..b79468cd59 100644
--- a/src/basic/generate-cap-list.sh
+++ b/src/basic/generate-cap-list.sh
@@ -1,5 +1,5 @@
#!/bin/sh -e
-cpp -dM -include linux/capability.h -include "$1" -include "$2" - </dev/null | \
+$1 -dM -include linux/capability.h -include "$2" -include "$3" - </dev/null | \
awk '/^#define[ \t]+CAP_[A-Z_]+[ \t]+/ { print $2; }' | \
grep -v CAP_LAST_CAP
diff --git a/src/basic/generate-errno-list.sh b/src/basic/generate-errno-list.sh
index 291b118f36..a80990ac24 100644
--- a/src/basic/generate-errno-list.sh
+++ b/src/basic/generate-errno-list.sh
@@ -1,4 +1,4 @@
#!/bin/sh -e
-cpp -dM -include errno.h - </dev/null | \
+$1 -dM -include errno.h - </dev/null | \
awk '/^#define[ \t]+E[^ _]+[ \t]+/ { print $2; }'
diff --git a/src/basic/meson.build b/src/basic/meson.build
index 23caa1c7a5..17049481aa 100644
--- a/src/basic/meson.build
+++ b/src/basic/meson.build
@@ -206,28 +206,28 @@ generate_af_list = find_program('generate-af-list.sh')
af_list_txt = custom_target(
'af-list.txt',
output : 'af-list.txt',
- command : [generate_af_list],
+ command : [generate_af_list, cpp],
capture : true)
generate_arphrd_list = find_program('generate-arphrd-list.sh')
arphrd_list_txt = custom_target(
'arphrd-list.txt',
output : 'arphrd-list.txt',
- command : [generate_arphrd_list],
+ command : [generate_arphrd_list, cpp],
capture : true)
generate_cap_list = find_program('generate-cap-list.sh')
cap_list_txt = custom_target(
'cap-list.txt',
output : 'cap-list.txt',
- command : [generate_cap_list, config_h, missing_h],
+ command : [generate_cap_list, cpp, config_h, missing_h],
capture : true)
generate_errno_list = find_program('generate-errno-list.sh')
errno_list_txt = custom_target(
'errno-list.txt',
output : 'errno-list.txt',
- command : [generate_errno_list],
+ command : [generate_errno_list, cpp],
capture : true)
generated_gperf_headers = []
diff --git a/src/journal/generate-audit_type-list.sh b/src/journal/generate-audit_type-list.sh
index a8befbfea2..edd2b27994 100644
--- a/src/journal/generate-audit_type-list.sh
+++ b/src/journal/generate-audit_type-list.sh
@@ -1,10 +1,14 @@
#!/bin/sh -e
+cpp="$1"
+shift
+
includes=""
for i in "$@"; do
includes="$includes -include $i"
done
-cpp -dM $includes - </dev/null | \
+
+$cpp -dM $includes - </dev/null | \
grep -vE 'AUDIT_.*(FIRST|LAST)_' | \
sed -r -n 's/^#define\s+AUDIT_(\w+)\s+([0-9]{4})\s*$$/\1\t\2/p' | \
sort -k2
diff --git a/src/journal/meson.build b/src/journal/meson.build
index f06b564c19..360c52b92d 100644
--- a/src/journal/meson.build
+++ b/src/journal/meson.build
@@ -35,7 +35,7 @@ generate_audit_type_list = find_program('generate-audit_type-list.sh')
audit_type_list_txt = custom_target(
'audit_type-list.txt',
output : 'audit_type-list.txt',
- command : [generate_audit_type_list] + audit_type_includes,
+ command : [generate_audit_type_list, cpp] + audit_type_includes,
capture : true)
audit_type_to_name = custom_target(
diff --git a/src/udev/generate-keyboard-keys-list.sh b/src/udev/generate-keyboard-keys-list.sh
index cd6ef9c93b..91635caebc 100644
--- a/src/udev/generate-keyboard-keys-list.sh
+++ b/src/udev/generate-keyboard-keys-list.sh
@@ -1,4 +1,4 @@
#!/bin/sh -e
-cpp -dM -include linux/input.h - </dev/null | \
+$1 -dM -include linux/input.h - </dev/null | \
awk '/^#define[ \t]+KEY_[^ ]+[ \t]+[0-9K]/ { if ($2 != "KEY_MAX") { print $2 } }'
diff --git a/src/udev/meson.build b/src/udev/meson.build
index dd8ec53cdf..fdd73046dc 100644
--- a/src/udev/meson.build
+++ b/src/udev/meson.build
@@ -58,7 +58,7 @@ generate_keyboard_keys_list = find_program('generate-keyboard-keys-list.sh')
keyboard_keys_list_txt = custom_target(
'keyboard-keys-list.txt',
output : 'keyboard-keys-list.txt',
- command : [generate_keyboard_keys_list],
+ command : [generate_keyboard_keys_list, cpp],
capture : true)
fname = 'keyboard-keys-from-name.gperf'