1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 17:57:34 +00:00
serenity/Meta/gn/secondary/Userland/Libraries/LibTimeZone/BUILD.gn
Andrew Kaster 0e24bfb464 Meta: Add file download and archive extraction tools to gn build
Use them to download and extract the TZDB files
2023-07-09 16:22:58 -06:00

59 lines
1.4 KiB
Text

import("//Meta/gn/build/compiled_action.gni")
import("//Meta/gn/build/download_cache.gni")
import("//Meta/gn/build/download_file.gni")
import("//Meta/gn/build/extract_archive_contents.gni")
declare_args() {
# If true, Download tzdata from data.iana.org and use it in LibTimeZone
# Data will be downloaded to $cache_path/TZDB
enable_timezone_database_download = true
}
tzdb_cache = cache_path + "TZDB/"
if (enable_timezone_database_download) {
download_file("timezone_database_download") {
version = "2023c"
url =
"https://data.iana.org/time-zones/releases/tzdata" + version + ".tar.gz"
cache = tzdb_cache
output = "tzdb.tar.gz"
version_file = "version.txt"
}
extract_archive_contents("timezone_database_files") {
deps = [ ":timezone_database_download" ]
archive = get_target_outputs(":timezone_database_download")
directory = tzdb_cache
# NOSORT
files = [
"zone1970.tab",
"africa",
"antarctica",
"asia",
"australasia",
"backward",
"etcetera",
"europe",
"northamerica",
"southamerica",
]
}
}
source_set("LibTimeZone") {
output_name = "timezone"
include_dirs = [ "//Userland/Libraries" ]
sources = [
"Forward.h",
"TimeZone.cpp",
"TimeZone.h",
]
deps = [
"//AK",
"//Userland/Libraries/LibCore",
]
if (enable_timezone_database_download) {
deps += [ ":timezone_database_files" ]
}
}