@@ -93,17 +93,70 @@ _installUbuntuCleanUp() {
9393 apt-get autoremove -y
9494}
9595
96- _installKlayoutDependenciesUbuntuAarch64 () {
96+ _installKlayoutUbuntuAarch64 () {
9797 echo " Installing Klayout dependancies"
9898 export DEBIAN_FRONTEND=noninteractive
9999 apt-get -y update
100- apt-get -y install build-essential \
101- qtbase5-dev qttools5-dev libqt5xmlpatterns5-dev qtmultimedia5-dev libqt5multimediawidgets5 libqt5svg5-dev \
102- ruby ruby-dev \
103- python3 python3-dev \
104- libz-dev\
105- libgit2-dev
100+ apt-get -y install \
101+ build-essential \
102+ libgit2-dev \
103+ libz-dev \
104+ qtbase5-dev \
105+ qtmultimedia5-dev \
106+ qttools5-dev \
107+ libqt5multimediawidgets5 \
108+ libqt5svg5-dev \
109+ libqt5xmlpatterns5-dev \
110+ python3 python3-dev \
111+ ruby ruby-dev
106112 echo " All dependencies installed successfully"
113+ echo " Installing KLayout for aarch64 architecture"
114+ git clone --depth=1 -b v${klayoutVersion} https://github.com/KLayout/klayout.git
115+ cd klayout
116+ ./build.sh -bin " ${klayoutPrefix} "
117+ }
118+
119+ _install_KLayout () {
120+ klayoutPrefix=${PREFIX:- " /usr/local" }
121+ if [ -f ${klayoutPrefix} /klayout ]; then
122+ currentVersion=$( ${klayoutPrefix} /klayout -v | grep -o ' [0-9]\+\.[0-9]\+\.[0-9]\+' )
123+ if _versionCompare $currentVersion -eq $klayoutVersion ; then
124+ echo " Klayout is already installed"
125+ return
126+ fi
127+ if _versionCompare $currentVersion -gt $klayoutVersion ; then
128+ echo " KLayout version greater than or equal to ${klayoutVersion} "
129+ return
130+ else
131+ echo " KLayout version less than ${klayoutVersion} "
132+ echo " Replace old version"
133+ fi
134+ sudo apt-get -y remove klayout
135+ fi
136+
137+ if [[ $1 == " rodete" ]]; then
138+ apt-get -y install --no-install-recommends klayout python3-pandas
139+ return
140+ fi
141+ if _versionCompare " $1 " -ge 23.04; then
142+ apt-get -y install --no-install-recommends klayout python3-pandas
143+ return
144+ fi
145+ if [[ $( uname -m) == " aarch64" ]]; then
146+ _installKlayoutUbuntuAarch64
147+ return
148+ fi
149+
150+ if [[ $1 == 20.04 ]]; then
151+ klayoutChecksum=15a26f74cf396d8a10b7985ed70ab135
152+ else
153+ klayoutChecksum=db751264399706a23d20455bb7624264
154+ fi
155+
156+ cd " ${baseDir} "
157+ wget https://www.klayout.org/downloads/Ubuntu-${1% .* } /klayout_${klayoutVersion} -1_amd64.deb
158+ md5sum -c <( echo " ${klayoutChecksum} klayout_${klayoutVersion} -1_amd64.deb" ) || exit 1
159+ dpkg -i klayout_${klayoutVersion} -1_amd64.deb
107160}
108161
109162_installUbuntuPackages () {
@@ -133,42 +186,7 @@ _installUbuntuPackages() {
133186 zlib1g \
134187 zlib1g-dev
135188
136- # install KLayout
137- if [[ $1 == " rodete" ]]; then
138- apt-get -y install --no-install-recommends klayout python3-pandas
139- elif _versionCompare " $1 " -ge 23.04; then
140- apt-get -y install --no-install-recommends klayout python3-pandas
141- else
142- arch=$( uname -m)
143- lastDir=" $( pwd) "
144- # temp dir to download and compile
145- baseDir=/tmp/installers
146- klayoutPrefix=${PREFIX:- " /usr/local" }
147- mkdir -p " ${baseDir} "
148- cd " ${baseDir} "
149- if [[ $arch == " aarch64" ]]; then
150- if [ ! -f ${klayoutPrefix} /klayout ]; then
151- _installKlayoutDependenciesUbuntuAarch64
152- echo " Installing KLayout for aarch64 architecture"
153- git clone https://github.com/KLayout/klayout.git
154- cd klayout
155- ./build.sh -bin " ${klayoutPrefix} "
156- else
157- echo " Klayout is already installed"
158- fi
159- else
160- if [[ $1 == 20.04 ]]; then
161- klayoutChecksum=15a26f74cf396d8a10b7985ed70ab135
162- else
163- klayoutChecksum=db751264399706a23d20455bb7624264
164- fi
165- wget https://www.klayout.org/downloads/Ubuntu-${1% .* } /klayout_${klayoutVersion} -1_amd64.deb
166- md5sum -c <( echo " ${klayoutChecksum} klayout_${klayoutVersion} -1_amd64.deb" ) || exit 1
167- dpkg -i klayout_${klayoutVersion} -1_amd64.deb
168- fi
169- cd " ${lastDir} "
170- rm -rf " ${baseDir} "
171- fi
189+ _install_KLayout " ${1} "
172190
173191 if command -v docker & > /dev/null; then
174192 # The user can uninstall docker if they want to reinstall it,
0 commit comments