You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

linux-compile-vrpn.pl 1.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #!/usr/bin/perl
  2. # Intended to be run from linux-install_dependencies.pl
  3. #
  4. # Variables are wrt that parent scope
  5. #
  6. if (!$no_install) {
  7. my $old_dir = Cwd::getcwd();
  8. my $vrpn_src_dir = $dependencies_arch_dir . "/vrpn";
  9. # fetch the packages
  10. chdir "$dependencies_arch_dir";
  11. if (! -e "vrpn_07_31-ov.zip") {
  12. system('wget "http://openvibe.inria.fr/dependencies/linux-x86/vrpn_07_31-ov.zip"');
  13. ($CHILD_ERROR != 0) and die ("Could not download the itpp external sources [$CHILD_ERROR]");
  14. }
  15. if (! -e $vrpn_src_dir) {
  16. system('unzip "vrpn_07_31-ov.zip"');
  17. ($CHILD_ERROR != 0) and die ("Could not extract the itpp external archive");
  18. }
  19. # compile
  20. print "Compiling vrpn ...\n";
  21. my $bitness = `uname -m`;
  22. chomp($bitness);
  23. my $bitness_token = "";
  24. if($bitness == "x86_64") {
  25. # 64bit
  26. $bitness_token = "pc_linux64";
  27. system('sed -i "s/#HW_OS := pc_linux$/HW_OS := pc_linux64/g" vrpn/quat/Makefile');
  28. system('sed -i "s/#HW_OS := pc_linux$/HW_OS := pc_linux64/g" vrpn/Makefile');
  29. } else {
  30. $bitness_token = "pc_linux";
  31. system('sed -i "s/#HW_OS := pc_linux$/HW_OS := pc_linux/g" vrpn/quat/Makefile');
  32. system('sed -i "s/CC := gcc/CC := gcc -fPIC/g" vrpn/quat/Makefile');
  33. system('sed -i "s/#HW_OS := pc_linux$/HW_OS := pc_linux/g" vrpn/Makefile');
  34. system('sed -i "s/CC := gcc/CC := gcc -fPIC/g" vrpn/Makefile');
  35. system('sed -i "s/CC := g++/CC := g++ -fPIC/g" vrpn/Makefile');
  36. }
  37. system("cd vrpn/quat && make >make-quat.log 2>&1");
  38. system("cd vrpn && make >make-vrpn.log 2>&1");
  39. mkdir("$dependencies_dir/include");
  40. mkdir("$dependencies_dir/lib");
  41. system("chmod a-x vrpn/quat/*.h vrpn/*.h");
  42. system("cp vrpn/quat/*.h vrpn/*.h $dependencies_dir/include");
  43. system("cp vrpn/quat/$bitness_token/*.a vrpn/$bitness_token/*.a $dependencies_dir/lib");
  44. chdir $old_dir
  45. };