1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
//! Build script for generating the geocoding database.
//!
//! This script runs at compile time to download and process geographic data from GeoNames,
//! creating a compact binary database that gets embedded into the compiled binary.
//!
//! # Build Process
//!
//! 1. Downloads administrative codes (admin1, admin2) from GeoNames
//! 2. Downloads place data for selected countries
//! 3. Downloads postal code data
//! 4. Merges postal codes with places
//! 5. Deduplicates entries
//! 6. Builds string interning table
//! 7. Creates spatial grid index
//! 8. Serializes to binary format
//!
//! # Skip Conditions
//!
//! The build is skipped when:
//! - `no-build-database` feature is enabled
//! - Building on docs.rs (`DOCS_RS` env var set)
//! - Running clippy (`CLIPPY_ARGS` env var set)
//! - Database file already exists in `OUT_DIR`
//!
//! # Output
//!
//! Generates `places.bin` in the cargo `OUT_DIR`, which is then embedded into the binary
//! using `include_bytes!` in the main crate.
use PathBuf;
use Builder;