File: build.rs

package info (click to toggle)
rustc 1.85.0%2Bdfsg3-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental, sid, trixie
  • size: 893,396 kB
  • sloc: xml: 158,127; python: 35,830; javascript: 19,497; cpp: 19,002; sh: 17,245; ansic: 13,127; asm: 4,376; makefile: 1,051; perl: 29; lisp: 29; ruby: 19; sql: 11
file content (39 lines) | stat: -rw-r--r-- 1,223 bytes parent folder | download | duplicates (4)
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
// Copyright 2014-2017  The html5ever Project Developers. See the
// COPYRIGHT file at the top-level directory of this distribution.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.

use std::env;
use std::path::Path;
use std::thread::Builder;

#[path = "macros/match_token.rs"]
mod match_token;

fn main() {
    let manifest_dir = env::var("CARGO_MANIFEST_DIR").unwrap();

    let input = Path::new(&manifest_dir).join("src/tree_builder/rules.rs");
    let output = Path::new(&env::var("OUT_DIR").unwrap()).join("rules.rs");
    println!("cargo:rerun-if-changed={}", input.display());

    #[cfg(target_os = "haiku")]
    let stack_size = 16;

    #[cfg(not(target_os = "haiku"))]
    let stack_size = 128;

    // We have stack overflows on Servo's CI.
    let handle = Builder::new()
        .stack_size(stack_size * 1024 * 1024)
        .spawn(move || {
            match_token::expand(&input, &output);
        })
        .unwrap();

    handle.join().unwrap();
}