Skip to content

Commit cecaeec

Browse files
committed
Installer getting better. Fixed Java install. Removing repo after all
1 parent 43fbeca commit cecaeec

1 file changed

Lines changed: 27 additions & 14 deletions

File tree

tools/install.sh

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/sh
1+
#!/bin/bash
22

33
# Global Configurations
44
TENSORFLOW_GPU_ENABLED="n"
@@ -78,13 +78,13 @@ fetch() {
7878
local dir=`basename $tarball .tar.gz`
7979

8080
echo ""
81-
echo "= downloading $tarball"
81+
echo "= downloading $tarball $2"
8282
curl -# -L $1 -o $tarball \
8383
&& echo "== unpacking" \
8484
&& tar -zxf $tarball \
8585
&& echo "== removing tarball" \
8686
&& rm -fr $tarball \
87-
&& make_install $dir
87+
&& make_install $dir $2
8888
}
8989

9090
fetch_xz() {
@@ -120,10 +120,10 @@ make_install() {
120120
local dir=$1
121121

122122
echo ""
123-
echo "= installing $1"
123+
echo "= installing $1 $2"
124124

125125
cd $dir \
126-
&& ./configure --disable-dependency-tracking --prefix=$PREFIX \
126+
&& ./configure --disable-dependency-tracking --prefix=$PREFIX $2 \
127127
&& make \
128128
&& make install \
129129
&& echo "... removing $dir" \
@@ -178,11 +178,24 @@ install(){
178178
echo ""
179179
echo "= installing to $PREFIX"
180180

181+
#
182+
# Install JDK 8, ONLY if JDK (javac) is not installed
183+
#
184+
if ! which javac; then
185+
echo ""
186+
echo "= No JDK installed. Installing JDK 8"
187+
add-apt-repository ppa:webupd8team/java
188+
apt-get update
189+
install linux "oracle-java8-installer"
190+
install linux "oracle-java8-set-default"
191+
fi
192+
181193
# Check for JDK 8
182194
JAVA_VER=$(javac -version 2>&1 | sed 's/javac \(.*\)\.\(.*\)\..*/\1\2/; 1q')
183195

184196
if [ "$JAVA_VER" != "18" ]; then
185-
echo "JAVAC version is not 1.8. Current version: $JAVA_VER"
197+
echo ""
198+
echo "JAVAC version is not JDK 8. Current version: $JAVA_VER"
186199
exit 1
187200
fi
188201

@@ -192,7 +205,7 @@ require curl
192205
require javac
193206

194207
# Check for pkg-config and install if needed
195-
test `which pkg-config` || fetch $PKG_CONFIG
208+
test `which pkg-config` || fetch $PKG_CONFIG --with-internal-glib
196209
require 'pkg-config'
197210

198211
# Install Bazel Dependencies
@@ -203,12 +216,6 @@ install linux "unzip"
203216

204217
# Install protobuf dependencies
205218
install linux "dh-autoreconf"
206-
install darwin "automake"
207-
208-
#
209-
# Install JDK 8, ONLY if JDK (javac) is not installed
210-
#
211-
test `which javac` || install linux "oracle-java8-installer"
212219

213220
#
214221
# Install Bazel
@@ -261,6 +268,7 @@ echo ""
261268
echo "= Installing Google's protobuf"
262269
if ! pkg-config protobuf --exists; then
263270
./autogen.sh
271+
./configure
264272
make
265273
make check
266274
make install
@@ -278,16 +286,21 @@ echo ""
278286
echo "= Cleaning up..."
279287

280288
srcDir="../src/includes"
289+
libDir="../src/lib"
281290
rm -rf $srcDir
291+
rm -rf $libDir
282292

293+
# Copy .h & .cc files
283294
cp -a tensorflow/bazel-genfiles/. $srcDir
284295
cp -a tensorflow/tensorflow/cc $srcDir/tensorflow
285296
cp -a tensorflow/tensorflow/core $srcDir/tensorflow
286297
cp -a tensorflow/google/protobuf/src/google $srcDir
287298
cp -a tensorflow/third_party $srcDir
288299

300+
# Copy Libraries (.io)
301+
cp -a tensorflow/bazel-out/host/bin/. $libDir
302+
289303
# Remove repo folder
290-
cd ../
291304
rm -rf "tensorflow"
292305

293306
echo ""

0 commit comments

Comments
 (0)