nix-packages/pkgs/simplicity-studio-5/default.nix
2022-11-12 19:31:11 +01:00

167 lines
4.1 KiB
Nix

{ alsa-lib
, atk
, autoPatchelfHook
, bzip2
, cairo
, fontconfig
, freetype
, gcc
, gdk-pixbuf
, glib
, glibc
, gtk3
, jdk
, lib
, libX11
, libXrender
, libXtst
, libglvnd
, libsecret
, libsoup
, libusb-compat-0_1
, makeDesktopItem
, ncurses5
, openssl
, pango
, patchelf
, pkg-config
, qtbase
, readline
, stdenv
, swt
, webkitgtk
, wine
, wrapQtAppsHook
, zlib
}:
let
installationDir = "$out/opt";
desktopItem = makeDesktopItem {
name = "Simplicity Studio";
desktopName = "Simplicity Studio";
# exec = "${installationDir}/studio";
# icon = "${installationDir}/icon.xpm";
type = "Application";
terminal = false;
categories = [ "Development" "IDE" ];
};
in
stdenv.mkDerivation rec {
pname = "simplicity-studio-5";
version = "5.0.0";
# rev = "cbe903e7f8839794fbe572ea4c811e2c802a4038";
src = builtins.fetchTarball {
url = "https://www.silabs.com/documents/login/software/SimplicityStudio-5.tgz";
sha256 = "0b23w7fnnipn78kvi921588sa1ckl9v2jbgnn3ywhcx3nnbsxlg4";
};
buildInputs = [
alsa-lib
bzip2.out
gcc
gdk-pixbuf
glib
gtk3
libXtst
libusb-compat-0_1
ncurses5
openssl
qtbase
readline
webkitgtk
wine
swt
];
nativeBuildInputs = [
wrapQtAppsHook
autoPatchelfHook
pkg-config
];
# configurePhase = ''
# cmake .
# '';
# buildPhase = ''
# make
# '';
dontWrapQtApps = true;
installPhase = ''
runHook preInstall
mkdir -p $out
cp -r $src/ ${installationDir}
mkdir -p $out/bin
# patchelf --set-interpreter ${glibc.out}/lib/ld-linux*.so.2 $out/opt/studio
makeWrapper $out/opt/studio $out/bin/studio \
"''${qtWrapperArgs[@]}" \
--prefix PATH : ${jdk}/bin \
--prefix XDG_DATA_DIRS : "$GSETTINGS_SCHEMAS_PATH" \
--prefix CLASSPATH : "$out/opt/plugins/" \
--prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [ gtk3 libXtst webkitgtk swt freetype fontconfig libX11 libXrender zlib glib cairo libsoup atk gdk-pixbuf pango libglvnd libsecret ]}"
find $src/StudioLinux/ -type f -name '*.rules' -exec install -Dm644 -t $out/lib/udev/rules.d/ {} +
find ${desktopItem}/share/applications/ -type f -name '*.desktop' -exec install -Dm644 -t $out/usr/share/applications {} +
mkdir -p $out/lib
ln -s ${openssl.out}/lib/libcrypto.so $out/lib/libcrypto.so.1.0.0
ln -s ${openssl.out}/lib/libssl.so $out/lib/libssl.so.1.0.0
ln -s ${bzip2.out}/lib/libbz2.so.1 $out/lib/libbz2.so.1.0
runHook postInstall
'';
}
# pkgname=simplicitystudio5-bin
# pkgver=5
# pkgrel=1
# pkgdesc='Design tools, documentation, software and support resources for EFM32™, EFM8™, 8051, Wireless MCUs and Wireless SoCs.'
# arch=(x86_64)
# url=https://www.silabs.com/products/development-tools/software/simplicity-studio
# license=(unknown)
# backup=("opt/$installdir/studio.ini")
# depends=(qt5-base libxtst webkit2gtk)
# optdepends=('wine: for IAR support'
# 'lib32-qt4: for old tools like battery estimator'
# 'qt4: for Segger tools like systemview')
# options=('!strip')
# install=simplicitystudio5.install
# source=(https://www.silabs.com/documents/login/software/SimplicityStudio-5.tgz
# simplicitystudio5.desktop)
# sha256sums=('SKIP'
# 'd0c7b8d6f8b9bcb8d900dfdb047d5a833aae2d131bc4c675e67aec7e3ac3f0e7')
# installdir=simplicitystudio5
# prepare() {
# cd "$srcdir/SimplicityStudio_v5"
# }
# package() {
# install -dm755 "$pkgdir/opt/"
# cp -a "$srcdir/SimplicityStudio_v5" "$pkgdir/opt/$installdir"
# install -dm755 "$pkgdir/etc/udev/rules.d/"
# find "$srcdir/SimplicityStudio_v5/StudioLinux" -name '*.rules' \
# -exec install -m644 {} "$pkgdir/etc/udev/rules.d/" \;
# mkdir -p $pkgdir/usr/bin
# ln -sf /opt/$installdir/studio $pkgdir/usr/bin/$installdir
# install -Dm644 "simplicitystudio5.desktop" \
# "$pkgdir/usr/share/applications/simplicitystudio5.desktop"
# # installation directory has to be writable
# find "$pkgdir/opt/$installdir" -type d -exec chmod a+w {} +
# find "$pkgdir/opt/$installdir" -type f -exec chmod a+w {} +
# }