Botspot / pi-apps

Raspberry Pi App Store for Open Source Projects
GNU General Public License v3.0
1.93k stars 207 forks source link

KiCad - install based #2132

Open troysbucket opened 1 year ago

troysbucket commented 1 year ago

What is the name of the app?

KiCad

(Optional) Where is the app hosted?

https://kicad.org

About the app

KiCad is an electronic design automation (EDA) suite for schematic capture, PCB layout, SPICE simulation and much more.

Version 5 is included in the Raspberry Pi repository, but version 6 was released earlier this year and provides many desirable new features.

I have tested the build on Raspberry Pi 2, Raspberry Pi 4 and Raspberry Pi 400 using both Buster and Bullseye (32 and 64 bit versions).

Upload file or Add PR Link

KiCad.zip

Confirmations

github-actions[bot] commented 1 year ago

Hello there 👋 Thanks for submitting your first issue to the Pi-Apps project! We'll try to get back to you as soon as possible. In the meantime, we encourage you join our Discord server, where you can ask any questions you might have.

theofficialgman commented 1 year ago

I took a look at the buildscript. it looks pretty good though there are some slight changes I would make.

KiCAD definitly deserves a home in pi-apps. The main thing I would change is the installation of boost to be more inclusive of other distros (ubuntu based). I will note, KiCAD version 7 will require boost 1.71 (meaning it can't be built with system boost from buster/bionic). So version 6 is likely where this script will stay unless someone wants to add static boost library building to this install script as well.

troysbucket commented 1 year ago

Great, glad it looks okay. Have at it with any changes.

Bullseye includes boost 1.74, so wouldn't that work? I can look into building it statically, though I guess it will be a while before we have KiCad 7 to deal with.

theofficialgman commented 1 year ago

KiCAD seems to come out with a new major version release every 1-2 years. to it could be next year, it could be the year after that.

ideally we want to continue supporting buster and bullseye in all the apps on pi-apps... at least until the marjority of users have moved over to bullseye

Botspot commented 1 year ago

I was reminded of this issue with the recent announcement that the PiOS repos now include kicad 6.0.8. Maybe this script could be changed to install their deb, if available, otherwise compile 6.0.9.

theofficialgman commented 1 year ago

app fails to install due to missing dependencies on required target(s): https://github.com/Botspot/pi-apps/actions/runs/4010483841 just like I warned you about here https://github.com/Botspot/pi-apps/issues/2132#issuecomment-1250335400

github-actions[bot] commented 1 year ago

A zipfile was found in the body of your issue. The sha1sum of the zip was: 2e7932ed1c8a13e40ca6f12d1cac1903a2fb2858 The contents can be previewed below:

KiCad/description

KiCad is an electronic design automation (EDA) suite for schematic capture, PCB layout, SPICE simulation and much more.

This is a large package to download and build and will require several hours on a Raspberry Pi 4(00). It has also been tested on a Raspberry Pi 2 but will take days to build and requires a large swap file.

To run:
  Menu -> Other -> KiCad

KiCad/credits

Added to Pi-Apps by Chris Holmes (troysbucket) @github

KiCad/website

https://kicad.org

KiCad/uninstall

#!/bin/bash

version=6.0.7
install_loc=/opt/kicad-${version}

sudo rm -rf ${install_loc}
rm ~/.local/share/applications/kicad-${version}.desktop

#Allow packages required by this app to be uninstalled
purge_packages || exit 1

KiCad/install

#!/bin/bash

version=6.0.7
install_loc=/opt/kicad-${version}

__cleanup ()
{
  status "Cleaning up..."
  [[ -f "/tmp/kicad-${version}.tar.bz2" ]] && rm  "/tmp/kicad-${version}.tar.bz2"
  [[ -d "/tmp/kicad-${version}" ]] && rm -rf "/tmp/kicad-${version}"
  for i in symbols footprints packages3D templates; do
    [[ -f "/tmp/kicad-${i}-${version}.tar.bz2" ]] && rm  "/tmp/kicad-${i}-${version}.tar.bz2"
    [[ -d "/tmp/kicad-${i}-${version}" ]] && rm -rf "/tmp/kicad-${i}-${version}"
  done
  [[ -f "/tmp/kicad-doc-${version}.tar.gz" ]] && rm  "/tmp/kicad-doc-${version}.tar.gz"
  status "Done"
}

# Install some packages that are necessary to run this app - no need for "error", as the install_packages function already handles errors.
if [[ "$(get_codename)" == "buster" ]]; then
install_packages git libwxgtk3.0-gtk3-dev cmake libegl1-mesa-dev libglew-dev libglm-dev libcurlpp-dev libcairo2-dev libboost1.67-dev libngspice0-dev swig libpython3.7-dev python3-wxgtk4.0 doxygen libgtk-3-dev libboost-test1.67-dev libboost-filesystem1.67-dev libocct-ocaf-dev libocct-data-exchange-dev libcurl4-openssl-dev || exit 1
else
install_packages git libwxgtk3.0-gtk3-dev cmake libegl1-mesa-dev libglew-dev libglm-dev libcurlpp-dev libcairo2-dev libboost1.74-dev libngspice0-dev swig libpython3.9-dev python3-wxgtk4.0 doxygen libgtk-3-dev libboost-test1.74-dev libboost-filesystem1.74-dev libocct-ocaf-dev libocct-data-exchange-dev || exit 1
fi

trap __cleanup EXIT

#Be sure to use the "error" function - it will display a message if a command fails to run. Example below:
cd /tmp
wget https://gitlab.com/kicad/code/kicad/-/archive/${version}/kicad-${version}.tar.bz2 || error 'Failed to download source tarball!'
rm -rf kicad-${version}
tar xjvf kicad-${version}.tar.bz2 || error 'unable to decompress source'
rm -f kicad-${version}.tar.bz2
status_green "done"

status "Compilation..."
cd kicad-${version}
# Fix some linker errors on buster.
grep -q atomic CMakeLists.txt
if [[ $? -eq 1 ]]; then
  # Insert extra library at line 39 to fix linker errors
  sed -i '39ilist(APPEND EXTRA_LIBS atomic)' CMakeLists.txt
fi
mkdir -p build/release
cd build/release
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=${install_loc} -DKICAD_BUILD_QA_TESTS=OFF ../..
make -j$(nproc) || error "Unable to build"
sudo make install || error "Unable to install"
cd ../../..
rm -rf kicad-${version}

status_green "Done with build"

status "Installing additional resources"
cd /tmp

for i in symbols footprints packages3D templates; do
    wget https://gitlab.com/kicad/libraries/kicad-${i}/-/archive/${version}/kicad-${i}-${version}.tar.bz2 || error 'Failed to download ${i}'
    rm -rf kicad-${i}-${version}
    tar xjvf kicad-${i}-${version}.tar.bz2 || error 'unable to decompress ${i}'
    rm -f kicad-${i}-${version}.tar.bz2
    cd kicad-${i}-${version}
    mkdir build
    cd build
    cmake -DCMAKE_INSTALL_PREFIX=${install_loc} ..
    sudo make install
    cd ../..
    rm -rf kicad-${i}-${version}
done

wget https://kicad-downloads.s3.cern.ch/docs/kicad-doc-${version}.tar.gz || error 'failed to download docs'
sudo tar zxvf kicad-doc-${version}.tar.gz --strip-components=1 -C ${install_loc} || error 'unable to decompress docs'
rm kicad-doc-${version}.tar.gz

echo "[Desktop Entry]
Version=1.0
Name=KiCad
Exec=${install_loc}/bin/kicad
Icon=${install_loc}/share/icons/hicolor/64x64/apps/kicad.png
Termina=false
Type=Application
Categories=Other;" > ~/.local/share/applications/kicad-${version}.desktop

status_green "Done"