@@ -457,23 +457,38 @@ def common_installer_capnproto(properties):
457457
458458 return True
459459
460+ def make_llvm_url (long_version , product ):
461+ int_version = int (long_version .replace ("." , "" ))
462+ # LLVM from 9.0.1 is hosted on github
463+ if int_version > 900 :
464+ #https://github.com/llvm/llvm-project/releases/download/llvmorg-10.0.0/llvm-10.0.0.src.tar.xz
465+ if product == "cfe" :
466+ product = "clang"
467+ url = "https://github.com/llvm/llvm-project/releases/download/llvmorg-" + long_version + "/" + product + "-" + long_version + ".src.tar.xz"
468+ else :
469+ #https://releases.llvm.org/9.0.0/llvm-9.0.0.src.tar.xz
470+ url = "https://releases.llvm.org/" + long_version + "/" + product + "-" + long_version + ".src.tar.xz"
471+ return url
472+
460473def common_installer_llvm (properties ):
461474 repository_path = properties ["repository_path" ]
462475 verbose_output = properties ["verbose" ]
463476 debug = properties ["debug" ]
464477
465- llvm_tarball_url = "http://releases.llvm.org/" + properties ["long_llvm_version" ] + "/llvm-" + properties ["long_llvm_version" ] + ".src.tar.xz"
466- llvm_tarball_name = "llvm-" + str (properties ["llvm_version" ]) + ".tar.xz"
478+ sv = str (properties ["llvm_version" ])
479+ lv = str (properties ["long_llvm_version" ])
480+ llvm_tarball_url = make_llvm_url (lv , product = "llvm" )
481+ llvm_tarball_name = "llvm-" + sv + ".tar.xz"
467482
468- clang_tarball_url = "http://releases.llvm.org/" + properties [ "long_llvm_version" ] + "/ cfe-" + properties [ "long_llvm_version" ] + ".src.tar.xz"
469- clang_tarball_name = "clang-" + str ( properties [ "llvm_version" ]) + ".tar.xz"
483+ clang_tarball_url = make_llvm_url ( lv , product = " cfe" )
484+ clang_tarball_name = "clang-" + sv + ".tar.xz"
470485 use_libcxx = sys .platform != "win32" and properties ["include_libcxx" ]
471486 if use_libcxx :
472- libcxx_tarball_url = "http://releases.llvm.org/" + properties [ "long_llvm_version" ] + "/ libcxx-" + properties [ "long_llvm_version" ] + ".src.tar.xz"
473- libcxx_tarball_name = "libcxx-" + str ( properties [ "llvm_version" ]) + ".tar.xz"
487+ libcxx_tarball_url = make_llvm_url ( lv , product = " libcxx" )
488+ libcxx_tarball_name = "libcxx-" + sv + ".tar.xz"
474489
475- libcxxabi_tarball_url = "http://releases.llvm.org/" + properties [ "long_llvm_version" ] + "/ libcxxabi-" + properties [ "long_llvm_version" ] + ".src.tar.xz"
476- libcxxabi_tarball_name = "libcxxabi-" + str ( properties [ "llvm_version" ]) + ".tar.xz"
490+ libcxxabi_tarball_url = make_llvm_url ( lv , product = " libcxxabi" )
491+ libcxxabi_tarball_name = "libcxxabi-" + sv + ".tar.xz"
477492
478493 # download everything we need
479494 llvm_tarball_path = download_file (properties , llvm_tarball_url , "sources" , llvm_tarball_name )
@@ -509,7 +524,7 @@ def common_installer_llvm(properties):
509524 if not extract_archive (libcxxabi_tarball_path , "sources" ):
510525 return False
511526
512- llvm_root_folder = os .path .realpath (os .path .join ("sources" , "llvm-" + str ( properties [ "long_llvm_version" ] + ".src" ) ))
527+ llvm_root_folder = os .path .realpath (os .path .join ("sources" , "llvm-" + lv + ".src" ))
513528
514529 try :
515530 print (" > Moving the project folders in the LLVM source tree..." )
@@ -525,7 +540,12 @@ def common_installer_llvm(properties):
525540
526541 clang_destination = os .path .join (llvm_root_folder , "tools" , "clang" )
527542 if not os .path .isdir (clang_destination ):
528- shutil .move (os .path .join ("sources" , "cfe-" + properties ["long_llvm_version" ] + ".src" ), clang_destination )
543+ cfe_name = "cfe-"
544+
545+ if int (properties ["llvm_version" ]) > 900 :
546+ cfe_name = "clang-"
547+
548+ shutil .move (os .path .join ("sources" , cfe_name + properties ["long_llvm_version" ] + ".src" ), clang_destination )
529549
530550 except Exception as e :
531551 print (" ! " + str (e ))
@@ -558,8 +578,11 @@ def common_installer_llvm(properties):
558578 arch_list += ";AArch64;Sparc"
559579 arch_list += "'"
560580
581+ cppstd = "11"
582+ if int (properties ["llvm_version" ]) > 900 :
583+ cppstd = "14"
561584 cmake_command = ["cmake" ] + get_env_compiler_settings () + get_cmake_build_type (debug ) + ["-DCMAKE_INSTALL_PREFIX=" + destination_path ,
562- "-DCMAKE_CXX_STANDARD=11" , "-DLLVM_TARGETS_TO_BUILD=" + arch_list ,
585+ "-DCMAKE_CXX_STANDARD=" + cppstd , "-DLLVM_TARGETS_TO_BUILD=" + arch_list ,
563586 "-DLLVM_ENABLE_RTTI=ON" , "-DLLVM_INCLUDE_EXAMPLES=OFF" ,
564587 "-DLLVM_INCLUDE_TESTS=OFF" ]
565588
0 commit comments