1
1
#! /usr/bin/env sh
2
2
echo ' [INFO] Feral Installer - (c) Copyright 2020 Maximilian Götz (https://www.maxbits.net/)'
3
- echo ' [INFO] Please make sure that Sudo, Git, CMake, LibGMP and LibMPFR are installed!'
4
- echo ' [INFO] Installation started. Fetching system cores...'
3
+ echo ' [INFO] Please make sure that Git, CMake, LibGMP and LibMPFR are installed!'
5
4
6
5
# Get current working directory
7
6
CWD=" $( pwd) "
@@ -29,23 +28,8 @@ if [ "$SYSNAME" = "Darwin" ]; then
29
28
export CXXFLAGS=" $CXXFLAGS -I$BREWGMP /include -I$BREWMPFR /include -I$BREWMPC /include"
30
29
export LDFLAGS=" $LDFLAGS -L$BREWGMP /lib -L$BREWMPFR /lib -L$BREWMPC /lib"
31
30
fi
32
- CORES=1
33
- # Get system cores for faster build
34
- if [ " $SYSNAME " = " Linux" ]; then
35
- CORES=$( nproc)
36
- else # for BSD and macOS
37
- CORES=$( sysctl -n hw.ncpu)
38
- fi
39
- echo " [INFO] Using $CORES cores"
40
31
41
- echo ' [INFO] Checking for Git, Sudo and CMake...'
42
- # No sudo on macOS since /usr/local is not usually root owned (as long as homebrew is installed)
43
- SUDO=" sudo"
44
- if [ " $SYSNAME " = " Darwin" ] && hash brew 2> /dev/null || [ " $( id -u) " = " 0" ]; then
45
- SUDO=" "
46
- else
47
- echo ' [INFO] Using sudo.'
48
- fi
32
+ echo ' [INFO] Checking for Git and CMake...'
49
33
50
34
# Check for Git
51
35
if hash git 2> /dev/null; then
55
39
exit
56
40
fi
57
41
58
- # Check for sudo
59
- if [ " $SUDO " = " sudo" ]; then
60
- if hash sudo 2> /dev/null; then
61
- echo ' [INFO] sudo found.'
62
- else
63
- echo ' [FATAL] sudo not available! Install it to continue! Aborting...'
64
- exit
65
- fi
66
- fi
67
-
68
42
# Check for CMake
69
43
if hash cmake 2> /dev/null; then
70
44
echo ' [INFO] CMake found.'
@@ -79,12 +53,14 @@ trap exit_handler INT
79
53
80
54
build () {
81
55
mkdir build && cd build
56
+ CORES=" "
82
57
if [ -n " $CI " ]; then
83
58
export DISABLE_MARCH_NATIVE=" true"
59
+ CORES=" $NPROC "
84
60
fi
85
61
cmake .. -DCMAKE_BUILD_TYPE=Release
86
62
if [ " $? " -ne 0 ]; then exit 1; fi
87
- make -j$CORES install
63
+ make -j$NPROC install
88
64
if [ " $? " -ne 0 ]; then exit 1; fi
89
65
cd ..
90
66
}
0 commit comments