build into build dir with build script
This commit is contained in:
parent
5dae359a1e
commit
76a9e3a5ca
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,2 +1,3 @@
|
||||
target/
|
||||
build/
|
||||
Makefile
|
||||
|
17
Makefile.in
17
Makefile.in
@ -45,7 +45,7 @@ persistent = $(if $(filter $(enable_persistent),yes),True,False)
|
||||
all: $(builddir) $(outputs)
|
||||
|
||||
clean:
|
||||
rm -rf $(outdir)
|
||||
rm -rf $(outdir) $(builddir)
|
||||
|
||||
distprep: $(distdir)
|
||||
cp -a configure $(distdir)
|
||||
@ -63,20 +63,7 @@ test: all
|
||||
cargo test
|
||||
|
||||
build: all
|
||||
cargo build --release
|
||||
cp -a target/release/systemd-crontab-generator \
|
||||
target/release/crontab \
|
||||
target/release/remove-stale-stamps \
|
||||
target/release/mail-on-failure \
|
||||
target/release/boot-delay \
|
||||
$(builddir)/bin/
|
||||
cp -a target/release/build/systemd-crontab-generator-*/out/*.target \
|
||||
target/release/build/systemd-crontab-generator-*/out/*.service \
|
||||
target/release/build/systemd-crontab-generator-*/out/*.timer \
|
||||
target/release/build/systemd-crontab-generator-*/out/*.path \
|
||||
$(builddir)/units/
|
||||
cp -a target/release/build/systemd-crontab-generator-*/out/*.[1578] \
|
||||
$(builddir)/man/
|
||||
cargo install --path . --root $(builddir)
|
||||
|
||||
install: build
|
||||
install -m2755 -g `getent group cron || echo root` -s -D $(builddir)/bin/crontab $(DESTDIR)$(bindir)/crontab
|
||||
|
14
build.rs
14
build.rs
@ -3,7 +3,7 @@ extern crate rustc_serialize;
|
||||
|
||||
use std::env;
|
||||
use std::path::Path;
|
||||
use std::fs::{self, File};
|
||||
use std::fs::{self, File, create_dir_all};
|
||||
use std::io::{Read, Write};
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
@ -15,7 +15,11 @@ static MAN_DIR: &'static str = "man";
|
||||
|
||||
fn main() {
|
||||
let out_dir = env::var("OUT_DIR").unwrap();
|
||||
let output = Path::new(&*out_dir);
|
||||
let units_out_dir = env::var("CARGO_MANIFEST_DIR").unwrap();
|
||||
let output = Path::new(&*units_out_dir).join("out").join("build");
|
||||
|
||||
create_dir_all(output.join("units")).unwrap();
|
||||
create_dir_all(output.join("man")).unwrap();
|
||||
|
||||
let data = build_render_data();
|
||||
|
||||
@ -33,15 +37,15 @@ fn main() {
|
||||
for schedule_unit in [ "target", "timer", "service" ].iter() {
|
||||
compile_template(
|
||||
format!("{}/cron-schedule.{}.in", UNITS_DIR, schedule_unit),
|
||||
output.join(format!("cron-{}.{}", schedule, schedule_unit)),
|
||||
output.join("units").join(format!("cron-{}.{}", schedule, schedule_unit)),
|
||||
&data);
|
||||
}
|
||||
}
|
||||
|
||||
data.as_object_mut().unwrap().insert("schedules".to_owned(), schedules.to_json());
|
||||
|
||||
compile_templates(UNITS_DIR, output, &data);
|
||||
compile_templates(MAN_DIR, output, &data);
|
||||
compile_templates(UNITS_DIR, output.join("units"), &data);
|
||||
compile_templates(MAN_DIR, output.join("man"), &data);
|
||||
}
|
||||
|
||||
fn compile_template<S: AsRef<Path>, T: AsRef<Path>>(source_file: S, target_file: T, data: &Json) {
|
||||
|
Loading…
Reference in New Issue
Block a user