update pia-install to use libre-soc-install.sh
[dev-env-setup.git] / nextpnr-ecp5-install
index 8d8eddcea121c48d599ee72ba76fac214ce5fa2b..18b7b28fdfa85308a0692f2a38af1d0cedfc0784 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/bash
 if [ "$EUID" -ne 0 ]
-  then echo "Please run as root"
+  then echo "Please run as root using 'sudo bash'"
   exit
 fi
 
@@ -10,9 +10,10 @@ apt-get install -y python3 python3-dev clang cmake libboost-dev \
                     libboost-program-options-dev libboost-iostreams-dev \
                     openocd libeigen3-dev
 
-cd /home
-mkdir nextpnr
-cd nextpnr
+# change into $SUDO_USER home directory
+cd /home/$SUDO_USER
+mkdir -p src/nextpnr
+cd src/nextpnr
 
 git clone --recursive https://github.com/YosysHQ/prjtrellis
 git clone --recursive https://github.com/YosysHQ/nextpnr
@@ -20,7 +21,7 @@ git clone --recursive https://github.com/YosysHQ/nextpnr
 cd prjtrellis
 cd libtrellis
 cmake -DCMAKE_INSTALL_PREFIX=/usr/local/libtrellis .
-make
+make -j$(nproc)
 make install
 cd ../..
 
@@ -28,6 +29,10 @@ cd nextpnr
 cmake -DCMAKE_INSTALL_PREFIX=/usr/local/nextpnr-ecp5 \
                     -DARCH=ecp5 \
                     -DTRELLIS_INSTALL_PREFIX=/usr/local/libtrellis .
-make
+make -j$(nproc)
 make install
 
+cd /home/$SUDO_USER/src/nextpnr
+chown -R $SUDO_USER .
+chgrp -R $SUDO_USER .
+