aseprite.scm (6071B)


      1 (define-module (mt packages aseprite)
      2   #:use-module (guix build utils)
      3   #:use-module (guix packages)
      4   #:use-module (guix gexp)
      5   #:use-module (guix download)
      6   #:use-module (guix build-system cmake)
      7   #:use-module (guix build-system copy)
      8   #:use-module (gnu packages compression)
      9   #:use-module (gnu packages curl)
     10   #:use-module (gnu packages fontutils)
     11   #:use-module (gnu packages gl)
     12   #:use-module (gnu packages gtk)
     13   #:use-module (gnu packages image)
     14   #:use-module (gnu packages markup)
     15   #:use-module (gnu packages pkg-config)
     16   #:use-module (gnu packages xdisorg)
     17   #:use-module (gnu packages xml)
     18   #:use-module (gnu packages xorg)
     19   #:use-module ((guix licenses) #:prefix license:))
     20 
     21 (define-public tinyexif
     22   (package
     23     (name "tinyexif")
     24     (version "1.0.4")
     25     (source
     26       (origin
     27         (method url-fetch)
     28         (uri (string-append
     29               "https://github.com/cdcseacave/TinyEXIF/archive/refs/tags/"
     30               version ".tar.gz"))
     31         (sha256
     32          (base32
     33           "15fk3dr5i0830h8l2fd2ld68lwj4409prszkxlrvv1ldgk1dx134"))))
     34     (build-system cmake-build-system)
     35     (arguments
     36      (list
     37        #:tests? #f))
     38     (inputs (list tinyxml2))
     39     (home-page "https://github.com/cdcseacave/TinyEXIF")
     40     (synopsis "Small JPEG metadata parser for C++")
     41     (description "TinyEXIF is a tiny, lightweight C++ library for parsing the \
     42 metadata existing inside JPEG files.")
     43     (license license:expat)))
     44 
     45 ;; TODO: Compile from source
     46 
     47 (define-public skia-aseprite
     48   (package
     49     (name "skia-aseprite")
     50     (version "m124")
     51     (source (origin
     52               (method url-fetch/zipbomb)
     53               (uri "https://github.com/aseprite/skia/releases/download/m124-08a5439a6b/Skia-Linux-Release-x64.zip")
     54               (sha256
     55                (base32
     56                 "1f58x393lslxs9pd50y5jrxl83g0p927bcsflg5cw92g4jdyh9x3"))))
     57     (build-system copy-build-system)
     58     (home-page "https://github.com/aseprite/skia")
     59     (synopsis "2D graphics library (aseprite fork)")
     60     (description "This package contains static binaries used specifically for\
     61 the compilation of Aseprite.")
     62     (license license:bsd-3)))
     63 
     64 (define-public aseprite
     65   (package
     66     (name "aseprite")
     67     (version "1.3.16.1")
     68     (source (origin
     69               (method url-fetch/zipbomb)
     70               (uri "https://github.com/aseprite/aseprite/releases/download/v1.3.16/Aseprite-v1.3.16.1-Source.zip")
     71               (sha256
     72                (base32
     73                 "06jmvq8z0m7m9yj229aqpga2illx9hhya2r45i1vvxvjyp7yfqc9"))))
     74     (build-system cmake-build-system)
     75     (arguments
     76      (list
     77        #:tests? #f
     78        #:configure-flags #~(list "-DLAF_BACKEND=skia"
     79                                   (string-append "-DSKIA_DIR="
     80                                                  #$skia-aseprite)
     81                                   (string-append "-DSKIA_LIBRARY_DIR="
     82                                                  #$skia-aseprite
     83                                                  "/out/Release-x64")
     84                                   (string-append "-DSKIA_LIBRARY="
     85                                                  #$skia-aseprite
     86                                                  "/out/Release-x64/libskia.a")
     87                                   ;; Use shared libs (when possible)
     88                                   "-DUSE_SHARED_CMARK=ON"
     89                                   "-DUSE_SHARED_CURL=ON"
     90                                   "-DUSE_SHARED_GIFLIB=ON"
     91                                   "-DUSE_SHARED_ZLIB=ON"
     92                                   "-DUSE_SHARED_LIBPNG=ON"
     93                                   "-DUSE_SHARED_TINYEXIF=ON"
     94                                   "-DUSE_SHARED_TINYXML=ON"
     95                                   "-DUSE_SHARED_PIXMAN=ON"
     96                                   "-DUSE_SHARED_FREETYPE=ON"
     97                                   "-DUSE_SHARED_HARFBUZZ=ON")
     98       #:phases
     99       #~(modify-phases %standard-phases
    100           (add-after 'install 'add-desktop-files
    101             (lambda* (#:key inputs outputs #:allow-other-keys)
    102               (let* ((out   (assoc-ref outputs "out"))
    103                      (share (string-append out "/share"))
    104                      (applications (string-append share "/applications")))
    105                 ;; Setup desktop entry
    106                 (mkdir-p applications)
    107                 (let ((port (open-file (string-append applications
    108                                                       "/aseprite.desktop")
    109                                        "w")))
    110                   (display
    111                     ;; TODO: Create more complex file
    112                     (string-append "[Desktop Entry]
    113                                     Name=Aseprite
    114                                     Exec=" out "/bin/aseprite
    115                                     Icon=aseprite
    116                                     Type=Application")
    117                     port)
    118                   (close-port port))
    119                 ;; Setup default icon
    120                 (mkdir-p (string-append share
    121                                         "/icons/hicolor/128x128/apps"))
    122                 (copy-file
    123                  (string-append share
    124                                 "/aseprite/data/icons/ase128.png")
    125                  (string-append share
    126                                 "/icons/hicolor/128x128/apps/aseprite.png"))))))))
    127     (inputs
    128      (list skia-aseprite
    129            libx11
    130            libxcursor
    131            libxi
    132            libxrandr
    133            mesa
    134            fontconfig
    135            ;; Optional shared deps
    136            cmark
    137            curl
    138            giflib
    139            zlib
    140            libpng
    141            tinyexif
    142            tinyxml2
    143            pixman
    144            freetype
    145            harfbuzz))
    146     (native-inputs
    147      (list pkg-config))
    148     (home-page "https://www.aseprite.org/")
    149     (synopsis "Animated sprite editor and pixel art tool")
    150     (description "Aseprite lets you create 2D animations for videogames. From \
    151 sprites, to pixel-art, retro style graphics, and whatever you like about the \
    152 8-bit and 16-bit era.")
    153     ;; TODO: Include Aseprite EULA
    154     (license #f)))
    155 
    156 aseprite