Last active
April 14, 2021 18:36
-
-
Save inigoalonso/a77314206b516e94d4aa to your computer and use it in GitHub Desktop.
Install EPICS Base and the ASYN and StreamDevice libraries in Raspbian (Raspberry Pi).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# All code from: http://www.smolloy.com/2015/12/epics-ioc-on-a-raspberry-pi/ | |
# Download the necessary source files | |
echo "Downloading the necessary source files" | |
mkdir Downloads | |
cd ~/Downloads | |
wget http://www.aps.anl.gov/epics/download/base/baseR3.14.12.5.tar.gz | |
wget http://aps.anl.gov/epics/download/modules/asyn4-28.tar.gz | |
wget http://epics.web.psi.ch/software/streamdevice/StreamDevice-2.tgz | |
# Create a place to work | |
echo "Creating a place to work: ~/Apps/epics" | |
mkdir -p ~/Apps/epics | |
echo "Untar-ing EPICS base" | |
tar -zxf ~/Downloads/baseR3.14.12.5.tar.gz -C ~/Apps/epics/ | |
echo "Creating links to epics folders at /usr/local" | |
sudo ln -s /home/pi/Apps/epics /usr/local/ | |
ln -s /home/pi/Apps/epics/base-3.14.12.5 /home/pi/Apps/epics/base | |
# Set the EPICS environment variables | |
echo "Setting up the EPICS enviroment variables" | |
cat <<EOF >> ~/.bash_aliases | |
export EPICS_ROOT=/usr/local/epics | |
export EPICS_BASE=\${EPICS_ROOT}/base | |
export EPICS_HOST_ARCH=/\\`\${EPICS_BASE}/startup/EpicsHostArch\\` | |
export EPICS_BASE_BIN=\${EPICS_BASE}/bin/\${EPICS_HOST_ARCH} | |
export EPICS_BASE_LIB=\${EPICS_BASE}/lib/\${EPICS_HOST_ARCH} | |
if [ "" = "\${LD_LIBRARY_PATH}" ]; then | |
export LD_LIBRARY_PATH=\${EPICS_BASE_LIB} | |
else | |
export LD_LIBRARY_PATH=\${EPICS_BASE_LIB}:\${LD_LIBRARY_PATH} | |
fi | |
export PATH=\${PATH}:\${EPICS_BASE_BIN} | |
EOF | |
. ~/.bashrc | |
# Compile EPICS | |
echo "Compiling EPICS" | |
cd ~/Apps/epics/base | |
make | |
# Install ASYN into EPICS | |
echo "Installing ASYN library into EPICS" | |
mkdir -p ~/Apps/epics/modules | |
echo "Untar-ing" | |
tar -zxf ~/Downloads/asyn4-28.tar.gz -C ~/Apps/epics/modules/ | |
echo "Linking" | |
ln -s /home/pi/Apps/epics/modules/asyn4-28 /home/pi/Apps/epics/modules/asyn | |
echo "Editing the configuration" | |
cd ~/Apps/epics/modules/asyn | |
sed -e '/IPAC/ s/^#*/#/' configure/RELEASE | |
sed -e '/SNCSEQ/ s/^#*/#/' configure/RELEASE | |
sed -e '/EPICS_BASE/ s/^#*/#/' configure/RELEASE | |
echo "EPICS_BASE=/usr/local/epics/base" >> configure/RELEASE | |
echo "Compiling" | |
cd ~/Apps/epics/modules/asyn | |
make | |
# Install StreamDevice into EPICS | |
echo "Installing StreamDevice library into EPICS" | |
mkdir /home/pi/Apps/epics/modules/stream | |
cd /home/pi/Apps/epics/modules/stream | |
echo "Untar-ing" | |
tar -zxvf ~/Downloads/StreamDevice-2.tgz -C /home/pi/Apps/epics/modules/stream | |
echo "Configuring" | |
echo | makeBaseApp.pl -t support | |
echo "ASYN=/usr/local/epics/modules/asyn" >> configure/RELEASE | |
echo "Compiling 1" | |
make | |
echo "Compiling 2" | |
cd StreamDevice-2-6 | |
make | |
echo "Done!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment