-
Notifications
You must be signed in to change notification settings - Fork 0
/
INSTALL-SWI.md
executable file
·163 lines (130 loc) · 3.74 KB
/
INSTALL-SWI.md
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
#!/bin/bash -x
function MAINTAINER {
echo $*
}
function RUN {
$*
}
set +e
DIR0="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
cd $DIR0
export LOGICMOO_WS=$DIR0
./logicmoo_env.sh .
INSTALL_BASE="$LOGICMOO_WS/lib/swipl"
if [ -d "$INSTALL_BASE" ]; then
echo "#* "
echo "#* GOOD: SWI-Prolog was installed so we wont try to APT update dependencies"
echo "#* (if there was a problem with them rm -rf ${INSTALL_BASE} and restart this script)"
echo "#* "
else
echo "#* "
echo "#* Install deps..."
echo "#* "
if [[ $EUID -ne 0 ]]; then
echo "#* "
echo -e "\e[1;31mERROR This script must be run as root. \e[0m"
echo "#* "
return 1 2>/dev/null
exit 1
fi
#apt-add-repository -y ppa:swi-prolog/devel
#apt-get install -y swi-prolog elpa-ediprolog swi-prolog-java swi-prolog-odbc swi-prolog-bdb
#apt-get remove -y swi-prolog
#apt-get -y install cmake ninja-build $(apt-cache depends swi-prolog-x | grep Depends | sed "s/.*ends:\//" | tr '\n' ' ')
#apt-get build-dep swi-prolog
# # default-jdk junit4 \
apt-get update
apt-get install -y \
build-essential cmake ninja-build pkg-config \
ncurses-dev libreadline-dev libedit-dev \
libgoogle-perftools-dev \
libunwind-dev \
libgmp-dev \
libssl-dev \
unixodbc-dev \
zlib1g-dev libarchive-dev \
libossp-uuid-dev \
libxext-dev libice-dev libjpeg-dev libxinerama-dev libxft-dev \
libxpm-dev libxt-dev \
libdb-dev \
libpcre3-dev \
junit4 qt5-default \
default-jdk \
libyaml-dev \
texlive
MAINTAINER apt-get install -y \
texlive-latex-extra \
texlive-font-utils \
texlive-fonts-extra \
texlive-fonts-extra-doc \
texlive-fonts-recommended \
texlive-fonts-recommended-doc
fi
(
cd $LOGICMOO_WS
INSTALL_BASE="$LOGICMOO_WS/lib/swipl"
SWI_TAG=master
if [[ -z "${SWI_TAG}" ]]; then
SWI_TAG=master
# SWI_TAG=tags/V8.3.22
fi
if ! [ -d "$LOGICMOO_WS/swipl-devel" ]; then
( cd $LOGICMOO_WS
git clone https://github.com/SWI-Prolog/swipl-devel.git swipl-devel
cd swipl-devel
git checkout $SWI_TAG .
git checkout $SWI_TAG
git submodule update --init
git checkout $SWI_TAG --recurse-submodules
#patch -p1 --merge < /opt/logicmoo_workspace/Patch/dmiles-attvar.patch
#patch -p1 --merge < /opt/logicmoo_workspace/Patch/dmiles-save-reference-error.patch
#patch -p1 --merge < /opt/logicmoo_workspace/Patch/dmiles-no-sandbox.patch
#patch -p1 --merge < /opt/logicmoo_workspace/Patch/0001-dmiles.patch
#patch -p1 --merge < /opt/logicmoo_workspace/Patch/0002-dmiles2.patch
patch -p1 --merge < /opt/logicmoo_workspace/Patch/dmiles-all.patch
git checkout library/threadutil.pl
( cd packages/ssl ; patch -p1 --merge < /opt/logicmoo_workspace/Patch/dmiles-ssl.patch )
)
fi
(
cd swipl-devel/
#git reset --hard HEAD
#git clean -f -x
#git checkout . -f
git pull origin $SWI_TAG --recurse-submodules
git status -s
)
MAKE=ninja
MAKE=make
(cd swipl-devel
# \cp -a ../Patch/rootfs/usr/local/lib/swipl/* .
rm -rf build
mkdir -p build
cd build
cmake -DCMAKE_INSTALL_PREFIX=$LOGICMOO_WS -G "Unix Makefiles" ..
#cmake -DBUILD_PDF_DOCUMENTATION=ON -DCMAKE_INSTALL_PREFIX=$LOGICMOO_WS -G "Unix Makefiles" ..
# cmake -DCMAKE_INSTALL_PREFIX=$LOGICMOO_WS -G Ninja ..
$MAKE -j 40
ctest -j 40
if [ -d "$INSTALL_BASE" ]; then
echo "#* "
echo "#* rm -rf*ing swipl in ${INSTALL_BASE}..."
echo "#* "
rm -rf "$INSTALL_BASE"
fi
$MAKE install
# rm -rf swipl-devel/build
)
(
cd packs_sys/swicli
./make-linux.sh
)
find packs_* -name "*.qlf"
# swipl
stty sane
echo "#* MAYBE cat .swiplrc >> ~/.config/swi-prolog/init.pl"
#mkdir -p bin/
#mkdir .local/share/swi-prolog/pack -p
#chmod 555 .local/share/swi-prolog/pack
)
stty sane