git.iko.soy/typeable/nixpkgs
on master help sign in
buildRustCrate: binary heuristic should be able to treat spaces
fdc2017Andreas Rammhold
pkgs/build-support/rust/build-rust-crate/build-crate.nix+4−5
@@ -117,15 +117,14 @@
117
117
118 # the first two cases are the "new" default IIRC
118 # the first two cases are the "new" default IIRC
119 BIN_NAME_=$(echo $BIN_NAME | sed -e 's/-/_/g')
119 BIN_NAME_=$(echo $BIN_NAME | sed -e 's/-/_/g')
120− FILES="src/bin/$BIN_NAME_.rs src/bin/$BIN_NAME_/main.rs src/bin/main.rs src/main.rs"
120+ FILES=( "src/bin/$BIN_NAME_.rs" "src/bin/$BIN_NAME_/main.rs" "src/bin/main.rs" "src/main.rs" )
121
121
122 if ! [ -e "${libPath}" -o -e src/lib.rs -o -e "src/${libName}.rs" ]; then
122 if ! [ -e "${libPath}" -o -e src/lib.rs -o -e "src/${libName}.rs" ]; then
123 # if this is not a library the following path is also valid
123 # if this is not a library the following path is also valid
124− FILES="src/$BIN_NAME_.rs $FILES"
124+ FILES=( "src/$BIN_NAME_.rs" "''${FILES[@]}" )
125 fi
125 fi
126
126
127− echo $FILES
128− for file in $FILES;
127+ for file in "''${FILES[@]}";
129 do
128 do
130 echo "checking file $file"
129 echo "checking file $file"
131 # first file that exists wins
130 # first file that exists wins
@@ -140,7 +139,7 @@
140 exit 1
139 exit 1
141 fi
140 fi
142 fi
141 fi
143− build_bin $BIN_NAME $BIN_PATH
142+ build_bin "$BIN_NAME" "$BIN_PATH"
144 done
143 done
145
144
146
145