Commits

camlspotter committed d1c40b7

simplification

  • Participants
  • Parent commits de1512a
  • Branches android

Comments (0)

Files changed (1)

 
 (* Android SDK compiler check *)
 
+let must_exist dir name = 
+  if not (Sys.file_exists (sprintf "%s/%s" dir name)) then
+    failwithf "%s is not found at %s" dir name
+  else printf "%s found in %s\n%!" dir name
+
 let cross_tool_dir = 
   sprintf "%s/toolchains/%s-linux-androideabi-%s/prebuilt/%s" 
     ndk_home target_arch gcc_version host_arch
     ndk_home platform_version target_arch 
 
 let _ = 
-  if not (Sys.file_exists (sprintf "%s/bin/%s-linux-androideabi-gcc" cross_tool_dir target_arch)) then
-    failwithf "gcc is not found at %s/bin" cross_tool_dir
-  else printf "gcc found in %s/bin\n%!" cross_tool_dir;
-  
-  if not (Sys.file_exists (sprintf "%s/libgcc.a" libgcc_dir)) then
-    failwithf "libgcc.a is not found at %s" libgcc_dir
-  else printf "libgcc.a found in %s\n%!" libgcc_dir;
-
-  if not (Sys.file_exists (sprintf "%s/libc.so" libc_dir)) then
-    failwithf "libc.so is not found at %s" libc_dir
-  else printf "libc.so found in %s\n%!" libc_dir;
-
-  if not (Sys.file_exists (sprintf "%s/usr/include/stdlib.h" target_root_dir)) then
-    failwithf "stdlib.h is not found at %s/usr/include" target_root_dir
-  else printf "stdlib.h found in %s/usr/include\n%!" target_root_dir
+  must_exist ndk_home "ndk-build";
+  must_exist cross_tool_dir (sprintf "bin/%s-linux-androideabi-gcc" target_arch);
+  must_exist libgcc_dir "libgcc.a";
+  must_exist libc_dir "libc.so";
+  must_exist target_root_dir "usr/include/stdlib.h"
 
 (* Create config/Makefile *)
 let tbl = [ "prefix"          , prefix