svf-lib 1.0.1848 → 1.0.1850

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/llvm_install.sh +41 -19
  2. package/package.json +1 -1
package/llvm_install.sh CHANGED
@@ -1,29 +1,48 @@
1
1
  #!/bin/bash
2
2
  SVFHOME=$(pwd)
3
3
  sysOS=`uname -s`
4
- MacLLVM="https://github.com/llvm/llvm-project/releases/download/llvmorg-14.0.0/clang+llvm-14.0.0-x86_64-apple-darwin.tar.xz"
5
- UbuntuLLVM="https://github.com/llvm/llvm-project/releases/download/llvmorg-14.0.0/clang+llvm-14.0.0-x86_64-linux-gnu-ubuntu-18.04.tar.xz"
4
+ MajorLLVMVer=16
5
+ LLVMVer=${MajorLLVMVer}.0.0
6
+ UbuntuLLVM="https://github.com/llvm/llvm-project/releases/download/llvmorg-${LLVMVer}/clang+llvm-${LLVMVer}-x86_64-linux-gnu-ubuntu-18.04.tar.xz"
6
7
  MacZ3="https://github.com/Z3Prover/z3/releases/download/z3-4.8.8/z3-4.8.8-x64-osx-10.14.6.zip"
7
8
  UbuntuZ3="https://github.com/Z3Prover/z3/releases/download/z3-4.8.8/z3-4.8.8-x64-ubuntu-16.04.zip"
8
9
  Z3Home="z3.obj"
9
- LLVMHome="llvm-14.0.0.obj"
10
+ LLVMHome="llvm-${LLVMVer}.obj"
10
11
  cd $SVFHOME
11
12
  cd ..
12
13
  install_path=$(pwd)
14
+
15
+ function check_and_install_brew {
16
+ if command -v brew >/dev/null 2>&1; then
17
+ echo "Homebrew is already installed."
18
+ else
19
+ echo "Homebrew not found. Installing Homebrew..."
20
+ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
21
+ if [ $? -eq 0 ]; then
22
+ echo "Homebrew installation completed."
23
+ else
24
+ echo "Homebrew installation failed."
25
+ exit 1
26
+ fi
27
+ fi
28
+ }
29
+
13
30
  ########
14
31
  # Download LLVM binary
15
32
  ########
16
33
  if [[ $sysOS == "Darwin" ]]
17
34
  then
18
- if [ ! -d "$install_path/$LLVMHome" ]
19
- then
20
- echo 'Downloading LLVM binary for MacOS '
21
- curl -L $MacLLVM > llvm-mac.tar.xz
22
- mkdir $install_path/$LLVMHome
23
- echo 'Unzipping LLVM binary for MacOS '
24
- tar -xf "llvm-mac.tar.xz" -C $install_path/$LLVMHome --strip-components 1
25
- rm llvm-mac.tar.xz
35
+ check_and_install_brew
36
+ echo "Installing LLVM binary"
37
+ brew install llvm@${MajorLLVMVer}
38
+ # check whether llvm is installed
39
+ if [ $? -eq 0 ]; then
40
+ echo "LLVM binary installation completed."
41
+ else
42
+ echo "LLVM binary installation failed."
43
+ exit 1
26
44
  fi
45
+ export LLVM_DIR="$(brew --prefix llvm@${MajorLLVMVer})"
27
46
  elif [[ $sysOS == "Linux" ]]
28
47
  then
29
48
  if [ ! -d "$install_path/$LLVMHome" ]
@@ -34,11 +53,12 @@ then
34
53
  echo 'Unzipping LLVM binary for Ubuntu'
35
54
  tar -xf "llvm-ubuntu.tar.xz" -C $install_path/$LLVMHome --strip-components 1
36
55
  rm llvm-ubuntu.tar.xz
56
+ export LLVM_DIR="$install_path/$LLVMHome"
37
57
  fi
38
58
  else
39
59
  echo 'not support llvm builds in OS other than Ubuntu and Mac'
40
60
  fi
41
- echo "LLVM_DIR=$install_path/$LLVMHome"
61
+ echo "LLVM_DIR=$LLVM_DIR"
42
62
  ########
43
63
  # Download z3 binary
44
64
  ########
@@ -67,15 +87,17 @@ then
67
87
  else
68
88
  echo 'not support z3 builds in OS other than Ubuntu and Mac'
69
89
  fi
70
- echo "Z3_DIR=$install_path/$Z3Home"
90
+ export Z3_DIR="$install_path/$Z3Home"
91
+ echo "Z3_DIR=$Z3_DIR"
92
+ export SVF_DIR="$install_path/SVF"
93
+ echo "SVF_DIR=$SVF_DIR"
94
+
71
95
  if [[ $sysOS == "Darwin" ]]
72
96
  then
73
- ln -s $install_path/svf-lib/SVF-osx $install_path/SVF
74
- echo "SVF_DIR=$install_path/SVF/"
75
- echo -e "Build your own project with the following cmake command:\n cmake -DSVF_DIR=$install_path/SVF/SVF-osx -DLLVM_DIR=$install_path/$LLVMHome"
97
+ ln -s $install_path/svf-lib/SVF-osx $SVF_DIR
98
+ echo -e "Build your own project with the following cmake command:\n cmake -DSVF_DIR=$SVF_DIR -DLLVM_DIR=$LLVM_DIR"
76
99
  elif [[ $sysOS == "Linux" ]]
77
100
  then
78
- ln -s $install_path/svf-lib/SVF-linux $install_path/SVF
79
- echo "SVF_DIR=$install_path/SVF/"
80
- echo -e "Build your own project with the following cmake command:\n cmake -DSVF_DIR=$install_path/SVF/SVF-linux -DLLVM_DIR=$install_path/$LLVMHome"
101
+ ln -s $install_path/svf-lib/SVF-linux $SVF_DIR
102
+ echo -e "Build your own project with the following cmake command:\n cmake -DSVF_DIR=$SVF_DIR -DLLVM_DIR=$LLVM_DIR"
81
103
  fi
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svf-lib",
3
- "version": "1.0.1848",
3
+ "version": "1.0.1850",
4
4
  "description": "SVF's npm support",
5
5
  "main": "index.js",
6
6
  "scripts": {