)
)
-# If we have pubsuffix.cc in the source tree, use it. Otherwise download and build it.
-pubsuffix_dl_source = 'effective_tld_names.dat'
-pubsuffix_cc = src_dir / 'pubsuffix.cc'
-if not fs.is_file(pubsuffix_cc)
- curl_command = find_program('curl', required: true)
- pubsuffix_dl_source = custom_target(
- 'pubsuffix-dl',
- command: [curl_command, '-s', '-S', '-o', '@OUTPUT@', 'https://publicsuffix.org/list/public_suffix_list.dat'],
- output: pubsuffix_dl_source
+# If we have pubsuffix.cc in the source tree, use it. Otherwise download data and build it in the build dir.
+if fs.is_file(src_dir / 'pubsuffix.cc')
+ cp_command = find_program('cp')
+ pubsuffix_cc = custom_target(
+ 'cp-pubsuffix',
+ command: [cp_command, '-p', '@INPUT@', '@OUTPUT@'],
+ input: src_dir / 'pubsuffix.cc',
+ output: 'pubsuffix.cc',
)
-
+else
mkpubsuffix_command = find_program('mkpubsuffixcc', required: true)
pubsuffix_cc = custom_target(
'pubsuffix-cc',
- command: [mkpubsuffix_command, '@INPUT@', '@OUTPUT@'],
- input: pubsuffix_dl_source,
+ command: [mkpubsuffix_command, '@OUTPUT@'],
output: 'pubsuffix.cc',
)
endif
#!/bin/sh
-if [ -z "$1" ] || [ -z "$2" ]; then
- echo "Usage: $0 effective_tld_names.dat pubsuffix.cc"
+if [ -z "$1" ]; then
+ echo "Usage: $0 pubsuffix.cc"
exit 1
fi
set -e
-(echo "const char* g_pubsuffix[]={";
- for a in $(grep -v "//" "$1" | grep \\. | egrep "^[.0-9a-z-]*$")
- do
+temp=$(mktemp pubsuffixXXXXXX)
+curl -s -S https://publicsuffix.org/list/public_suffix_list.dat > $temp
+(echo "const char* g_pubsuffix[]={";
+ for a in $(grep -v "//" "$temp" | grep \\. | egrep "^[.0-9a-z-]*$")
+ do
echo \"$a\",
- done
-echo "0};") > "$2"
+ done
+echo "0};") > "$1"
+rm -f "$temp"