;;; Copyright © 2022 Denis Carikli ;;; ;;; This file is free software; you can redistribute it and/or modify it ;;; under the terms of the GNU General Public License as published by ;;; the Free Software Foundation; either version 3 of the License, or (at ;;; your option) any later version. ;;; ;;; This file is distributed in the hope that it will be useful, but ;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;;; GNU General Public License for more details. ;;; ;;; You should have received a copy of the GNU General Public License. ;;; If not, see . ;;; ;;; This file is meant to test valgrind support in Guix. ;;; ;;; The libsamsung-ipc library is not ready to be packaged in general ;;; purpose distributions as right now as it requires either a vendor ;;; kernel or the compbinaison of a recent upstream kernel with on top ;;; work in progress out of tree modem drivers, out of tree ;;; libsamsung-ipc code to support theses drivers and kernel patches ;;; to support the nonfree bootloader of the Galaxy SIII ;;; (GT-I9300). Beside the library, the tools are of very limited use ;;; beside testing or reverse engineering. (use-modules (ice-9 popen) (ice-9 rdelim) (sxml ssax input-parse) ((guix licenses) #:prefix license:) (guix build-system android-ndk) (guix build-system gnu) (guix gexp) (guix git-download) (guix packages) (gnu packages android) (gnu packages autotools) (gnu packages commencement) (gnu packages curl) (gnu packages disk) (gnu packages linux) (gnu packages llvm) (gnu packages pkg-config) (gnu packages python) (gnu packages python-xyz) (gnu packages tls) (gnu packages valgrind)) (define-public libsamsung-ipc (package (name "libsamsung-ipc") ;; we use a work in progress version that has support for --with-valgrind-tests (version (git-version "0.0" "HEAD" "4d3062db15783c188d6952f7b9b794b65cd93f66")) (source (origin (method git-fetch) (uri (git-reference (url "https://git.replicant.us/replicant-next/hardware_replicant_libsamsung-ipc") (commit "4d3062db15783c188d6952f7b9b794b65cd93f66"))) (sha256 (base32 "1jzv9z5rkgcx394akf2svja586z54vhd46pvdmzm3ilmspnvjcdx")) (file-name (git-file-name name version)))) (build-system gnu-build-system) (native-inputs `(("autoreconf" ,autoconf) ("aclocal" ,automake) ("libcurl" ,curl) ("ddrescue", ddrescue) ;; ("libc:debug", (@@ (gnu packages commencement) glibc-final) "debug") ("libtool" ,libtool) ("pkgconfig" ,pkg-config) ("python" ,python) ("python-sh" ,python-sh) ("valgrind" ,valgrind))) (inputs `(("openssl" ,openssl))) (arguments `(#:phases (modify-phases %standard-phases (add-before 'build 'patch-python (lambda _ (substitute* (find-files "." ".*\\.py$") (("/usr/bin/env python") (which "python3"))) #t)) (add-after 'patch-python 'fix-valgrind (lambda _ (substitute* (find-files "." ".*\\.py$") (("'--leak-check=full',") "'-v', '--leak-check=full',")) #t)) ;; (add-after 'patch-python 'fix-valgrind ;; (lambda _ ;; (substitute* (find-files "." ".*\\.py$") ;; (("'--leak-check=full',") ;; (string-append ;; "'--leak-check=full', '--extra-debuginfo-path=" ;; (assoc-ref %build-inputs "libc:debug") ;; "/lib/debug',"))) ;; #t)) ) #:configure-flags (list "--enable-debug" "--enable-valgrind-tests"))) (synopsis "libsamsung-ipc is a free software implementation of the Samsung IPC modem protocol") (description "libsamsung-ipc is a free software implementation of the Samsung IPC modem protocol, found in many Samsung smartphones and tablets.") (home-page "https://www.replicant.us") (license license:gpl2+))) (list libsamsung-ipc)