diff --git a/srcpkgs/simplex-chat-desktop b/srcpkgs/simplex-chat-desktop new file mode 120000 index 00000000000000..e39f721b40ac21 --- /dev/null +++ b/srcpkgs/simplex-chat-desktop @@ -0,0 +1 @@ +simplex-chat \ No newline at end of file diff --git a/srcpkgs/simplex-chat/files/cabal.project.freeze b/srcpkgs/simplex-chat/files/cabal.project.freeze new file mode 100644 index 00000000000000..ec758f0ec04c96 --- /dev/null +++ b/srcpkgs/simplex-chat/files/cabal.project.freeze @@ -0,0 +1,265 @@ +active-repositories: hackage.haskell.org:merge +constraints: any.Cabal ==3.10.3.0, + any.Cabal-syntax ==3.10.3.0, + any.HUnit ==1.6.2.0, + any.OneTuple ==0.4.1.1, + any.Only ==0.1, + any.QuickCheck ==2.14.3, + QuickCheck -old-random +templatehaskell, + any.SHA ==1.6.4.4, + SHA -exe, + any.StateVar ==1.2.2, + any.aeson ==2.2.1.0, + aeson +ordered-keymap, + any.android-support ==0.1.0.0, + any.ansi-terminal ==0.11.5, + ansi-terminal -example +win32-2-13-1, + any.ansi-terminal-types ==0.11.5, + any.ansi-wl-pprint ==0.6.9, + ansi-wl-pprint -example, + any.appar ==0.1.8, + any.array ==0.5.8.0, + any.asn1-encoding ==0.9.6, + any.asn1-parse ==0.9.5, + any.asn1-types ==0.3.4, + any.assoc ==1.1, + assoc +tagged, + any.async ==2.2.5, + async -bench, + any.attoparsec ==0.14.4, + attoparsec -developer, + any.auto-update ==0.1.6, + any.base ==4.19.2.0, + any.base-orphans ==0.9.1, + any.base64-bytestring ==1.2.1.0, + any.basement ==0.0.16, + any.bifunctors ==5.6.1, + bifunctors +tagged, + any.binary ==0.8.9.1, + any.bitvec ==1.1.5.0, + bitvec +simd, + any.blaze-builder ==0.4.2.3, + any.blaze-html ==0.9.1.2, + any.blaze-markup ==0.8.3.0, + any.blaze-textual ==0.2.3.1, + blaze-textual -developer -integer-simple +native, + any.bsb-http-chunked ==0.0.0.4, + any.byteorder ==1.0.4, + any.bytestring ==0.12.1.0, + any.bytestring-builder ==0.10.8.2.0, + bytestring-builder +bytestring_has_builder, + any.cabal-doctest ==1.0.9, + any.call-stack ==0.4.0, + any.case-insensitive ==1.2.1.0, + any.cereal ==0.5.8.3, + cereal -bytestring-builder, + any.clock ==0.8.4, + clock -llvm, + any.colour ==2.3.6, + any.comonad ==5.0.8, + comonad +containers +distributive +indexed-traversable, + any.composition ==1.0.2.2, + any.conduit ==1.3.5, + any.conduit-extra ==1.3.6, + any.constraints ==0.13.4, + any.containers ==0.6.8, + any.contravariant ==1.5.5, + contravariant +semigroups +statevar +tagged, + any.cookie ==0.4.6, + any.cryptohash-md5 ==0.11.101.0, + any.cryptohash-sha1 ==0.11.101.0, + any.crypton ==0.34, + crypton -check_alignment +integer-gmp -old_toolchain_inliner +support_aesni +support_deepseq +support_pclmuldq +support_rdrand -support_sse +use_target_attributes, + any.crypton-x509 ==1.7.6, + any.crypton-x509-store ==1.6.9, + any.crypton-x509-validation ==1.6.12, + any.cryptostore ==0.3.0.1, + cryptostore +use_crypton, + any.data-default ==0.7.1.1, + any.data-default-class ==0.1.2.0, + any.data-default-instances-containers ==0.0.1, + any.data-default-instances-dlist ==0.0.1, + any.data-default-instances-old-locale ==0.0.1, + any.data-fix ==0.3.2, + any.deepseq ==1.5.1.0, + any.digest ==0.0.1.7, + digest +pkg-config, + any.direct-sqlcipher ==2.3.28, + direct-sqlcipher -commoncrypto +fulltextsearch +haveusleep +json1 -mathfunctions +openssl -systemlib -tomcrypt +urifilenames, + any.directory ==1.3.8.5, + any.distributive ==0.6.2.1, + distributive +semigroups +tagged, + any.dlist ==1.0, + dlist -werror, + any.easy-file ==0.2.5, + any.email-validate ==2.3.2.19, + any.entropy ==0.4.1.10, + entropy -donotgetentropy, + any.exceptions ==0.10.7, + any.fast-logger ==3.2.2, + any.file-embed ==0.0.15.0, + any.filepath ==1.4.301.0, + any.generic-random ==1.5.0.1, + generic-random -enable-inspect, + any.generically ==0.1.1, + any.ghc-bignum ==1.3, + any.ghc-boot-th ==9.8.4, + any.ghc-prim ==0.11.0, + any.hashable ==1.4.3.0, + hashable +integer-gmp -random-initial-seed, + any.haskell-lexer ==1.1.1, + any.hourglass ==0.2.12, + any.hsc2hs ==0.68.10, + hsc2hs -in-ghc-tree, + any.hspec ==2.11.7, + any.hspec-core ==2.11.7, + any.hspec-discover ==2.11.7, + any.hspec-expectations ==0.8.4, + any.http-date ==0.0.11, + any.http-types ==0.12.4, + any.http2 ==4.2.2, + http2 -devel -h2spec, + any.indexed-traversable ==0.1.3, + any.indexed-traversable-instances ==0.1.1.2, + any.ini ==0.4.1, + any.integer-conversion ==0.1.0.1, + any.integer-gmp ==1.1, + any.integer-logarithms ==1.0.3.1, + integer-logarithms -check-bounds +integer-gmp, + any.iproute ==1.7.12, + any.iso8601-time ==0.1.5, + iso8601-time +new-time, + any.libyaml ==0.1.2, + libyaml -no-unicode -system-libyaml, + any.lifted-base ==0.2.3.12, + any.memory ==0.18.0, + memory +support_bytestring +support_deepseq, + any.mime-types ==0.1.2.0, + any.monad-control ==1.0.3.1, + any.monad-logger ==0.3.40, + monad-logger +template_haskell, + any.monad-loops ==0.4.3, + monad-loops +base4, + any.mono-traversable ==1.0.15.3, + any.mtl ==2.3.1, + any.network ==3.1.4.0, + network -devel, + any.network-byte-order ==0.1.7, + any.network-info ==0.2.1, + any.network-transport ==0.5.6, + any.network-udp ==0.0.0, + any.network-uri ==2.6.4.2, + any.old-locale ==1.0.0.7, + any.old-time ==1.1.0.4, + any.optparse-applicative ==0.16.1.0, + optparse-applicative +process, + any.parsec ==3.1.17.0, + any.pem ==0.2.4, + any.pretty ==1.1.3.6, + any.prettyprinter ==1.7.1, + prettyprinter -buildreadme +text, + any.primitive ==0.8.0.0, + any.process ==1.6.25.0, + any.psqueues ==0.2.8.0, + any.quickcheck-io ==0.2.0, + any.random ==1.2.1.1, + any.record-hasfield ==1.0, + any.recv ==0.1.0, + any.resourcet ==1.3.0, + any.rts ==1.0.2, + any.safe-exceptions ==0.1.7.4, + any.scientific ==0.3.7.0, + scientific -bytestring-builder -integer-simple, + any.semialign ==1.3, + semialign +semigroupoids, + any.semigroupoids ==6.0.0.1, + semigroupoids +comonad +containers +contravariant +distributive +tagged +unordered-containers, + any.silently ==1.2.5.3, + any.simple-logger ==0.1.1, + any.simple-sendfile ==0.2.32, + simple-sendfile +allow-bsd -fallback, + any.simplexmq ==6.4.8.0, + any.socks ==0.6.1, + any.split ==0.2.4, + any.splitmix ==0.1.0.5, + splitmix -optimised-mixer, + any.sqlcipher-simple ==0.4.18.1, + any.stm ==2.5.3.1, + any.stm-chans ==3.0.0.9, + any.streaming-commons ==0.2.2.6, + streaming-commons -use-bytestring-builder, + any.strict ==0.5, + any.tagged ==0.8.8, + tagged +deepseq +transformers, + any.template-haskell ==2.21.0.0, + any.temporary ==1.3, + any.terminal ==0.2.0.0, + any.text ==2.1.1, + any.text-iso8601 ==0.1, + any.text-short ==0.1.5, + text-short -asserts, + any.tf-random ==0.5, + any.th-abstraction ==0.6.0.0, + any.th-compat ==0.1.4, + any.th-lift ==0.8.4, + any.th-lift-instances ==0.1.20, + any.these ==1.2, + any.time ==1.12.2, + any.time-compat ==1.9.6.1, + time-compat -old-locale, + any.time-manager ==0.0.1, + any.tls ==1.9.0, + tls +compat -hans +network, + any.tls-session-manager ==0.0.4, + any.transformers ==0.6.1.0, + any.transformers-base ==0.4.6, + transformers-base +orphaninstances, + any.transformers-compat ==0.7.2, + transformers-compat -five +five-three -four +generic-deriving +mtl -three -two, + any.type-equality ==1, + any.typed-process ==0.2.11.1, + any.unicode-data ==0.4.0.1, + unicode-data -ucd2haskell, + any.unicode-transforms ==0.4.0.1, + unicode-transforms -bench-show -dev -has-icu -has-llvm -use-gauge, + any.unix ==2.8.6.0, + any.unix-compat ==0.7.1, + unix-compat -old-time, + any.unix-time ==0.4.11, + any.unliftio ==0.2.25.0, + any.unliftio-core ==0.2.1.0, + any.unordered-containers ==0.2.19.1, + unordered-containers -debug, + any.uri-bytestring ==0.3.3.1, + uri-bytestring -lib-werror, + any.uuid ==1.3.15, + any.uuid-types ==1.0.5.1, + any.vault ==0.3.1.5, + vault +useghc, + any.vector ==0.13.1.0, + vector +boundschecks -internalchecks -unsafechecks -wall, + any.vector-algorithms ==0.9.0.1, + vector-algorithms +bench +boundschecks -internalchecks -llvm +properties -unsafechecks, + any.vector-stream ==0.1.0.0, + any.wai ==3.2.4, + any.wai-app-static ==3.1.8, + wai-app-static +crypton -print, + any.wai-extra ==3.1.13.0, + wai-extra -build-example, + any.wai-logger ==2.4.0, + any.warp ==3.3.30, + warp +allow-sendfilefd -network-bytestring -warp-debug +x509, + any.warp-tls ==3.4.7, + any.websockets ==0.12.7.3, + websockets -example, + any.witherable ==0.4.2, + any.word8 ==0.1.3, + any.yaml ==0.11.11.2, + yaml +no-examples +no-exe, + any.zip ==2.2.1, + zip -dev +disable-bzip2 +disable-zstd, + any.zlib ==0.6.3.0, + zlib -bundled-c-zlib -non-blocking-ffi -pkg-config, + any.zstd ==0.1.3.0, + zstd +standalone +index-state: hackage.haskell.org 2023-12-11T23:46:17Z diff --git a/srcpkgs/simplex-chat/files/simplex-chat.desktop b/srcpkgs/simplex-chat/files/simplex-chat.desktop new file mode 100644 index 00000000000000..7853832294b4a8 --- /dev/null +++ b/srcpkgs/simplex-chat/files/simplex-chat.desktop @@ -0,0 +1,9 @@ +[Desktop Entry] +Type=Application +Name=SimpleX Chat +Comment=Private and secure open-source messenger +Exec=simplex-chat-gui +Icon=simplex +Terminal=false +Categories=Network;Chat; +Keywords=messenger;chat;private;secure; diff --git a/srcpkgs/simplex-chat/files/simplex-chat.sh b/srcpkgs/simplex-chat/files/simplex-chat.sh new file mode 100644 index 00000000000000..b7337685f257a4 --- /dev/null +++ b/srcpkgs/simplex-chat/files/simplex-chat.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# vlcj uses default NativeDiscovery; jna.library.path points it to system libvlc. +# VLC_PLUGIN_PATH tells libvlccore where to find its plugins from system vlc package. + +export _JAVA_AWT_WM_NONREPARENTING=1 +export VLC_PLUGIN_PATH=/usr/lib/vlc/plugins + +_jvm_args="-Djna.library.path=/usr/lib" + +if [ -n "${SIMPLEX_SCALE}" ]; then + _jvm_args="${_jvm_args} -Dsun.java2d.uiScale=${SIMPLEX_SCALE}" +fi + +if [ "${SIMPLEX_RENDER_API}" = "SOFTWARE" ]; then + export SKIKO_RENDER_API=SOFTWARE +fi + +exec /usr/lib/simplex-chat/simplex/bin/simplex \ + --jvm-arg="${_jvm_args}" \ + "$@" diff --git a/srcpkgs/simplex-chat/patches/ghc98-compat.patch b/srcpkgs/simplex-chat/patches/ghc98-compat.patch new file mode 100644 index 00000000000000..3404afa9e90ff7 --- /dev/null +++ b/srcpkgs/simplex-chat/patches/ghc98-compat.patch @@ -0,0 +1,11 @@ +this file is missing the DuplicateRecordFields language extension that all other +source files in the package already declare. ghc 9.8 requires it to be explicit. +upstream uses ghc 9.6 where it was implied by other extensions. +--- a/src/Simplex/Chat/Store.hs ++++ b/src/Simplex/Chat/Store.hs +@@ -1,4 +1,5 @@ + {-# LANGUAGE CPP #-} ++{-# LANGUAGE DuplicateRecordFields #-} + + module Simplex.Chat.Store + ( DBStore, diff --git a/srcpkgs/simplex-chat/template b/srcpkgs/simplex-chat/template new file mode 100644 index 00000000000000..b41b3dca8e8b60 --- /dev/null +++ b/srcpkgs/simplex-chat/template @@ -0,0 +1,97 @@ +# Template file for 'simplex-chat' +pkgname=simplex-chat +version=6.4.10 +revision=1 +build_style=cabal +build_helper="haskell qemu" +cabal_index_state="2023-12-12T00:00:00Z" +hostmakedepends="ghc cabal-install cmake patchelf openjdk17 openjdk17-jmods pkg-config xz" +makedepends="libffi-devel openssl-devel zlib-devel gmp-devel ncurses-devel" +short_desc="Private and secure messaging application (CLI)" +maintainer="rayfadh " +license="AGPL-3.0-only" +homepage="https://simplex.chat" +distfiles="https://github.com/simplex-chat/simplex-chat/archive/refs/tags/v${version}.tar.gz" +checksum=ada3480f4d27138bfd81879f76e97e3c5f1383c5dbab41ae688ea3354e7f0d9e +nocross="cabal does not support cross compilation" +nopie_files="/usr/bin/simplex-chat" +# testing hangs +make_check=no + +_allow_newer="base,template-haskell,text,bytestring,process,deepseq,time,unix,containers,filepath,directory" + +post_configure() { + printf 'allow-newer: %s\n' "${_allow_newer}" >> cabal.project.local + printf 'package cryptostore\n flags: +use_crypton\n' >> cabal.project.local + printf 'constraints: zip +disable-bzip2 +disable-zstd\n' >> cabal.project.local + printf 'package direct-sqlcipher\n flags: +openssl\n' >> cabal.project.local +} + +do_build() { + mkdir -p "${wrksrc}/build-bins" + cabal install exe:simplex-chat \ + --installdir="${wrksrc}/build-bins" \ + --install-method=copy \ + --overwrite-policy=always + + # build haskell native library for desktop + _ghc_ver=$(ghc --numeric-version) + sed -i "s/GHC_VERSION=9.6.3/GHC_VERSION=${_ghc_ver}/" scripts/desktop/build-lib-linux.sh + # libffi.so.7->8 replacement; void ships .so.8 already + sed -i 's/patchelf --replace-needed "libffi.so.7"/# patchelf --replace-needed "libffi.so.7"/' \ + scripts/desktop/build-lib-linux.sh + # use system vlc via jna.library.path + sed -i 's|scripts/desktop/prepare-vlc-linux.sh|# skipped: using system libvlc|' \ + scripts/desktop/build-lib-linux.sh + ./scripts/desktop/build-lib-linux.sh + + # disable upstream auto-update + sed -i 's/setupUpdateChecker()/\/\/setupUpdateChecker()/' \ + apps/multiplatform/desktop/src/jvmMain/kotlin/chat/simplex/desktop/Main.kt + sed -i 's/showAppUpdateNotice()/\/\/showAppUpdateNotice()/' \ + apps/multiplatform/desktop/src/jvmMain/kotlin/chat/simplex/desktop/Main.kt + + # build, exclude :android + cd apps/multiplatform + sed -i 's/include(":android", ":desktop", ":common")/include(":desktop", ":common")/' \ + settings.gradle.kts + export JAVA_HOME=/usr/lib/jvm/openjdk17 + ./gradlew :desktop:createDistributable + + # fix RPATH: haskell .so files must find each other via $ORIGIN, not build paths + _res_dir="${wrksrc}/apps/multiplatform/release/main/app/simplex/lib/app/resources" + find "${_res_dir}" -name "lib*.so" -exec patchelf --set-rpath '$ORIGIN' {} \; +} + +do_install() { + vbin "${wrksrc}/build-bins/simplex-chat" + vlicense LICENSE +} + +simplex-chat-desktop_package() { + short_desc="Private and secure messaging application (GUI)" + # vlcj NativeDiscovery finds libvlc.so.5 at runtime via jna.library.path=/usr/lib + # set in the launcher script; system vlc replaces the bundled AppImage entirely + depends="simplex-chat libvlc libX11 libXext libXrender libXtst libnotify + libcanberra libXcursor libXi fontconfig freetype libGL dbus libpng brotli bzip2 + alsa-lib giflib libjpeg-turbo lcms2 libnuma" + pkg_install() { + vmkdir usr/lib/simplex-chat + vcopy apps/multiplatform/release/main/app/simplex usr/lib/simplex-chat + patchelf --set-interpreter /usr/lib64/ld-linux-x86-64.so.2 \ + "${PKGDESTDIR}/usr/lib/simplex-chat/simplex/bin/simplex" + + # remove bundled vlc. system libvlc is used + # instead via jna.library.path in the launcher. vlcj uses default NativeDiscovery + # with no custom path logic (VLC_PLUGIN_PATH setenv is commented out upstream). + rm -rf "${PKGDESTDIR}/usr/lib/simplex-chat/simplex/lib/app/resources/vlc" + + # remove forbidden lib64 symlink generated by gradle + rm -rf "${PKGDESTDIR}/usr/lib64" + + vbin "${FILESDIR}/simplex-chat.sh" simplex-chat-gui + vinstall "${FILESDIR}/simplex-chat.desktop" 644 usr/share/applications + vinstall apps/multiplatform/desktop/src/jvmMain/resources/distribute/simplex.png \ + 644 usr/share/icons/hicolor/256x256/apps simplex-chat.png + } +}