tools/rc/convert.sh
author unC0Rr
Mon, 16 Sep 2024 16:57:11 +0200
branchtransitional_engine
changeset 16063 09beeec033ba
parent 15981 5aed6c0b63e2
permissions -rwxr-xr-x
Sanitize maze mapgen code a bit
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
15981
5aed6c0b63e2 Start PoC of pas2rust conversion routine
unc0rr
parents:
diff changeset
     1
#!/usr/bin/env sh
5aed6c0b63e2 Start PoC of pas2rust conversion routine
unc0rr
parents:
diff changeset
     2
5aed6c0b63e2 Start PoC of pas2rust conversion routine
unc0rr
parents:
diff changeset
     3
ls ../rc || exit
5aed6c0b63e2 Start PoC of pas2rust conversion routine
unc0rr
parents:
diff changeset
     4
5aed6c0b63e2 Start PoC of pas2rust conversion routine
unc0rr
parents:
diff changeset
     5
rm -rdfv build engine
5aed6c0b63e2 Start PoC of pas2rust conversion routine
unc0rr
parents:
diff changeset
     6
mkdir -p build engine
5aed6c0b63e2 Start PoC of pas2rust conversion routine
unc0rr
parents:
diff changeset
     7
cd build
5aed6c0b63e2 Start PoC of pas2rust conversion routine
unc0rr
parents:
diff changeset
     8
cmake -DNOSERVER=on -DBUILD_ENGINE_C=on -DLUA_SYSTEM=on -DNOVIDEOREC=off ../../../
5aed6c0b63e2 Start PoC of pas2rust conversion routine
unc0rr
parents:
diff changeset
     9
cmake --build . --target engine_c
5aed6c0b63e2 Start PoC of pas2rust conversion routine
unc0rr
parents:
diff changeset
    10
5aed6c0b63e2 Start PoC of pas2rust conversion routine
unc0rr
parents:
diff changeset
    11
# this one you can get from pip: pip install scan-build
5aed6c0b63e2 Start PoC of pas2rust conversion routine
unc0rr
parents:
diff changeset
    12
intercept-build cmake --build . --target hwengine
5aed6c0b63e2 Start PoC of pas2rust conversion routine
unc0rr
parents:
diff changeset
    13
c2rust transpile --emit-build-files --emit-modules --reduce-type-annotations --binary hwengine compile_commands.json --output-dir=../engine
5aed6c0b63e2 Start PoC of pas2rust conversion routine
unc0rr
parents:
diff changeset
    14
5aed6c0b63e2 Start PoC of pas2rust conversion routine
unc0rr
parents:
diff changeset
    15
cd ../engine
5aed6c0b63e2 Start PoC of pas2rust conversion routine
unc0rr
parents:
diff changeset
    16
sed -i 's/f128.*//g' Cargo.toml
5aed6c0b63e2 Start PoC of pas2rust conversion routine
unc0rr
parents:
diff changeset
    17
sed -i 's/extern crate f128.*//g' lib.rs
5aed6c0b63e2 Start PoC of pas2rust conversion routine
unc0rr
parents:
diff changeset
    18
sed -i 's/mod src {/mod src{\npub mod to_f64;/g' lib.rs
5aed6c0b63e2 Start PoC of pas2rust conversion routine
unc0rr
parents:
diff changeset
    19
find -type f -name '*.rs' -exec sed -i 's/f128/f64/g' {} \; -exec sed -i 's/f64::f64/f64/g' {} \; -exec sed -i 's/use ::f64;/use crate::src::to_f64::to_f64;/g' {} \; -exec sed -i 's/f64::new/to_f64/g' {} \;
5aed6c0b63e2 Start PoC of pas2rust conversion routine
unc0rr
parents:
diff changeset
    20
cp ../to_f64.rs src/