Re: [Telegram-Desktop]: Help with packaging

2021-01-11 Thread Raghav Gururajan

Hello Guix!

Currently, while building tdesktop, I get this error 
(https://paste.debian.net/plain/1180757).


New diff file is attached with this email, which is to be applied on top 
off master (efa773f94a18b40f2c63795f364ae87dade76f60).


Any ideas on how to rectify this error?

Regards,
RG.
diff --git a/gnu/local.mk b/gnu/local.mk
index 1151d4642e..788f1d736e 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -534,6 +534,7 @@ GNU_SYSTEM_MODULES =\
   %D%/packages/task-management.scm		\
   %D%/packages/tbb.scm\
   %D%/packages/tcl.scm\
+  %D%/packages/telegram.scm \
   %D%/packages/telephony.scm			\
   %D%/packages/terminals.scm			\
   %D%/packages/terraform.scm			\
@@ -1124,6 +1125,7 @@ dist_patch_DATA =		\
   %D%/packages/patches/grub-efi-fat-serial-number.patch		\
   %D%/packages/patches/grub-setup-root.patch			\
   %D%/packages/patches/grub-verifiers-Blocklist-fallout-cleanup.patch \
+  %D%/packages/patches/gsl-gtest.patch\
   %D%/packages/patches/gspell-dash-test.patch			\
   %D%/packages/patches/guile-1.8-cpp-4.5.patch			\
   %D%/packages/patches/guile-2.2-skip-oom-test.patch\
@@ -1288,8 +1290,7 @@ dist_patch_DATA =		\
   %D%/packages/patches/libqalculate-3.8.0-libcurl-ssl-fix.patch	\
   %D%/packages/patches/libquicktime-ffmpeg.patch 		\
   %D%/packages/patches/libtar-CVE-2013-4420.patch 		\
-  %D%/packages/patches/libtgvoip-disable-sse2.patch 		\
-  %D%/packages/patches/libtgvoip-disable-webrtc.patch 		\
+  %D%/packages/patches/libtgvoip-pkgconfig.patch \
   %D%/packages/patches/libtheora-config-guess.patch		\
   %D%/packages/patches/libtirpc-hurd.patch			\
   %D%/packages/patches/libtirpc-hurd-client.patch		\
diff --git a/gnu/packages/cmake.scm b/gnu/packages/cmake.scm
index 56b32792fe..ab74650066 100644
--- a/gnu/packages/cmake.scm
+++ b/gnu/packages/cmake.scm
@@ -31,6 +31,7 @@
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (guix packages)
   #:use-module (guix download)
+  #:use-module (guix git-download)
   #:use-module (guix utils)
   #:use-module (guix deprecation)
   #:use-module (guix build-system gnu)
@@ -43,6 +44,7 @@
   #:use-module (gnu packages curl)
   #:use-module (gnu packages file)
   #:use-module (gnu packages hurd)
+  #:use-module (gnu packages kde-frameworks)
   #:use-module (gnu packages libevent)
   #:use-module (gnu packages ncurses)
   #:use-module (gnu packages serialization)
@@ -52,6 +54,33 @@
   #:use-module (ice-9 match)
   #:use-module (srfi srfi-1))
 
+(define-public cmake-shared
+  (package
+(name "cmake-shared")
+(version "1.1.0")
+(source
+ (origin
+   (method git-fetch)
+   (uri
+(git-reference
+ (url "https://github.com/lirios/cmake-shared.git;)
+ (commit
+  (string-append "v" version
+   (file-name
+(git-file-name name version))
+   (sha256
+(base32 "1srd3jmlalf0szgyp88ymhbnwds4qiywmf8lq1pif9g8irjjhdry"
+(build-system cmake-build-system)
+(arguments
+ `(#:tests? #f)); No target
+(native-inputs
+ `(("extra-cmake-modules" ,extra-cmake-modules)))
+(synopsis "Shared CMake functions and macros")
+(description "CMake-Shared are shared functions and macros for projects
+using the CMake build system.")
+(home-page "https://github.com/lirios/cmake-shared/;)
+(license license:bsd-3)))
+
 ;;; Build phases shared between 'cmake-bootstrap' and the later variants
 ;;; that use cmake-build-system.
 (define %common-build-phases
diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm
index 45d3faeafb..4295e6cc3d 100644
--- a/gnu/packages/cpp.scm
+++ b/gnu/packages/cpp.scm
@@ -39,16 +39,19 @@
   #:use-module (guix git-download)
   #:use-module (guix build-system cmake)
   #:use-module (guix build-system gnu)
+  #:use-module (guix build-system meson)
   #:use-module (guix build-system python)
   #:use-module (gnu packages)
   #:use-module (gnu packages autotools)
   #:use-module (gnu packages boost)
   #:use-module (gnu packages c)
   #:use-module (gnu packages check)
+  #:use-module (gnu packages cmake)
   #:use-module (gnu packages code)
   #:use-module (gnu packages compression)
   #:use-module (gnu packages crypto)
   #:use-module (gnu packages curl)
+  #:use-module (gnu packages documentation)
   #:use-module (gnu packages gcc)
   #:use-module (gnu packages libevent)
   #:use-module (gnu packages libunwind)
@@ -63,6 +66,96 @@
   #:use-module (gnu packages tls)
   #:use-module (gnu packages web))
 
+(define-public rlottie
+  (package
+(name "rlottie")
+(version "0.2")
+(source
+ (origin
+   (method git-fetch)
+   (uri
+(git-reference
+ (url "https://github.com/Samsung/rlottie.git;)
+ (commit
+  (string-append "v" version
+   (file-name
+(git-file-name name version))
+   (sha256
+(base32 

Re: [Telegram-Desktop]: Help with packaging

2021-01-08 Thread Raghav Gururajan

Hello Guix!

While building 'tdesktop', I get this error: 
https://paste.debian.net/1180280/


Any ideas?

Regards,
RG.



Re: [Telegram-Desktop]: Help with packaging

2021-01-08 Thread Raghav Gururajan

Hi Mark and Ricardo!


It's more appropriate to use 'for-each' here.  'map' collects all of the
results into a list and returns that list, which is not needed here, and
is slightly less readable.  Also, the second argument to 'find-files' is
optional; omitting it does what's needed more efficiently.  So, in the
interest of promoting better practices, I would recommend this instead:

--8<---cut here---start->8---
  (add-after 'unpack 'make-writable
(lambda _
  (for-each make-file-writable
(find-files "."))
  #t))
--8<---cut here---end--->8---


Thank you for this better variant.  I copied it from an existing
instance in our code.  We should clean those up at some point :)


This worked. :-)

Regards,
RG.



Re: [Telegram-Desktop]: Help with packaging

2021-01-08 Thread Ricardo Wurmus


Hi Mark,

> It's more appropriate to use 'for-each' here.  'map' collects all of the
> results into a list and returns that list, which is not needed here, and
> is slightly less readable.  Also, the second argument to 'find-files' is
> optional; omitting it does what's needed more efficiently.  So, in the
> interest of promoting better practices, I would recommend this instead:
>
> --8<---cut here---start->8---
>  (add-after 'unpack 'make-writable
>(lambda _
>  (for-each make-file-writable
>(find-files "."))
>  #t))
> --8<---cut here---end--->8---

Thank you for this better variant.  I copied it from an existing
instance in our code.  We should clean those up at some point :)

-- 
Ricardo



Re: [Telegram-Desktop]: Help with packaging

2021-01-08 Thread Mark H Weaver
Hi,

Ricardo Wurmus  writes:

> Because you are fetching from git and the git checkout is not writable
> You need a build phase like this:
>
> --8<---cut here---start->8---
>  (add-after 'unpack 'make-writable
>(lambda _
>  (map make-file-writable
>   (find-files "." ".*"))
>  #t))
> --8<---cut here---end--->8---

It's more appropriate to use 'for-each' here.  'map' collects all of the
results into a list and returns that list, which is not needed here, and
is slightly less readable.  Also, the second argument to 'find-files' is
optional; omitting it does what's needed more efficiently.  So, in the
interest of promoting better practices, I would recommend this instead:

--8<---cut here---start->8---
 (add-after 'unpack 'make-writable
   (lambda _
 (for-each make-file-writable
   (find-files "."))
 #t))
--8<---cut here---end--->8---

Regards,
  Mark



Re: [Telegram-Desktop]: Help with packaging

2021-01-08 Thread Julien Lepiller



Le 8 janvier 2021 07:11:38 GMT-05:00, Ekaitz Zarraga  a 
écrit :
>Hi,
>
>I'm not sure about what I'm going to say so take it with care:
>
>About the permission error I think the build directories are write
>protected by default it Guix, please someone correct me if I'm wrong.
>I'd say you can change the permissions of the folder with the chmod
>util, you can see many packages do it. Just call it like:
>
>(chmod filename mode)
>
>Being `mode` something like #o664 for an equivalent `chmod 664
>filename` bash call.

Well, not by default: /gnu is read-only, but the package wants to write to 
/tmp, which is read-write. However, since you're using the git-fetch method for 
the sources, they are copied as is. Since they come from the store, the files 
are read-only, whicg makes your sources read-only.

>
>So I guess you need an extra build phase to correct the permissions on
>the folder so the script can write to it.
>
>Maybe that will fix both errors, but make sure also that you have the
>dependencies for ElementTree, just in case.
>
>I hope this helps...
>
>Best,
>Ekaitz



Re: [Telegram-Desktop]: Help with packaging

2021-01-08 Thread Ricardo Wurmus


Raghav Gururajan  writes:

> Hello Guix!
>
>> With this email, I have attached the complete diff, which is to be 
>> applied on top of master.
>
> I have attached wrong file before. Here is the correct one attached.

The error you posted is this:

--8<---cut here---start->8---
Traceback (most recent call last):
  File 
"/gnu/store/q9rm8h9imazsq2c4qiv2yjpvlvliywqb-python-3.8.2/lib/python3.8/xml/etree/ElementTree.py",
 line 786, in _get_writer
write = file_or_filename.write
AttributeError: 'str' object has no attribute 'write'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File 
"/tmp/guix-build-tdesktop-2.5.1.drv-0/source/Telegram/build/changelog2appdata.py",
 line 73, in 
main()
  File 
"/tmp/guix-build-tdesktop-2.5.1.drv-0/source/Telegram/build/changelog2appdata.py",
 line 68, in main
update_appdata(args.appdata_path,
  File 
"/tmp/guix-build-tdesktop-2.5.1.drv-0/source/Telegram/build/changelog2appdata.py",
 line 60, in update_appdata
appdata.write(appdata_path, encoding="utf-8", xml_declaration=True)
  File 
"/gnu/store/q9rm8h9imazsq2c4qiv2yjpvlvliywqb-python-3.8.2/lib/python3.8/xml/etree/ElementTree.py",
 line 756, in write
with _get_writer(file_or_filename, enc_lower) as write:
  File 
"/gnu/store/q9rm8h9imazsq2c4qiv2yjpvlvliywqb-python-3.8.2/lib/python3.8/contextlib.py",
 line 113, in __enter__
return next(self.gen)
  File 
"/gnu/store/q9rm8h9imazsq2c4qiv2yjpvlvliywqb-python-3.8.2/lib/python3.8/xml/etree/ElementTree.py",
 line 792, in _get_writer
file = open(file_or_filename, "w", encoding=encoding,
PermissionError: [Errno 13] Permission denied: 
'/tmp/guix-build-tdesktop-2.5.1.drv-0/build/Telegram/telegramdesktop.appdata.xml'
--8<---cut here---end--->8---

Because you are fetching from git and the git checkout is not writable
You need a build phase like this:

--8<---cut here---start->8---
 (add-after 'unpack 'make-writable
   (lambda _
 (map make-file-writable
  (find-files "." ".*"))
 #t))
--8<---cut here---end--->8---


-- 
Ricardo



Re: [Telegram-Desktop]: Help with packaging

2021-01-08 Thread Ekaitz Zarraga
Hi,

I'm not sure about what I'm going to say so take it with care:

About the permission error I think the build directories are write protected by 
default it Guix, please someone correct me if I'm wrong.
I'd say you can change the permissions of the folder with the chmod util, you 
can see many packages do it. Just call it like:

(chmod filename mode)

Being `mode` something like #o664 for an equivalent `chmod 664 filename` bash 
call.

So I guess you need an extra build phase to correct the permissions on the 
folder so the script can write to it.

Maybe that will fix both errors, but make sure also that you have the 
dependencies for ElementTree, just in case.

I hope this helps...

Best,
Ekaitz



Re: [Telegram-Desktop]: Help with packaging

2021-01-07 Thread Raghav Gururajan

Hello Guix!

With this email, I have attached the complete diff, which is to be 
applied on top of master.


I have attached wrong file before. Here is the correct one attached.

Regards,
RG.
diff --git a/gnu/local.mk b/gnu/local.mk
index dfd44ac769..4332f16a82 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -533,6 +533,7 @@ GNU_SYSTEM_MODULES =\
   %D%/packages/task-management.scm		\
   %D%/packages/tbb.scm\
   %D%/packages/tcl.scm\
+  %D%/packages/telegram.scm \
   %D%/packages/telephony.scm			\
   %D%/packages/terminals.scm			\
   %D%/packages/terraform.scm			\
@@ -1124,6 +1125,7 @@ dist_patch_DATA =		\
   %D%/packages/patches/grub-efi-fat-serial-number.patch		\
   %D%/packages/patches/grub-setup-root.patch			\
   %D%/packages/patches/grub-verifiers-Blocklist-fallout-cleanup.patch \
+  %D%/packages/patches/gsl-gtest.patch\
   %D%/packages/patches/gspell-dash-test.patch			\
   %D%/packages/patches/guile-1.8-cpp-4.5.patch			\
   %D%/packages/patches/guile-2.2-skip-oom-test.patch\
@@ -1288,8 +1290,7 @@ dist_patch_DATA =		\
   %D%/packages/patches/libqalculate-3.8.0-libcurl-ssl-fix.patch	\
   %D%/packages/patches/libquicktime-ffmpeg.patch 		\
   %D%/packages/patches/libtar-CVE-2013-4420.patch 		\
-  %D%/packages/patches/libtgvoip-disable-sse2.patch 		\
-  %D%/packages/patches/libtgvoip-disable-webrtc.patch 		\
+  %D%/packages/patches/libtgvoip-pkgconfig.patch \
   %D%/packages/patches/libtheora-config-guess.patch		\
   %D%/packages/patches/libtirpc-hurd.patch			\
   %D%/packages/patches/libtirpc-hurd-client.patch		\
diff --git a/gnu/packages/cmake.scm b/gnu/packages/cmake.scm
index 56b32792fe..ab74650066 100644
--- a/gnu/packages/cmake.scm
+++ b/gnu/packages/cmake.scm
@@ -31,6 +31,7 @@
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (guix packages)
   #:use-module (guix download)
+  #:use-module (guix git-download)
   #:use-module (guix utils)
   #:use-module (guix deprecation)
   #:use-module (guix build-system gnu)
@@ -43,6 +44,7 @@
   #:use-module (gnu packages curl)
   #:use-module (gnu packages file)
   #:use-module (gnu packages hurd)
+  #:use-module (gnu packages kde-frameworks)
   #:use-module (gnu packages libevent)
   #:use-module (gnu packages ncurses)
   #:use-module (gnu packages serialization)
@@ -52,6 +54,33 @@
   #:use-module (ice-9 match)
   #:use-module (srfi srfi-1))
 
+(define-public cmake-shared
+  (package
+(name "cmake-shared")
+(version "1.1.0")
+(source
+ (origin
+   (method git-fetch)
+   (uri
+(git-reference
+ (url "https://github.com/lirios/cmake-shared.git;)
+ (commit
+  (string-append "v" version
+   (file-name
+(git-file-name name version))
+   (sha256
+(base32 "1srd3jmlalf0szgyp88ymhbnwds4qiywmf8lq1pif9g8irjjhdry"
+(build-system cmake-build-system)
+(arguments
+ `(#:tests? #f)); No target
+(native-inputs
+ `(("extra-cmake-modules" ,extra-cmake-modules)))
+(synopsis "Shared CMake functions and macros")
+(description "CMake-Shared are shared functions and macros for projects
+using the CMake build system.")
+(home-page "https://github.com/lirios/cmake-shared/;)
+(license license:bsd-3)))
+
 ;;; Build phases shared between 'cmake-bootstrap' and the later variants
 ;;; that use cmake-build-system.
 (define %common-build-phases
diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm
index 00e006928e..f92cfe0c26 100644
--- a/gnu/packages/cpp.scm
+++ b/gnu/packages/cpp.scm
@@ -39,16 +39,19 @@
   #:use-module (guix git-download)
   #:use-module (guix build-system cmake)
   #:use-module (guix build-system gnu)
+  #:use-module (guix build-system meson)
   #:use-module (guix build-system python)
   #:use-module (gnu packages)
   #:use-module (gnu packages autotools)
   #:use-module (gnu packages boost)
   #:use-module (gnu packages c)
   #:use-module (gnu packages check)
+  #:use-module (gnu packages cmake)
   #:use-module (gnu packages code)
   #:use-module (gnu packages compression)
   #:use-module (gnu packages crypto)
   #:use-module (gnu packages curl)
+  #:use-module (gnu packages documentation)
   #:use-module (gnu packages gcc)
   #:use-module (gnu packages libevent)
   #:use-module (gnu packages libunwind)
@@ -63,6 +66,96 @@
   #:use-module (gnu packages tls)
   #:use-module (gnu packages web))
 
+(define-public rlottie
+  (package
+(name "rlottie")
+(version "0.2")
+(source
+ (origin
+   (method git-fetch)
+   (uri
+(git-reference
+ (url "https://github.com/Samsung/rlottie.git;)
+ (commit
+  (string-append "v" version
+   (file-name
+(git-file-name name version))
+   (sha256
+(base32 "10bxr1zf9wxl55d4cw2j02r6sgqln7mbxplhhfvhw0z92fi40kr3"
+(build-system meson-build-system)
+(arguments
+ `(#:configure-flags
+   (list
+