diff mbox series

[bug#62424] gnu: Add lazarus.

Message ID 20230323101604.17976-1-dannym@scratchpost.org
State New
Headers show
Series [bug#62424] gnu: Add lazarus. | expand

Commit Message

Danny Milosavljevic March 23, 2023, 10:16 a.m. UTC
From: Danny Milosavljevic <dannym@scratchpost.org>

* gnu/packages/pascal.scm (lazarus): Add variable.
---
 gnu/packages/pascal.scm | 324 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 324 insertions(+)

Comments

Maxim Cournoyer March 29, 2023, 6:57 p.m. UTC | #1
Hi Danny!

dannym@scratchpost.org writes:

> From: Danny Milosavljevic <dannym@scratchpost.org>
>
> * gnu/packages/pascal.scm (lazarus): Add variable.
> ---
>  gnu/packages/pascal.scm | 324 ++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 324 insertions(+)
>
> diff --git a/gnu/packages/pascal.scm b/gnu/packages/pascal.scm
> index f563f077dc..4432327bee 100644
> --- a/gnu/packages/pascal.scm
> +++ b/gnu/packages/pascal.scm
> @@ -24,6 +24,7 @@ (define-module (gnu packages pascal)
>    #:use-module ((guix licenses) #:prefix license:)
>    #:use-module (guix packages)
>    #:use-module (guix download)
> +  #:use-module (guix git-download)
>    #:use-module (guix gexp)
>    #:use-module (guix utils)
>    #:use-module (guix build-system gnu)
> @@ -32,9 +33,13 @@ (define-module (gnu packages pascal)
>    #:use-module (gnu packages bootstrap)
>    #:use-module (gnu packages compression)
>    #:use-module (gnu packages gcc)
> +  #:use-module (gnu packages glib)
> +  #:use-module (gnu packages gtk)
>    #:use-module (gnu packages ncurses)
>    #:use-module (gnu packages perl)
> +  #:use-module (gnu packages pkg-config)
>    #:use-module (gnu packages xml)
> +  #:use-module (gnu packages xorg)
>    #:use-module (ice-9 match))
>  
>  (define %fpc-version "3.2.2")
> @@ -270,3 +275,322 @@ (define-public p2c
>  Pascal programs.")
>      (home-page "http://users.fred.net/tds/lab/p2c/")
>      (license license:gpl2+)))
> +
> +(define-public lazarus
> +  (package
> +    (name "lazarus")
> +    (version "2.2.6")
> +    (source (origin
> +              (method git-fetch)
> +              (uri (git-reference
> +                     (url
> +                      "https://gitlab.com/freepascal.org/lazarus/lazarus.git")
> +                     (commit (string-append "lazarus_"
> +                                            (string-join
> +                                             (string-split version #\.)
> +                                             "_")))))
> +              (file-name (string-append name "-" version "-checkout"))
> +              (sha256
> +               (base32
> +                "0hpk6fxmy1h1q0df41jg1vnp8g8vynrg5v5ad43lv229nizfs3wj"))))
> +    (build-system gnu-build-system)
> +    (arguments
> +     `(#:tests? #f ; No tests exist
> +       #:phases
> +       (modify-phases %standard-phases
> +        (delete 'configure)
> +        (replace 'build
> +          (lambda* (#:key inputs outputs #:allow-other-keys)
> +            ;; RUNPATH -k-rpath=
> +            ;; -Xr<x> rlink-path

Seems like leftovers.

> +            (let* ((libdirs
> +                    (map (lambda (x)
> +                           (assoc-ref inputs x))
> +                         '("glib" "gdk-pixbuf" "gtk+" "libx11"
> +                           "libx11" "pango" "cairo" "atk")))

Nitpick: the map could be to the right of libdirs.

> +                   (libs (append
> +                          (map (lambda (name)
> +                                 (string-append "-Fl" name "/lib"))
> +                               libdirs)
> +                          (map (lambda (name)
> +                                 (string-append "-k-rpath=" name "/lib"))
> +                               libdirs))))
> +              (setenv "LAZARUS_LIBPATHS"
> +                      (string-append ;"-XD "

Leftovers.

> +                                     (string-join libs " ")))
> +              (setenv "MAKEFLAGS"
> +                      (string-append "LHELP_OPT="
> +                                     (string-join libs "\\ "))))
> +            (setenv "INSTALL_PREFIX" (assoc-ref outputs "out"))
> +            (invoke "make" "bigide"))))))
> +    (native-inputs
> +     (list fpc pkg-config))
> +    (inputs
> +     (list glib gdk-pixbuf gtk+-2 libx11 pango cairo atk))

Can't it use GTK 3 at least?  GTK 2 is on the way out...

> +    (synopsis "Integrated development environment for Pascal")
> +    (description "This package provides an integrated development environment
> +for Pascal.")
> +    (home-page "https://www.lazarus-ide.org/")
> +    ; asl2.0: lcl/interfaces/customdrawn/android/*, lcl/lcltaskdialog.pas
> +    ;
> +    ; CC-BY-SA-3:
> +    ;  components/onlinepackagemanager/images/*, lcl/lcltaskdialog.pas
> +    ;
> +    ; CC-BY-SA-4: images/icons/lazarus.svg, lcl/lcltaskdialog.pas
> +    ;
> +    ; Expat: components/aggpas/expat-pas/*,
> +    ;  examples/database/sqldbtutorial3/dbconfig.pas,
> +    ;  examples/database/tsqlscript/dbconfig.pas,
> +    ;  lcl/interfaces/customdrawn/android/egl.pas, lcl/themes.pas,
> +    ;  components/opengl/example/uglyfont.pas
> +    ;
> +    ; Freetype:
> +    ;  components/lazutils/lazfreetype.pas, components/lazutils/tt*.pas
> +    ;
> +    ; LGPL-2+:
> +    ;  components/chmhelp/lhelp/chmdataprovider.pas
> +    ;  components/chmhelp/lhelp/chmspecialparser.pas
> +    ;  components/customdrawn/customdrawnextras.pas
> +    ;  components/datetimectrls/*
> +    ;  components/dbexport/fpdataexporter.pp
> +    ;  components/dbexport/frmbaseconfigexport.pp
> +    ;  components/dbexport/frmexportprogress.pp
> +    ;  components/dbexport/frmselectexportformat.pp
> +    ;  components/dbexport/regdbexport.pp
> +    ;  components/fpdebug/fpimgreaderwinpetypes.pas
> +    ;  components/fpvectorial/htmlvectorialreader.pas
> +    ;  components/ideintf/actionseditor.pas
> +    ;  components/ideintf/actionseditorstd.pas
> +    ;  components/ideintf/baseideintf.pas
> +    ;  components/ideintf/dbpropedits.pas
> +    ;  components/ideintf/fieldseditor.pas
> +    ;  components/ideintf/idedialogs.pas
> +    ;  components/ideintf/ideexterntoolintf.pas
> +    ;  components/ideintf/ideutils.pas
> +    ;  components/ideintf/keyvalpropeditdlg.pas
> +    ;  components/ideintf/macrodefintf.pas
> +    ;  components/ideintf/macrointf.pas
> +    ;  components/ideintf/maskpropedit.pas
> +    ;  components/ideintf/newfield.pas
> +    ;  components/ideintf/toolbarintf.pas
> +    ;  components/ideintf/treeviewpropedit.pas
> +    ;  components/lazcontrols/checkboxthemed.pas
> +    ;  components/lazcontrols/dividerbevel.pas
> +    ;  components/lazcontrols/extendednotebook.pas
> +    ;  components/lazcontrols/listfilteredit.pas
> +    ;  components/lazcontrols/listviewfilteredit.pas
> +    ;  components/lazcontrols/lvlgraphctrl.pas
> +    ;  components/lazcontrols/treefilteredit.pas
> +    ;  components/lazreport/source/*
> +    ;  components/lazutils/asiancodepagefunctions.inc
> +    ;  components/lazutils/fpcadds.pas
> +    ;  components/lazutils/laz2_dom.pas
> +    ;  components/lazutils/laz2_xmlcfg.pas
> +    ;  components/lazutils/laz2_xmlread.pas
> +    ;  components/lazutils/laz2_xmlutils.pas
> +    ;  components/lazutils/laz2_xmlwrite.pas
> +    ;  components/lazutils/laz2_xpath.pas
> +    ;  components/lazutils/laz_xmlcfg.pas
> +    ;  components/lazutils/laz_xmlstreaming.pas
> +    ;  components/lazutils/lookupstringlist.pas
> +    ;  components/multithreadprocs/mtpcpu.pas
> +    ;  components/multithreadprocs/mtprocs.pas
> +    ;  components/multithreadprocs/mtputils.pas
> +    ;  components/opengl/glcocoanscontext.pas
> +    ;  components/paradox/regparadox.pp
> +    ;  components/printers/printer4lazstrconst.pas
> +    ;  components/sparta/dockedformeditor/source/*
> +    ;  components/sparta/generics/source/*
> +    ;  components/wiki/myfphttpclient.pp
> +    ;  examples/lpicustomdata/lpicustomdata.lpr
> +    ;  ide/findinfilesdlg.pas
> +    ;  ide/findreplacedialog.pp
> +    ;  ide/inputfiledialog.pas
> +    ;  ide/lazadvancedipc.pp
> +    ;  ide/patheditordlg.pas
> +    ;  ide/transfermacros.pp
> +    ;  ide/wordcompletion.pp
> +    ;  lcl/colorbox.pas
> +    ;  lcl/customdrawncontrols.pas
> +    ;  lcl/dbextctrls.pp
> +    ;  lcl/dbgrids.pas
> +    ;  lcl/forms/calcform.pas
> +    ;  lcl/forms/timepopup.pas
> +    ;  lcl/grids.pas
> +    ;  lcl/include/comboex.inc
> +    ;  lcl/include/controlconsts.inc
> +    ;  lcl/include/customflowpanel.inc
> +    ;  lcl/include/dbdateedit.inc
> +    ;  lcl/include/tiffimage.inc
> +    ;  lcl/interfacebase.pp
> +    ;  lcl/interfaces/cocoa/cocoacaret.pas
> +    ;  lcl/interfaces/cocoa/cocoawschecklst.pas
> +    ;  lcl/interfaces/cocoa/cocoawsspin.pas
> +    ;  lcl/interfaces/cocoa/cocoa_extra.pas
> +    ;  lcl/interfaces/customdrawn/customdrawn_winextra.pas
> +    ;  lcl/interfaces/gtk3/gtk3wsextdlgs.pp
> +    ;  lcl/interfaces/qt/qt45.pas
> +    ;  lcl/interfaces/qt/qtcaret.pas
> +    ;  lcl/interfaces/win32/win32extra.pas
> +    ;  lcl/interfaces/wince/winext.pas
> +    ;  lcl/lclunicodedata.pas
> +    ;  test/testresult-db/importtestresults.pp
> +    ;  test/testresult-db/teststr.pp
> +    ;  test/testresult-db/tresults.pp
> +    ;  tools/lazdatadesktop/ddfiles.pp
> +    ;  components/aarre/src/aarrepkglist.pas
> +    ;  components/activex/activexcontainer.pas
> +    ;  components/activex/lazactivexreg.pas
> +    ;  components/anchordocking/anchordocking.pas
> +    ;  components/anchordocking/anchordockoptionsdlg.pas
> +    ;  components/anchordocking/anchordockstorage.pas
> +    ;  components/anchordocking/anchordockstr.pas
> +    ;  components/anchordocking/design/registeranchordocking.pas
> +    ;  components/anchordocking/restoredebugger/mainunit.pas
> +    ;  components/cairocanvas/cairoprinter.pas
> +    ;  components/codetools/examples/sourcecloser.lpr
> +    ;  components/compilers/c/lazcstrconsts.pas
> +    ;  components/compilers/c/lazcutil.pas
> +    ;  components/datadict/ldd_consts.pas
> +    ;  components/dbexport/sdb_consts.pas
> +    ;  components/externhelp/externhelpfrm.pas
> +    ;  components/fpcunit/guitestrunner.pas
> +    ;  components/fpcunit/ide/fpcunitlazideintf.pas
> +    ;  components/fpcunit/ide/strtestcaseopts.pas
> +    ;  components/fppkg/src/fppkg_const.pas
> +    ;  components/fppkg/src/fppkg_details.pas
> +    ;  components/fppkg/src/fppkg_mainfrm.pas
> +    ;  components/fppkg/src/fppkg_optionsfrm.pas
> +    ;  components/fppkg/src/lazfppkgmanagerintf.pas
> +    ;  components/fpweb/fpideexteditorinsertfilenameunit.pas
> +    ;  components/fpweb/fpwebfieldsettagunit.pas
> +    ;  components/fpweb/fpwebhrefeditunit.pas
> +    ;  components/fpweb/fpwebhtmltaglegendunit.pas
> +    ;  components/fpweb/fpwebnewhtmlfileunit.pas
> +    ;  components/fpweb/fpwebnewhtmlformunit.pas
> +    ;  components/fpweb/fpwebnewhtmlimgunit.pas
> +    ;  components/fpweb/fpwebnewhtmlinputunit.pas
> +    ;  components/fpweb/fpwebnewhtmllistunit.pas
> +    ;  components/fpweb/fpwebnewhtmltableunit.pas
> +    ;  components/fpweb/fpwebnewhtmltagpreunit.pas
> +    ;  components/fpweb/fpwebnewhtmltagtdunit.pas
> +    ;  components/fpweb/fpwebnewhtmltagtrunit.pas
> +    ;  components/fpweb/fpwebselectoptionsunit.pas
> +    ;  components/fpweb/fpwebselecttagunit.pas
> +    ;  components/fpweb/lazweb.pp
> +    ;  components/fpweb/weblazideintf.pp
> +    ;  components/images/lazbmp.pas
> +    ;  components/images/lazjpg.pas
> +    ;  components/images/lazpng.pas
> +    ;  components/images/lazpnm.pas
> +    ;  components/images/laztga.pas
> +    ;  components/images/lazxpm.pas
> +    ;  components/lazreport/samples/editor/maincalleditor.pas
> +    ;  components/lazreport/source/addons/DialogControls/lrdbdialogcontrols.pas
> +    ;  components/lazreport/source/addons/DialogControls/lrdialogcontrols.pas
> +    ;  components/lazreport/source/addons/DialogControls/lrformstorage.pas
> +    ;  components/lazreport/source/addons/DialogControls/lrformstorageeditor.pas
> +    ;  components/lazreport/source/addons/lrFclPDFExport/lr_e_fclpdf.pas
> +    ;  components/lazreport/source/addons/lrFclPDFExport/lr_pdfexport.lpk
> +    ;  components/lazreport/source/addons/lrFclPDFExport/lrpdfexport.pas
> +    ;  components/lazreport/source/addons/lrOfficeImport/lrofficeimport.pas
> +    ;  components/lazreport/source/addons/lrOfficeImport/lrspreadsheetimportunit.pas
> +    ;  components/lazreport/source/fr3tolrf.pas
> +    ;  components/lazreport/source/lr_crossarray.pas
> +    ;  components/lazreport/source/lr_crosstab.pas
> +    ;  components/lazreport/source/lr_crosstabeditor.pas
> +    ;  components/lazreport/source/lr_fpc.pas
> +    ;  components/lazreport/source/lr_hyphen.pas
> +    ;  components/messagecomposer/messagecomposer.pas
> +    ;  components/mrumenu/mrumanager.pp
> +    ;  components/mrumenu/reglazmru.pp
> +    ;  components/multithreadprocs/examples/parallelloop1.lpr
> +    ;  components/plotfunction/exprplotpanel.pp
> +    ;  components/plotfunction/plotpanel.pp
> +    ;  components/synedit/design/synpropertyeditobjectlist.pas
> +    ;  components/vlc/lclvlc.pp
> +    ;  examples/androidlcl/sqlitejniandroid.pas
> +    ;  examples/cleandir/dircleaner.pp
> +    ;  examples/cleandir/frmlog.pp
> +    ;  examples/cleandir/frmmain.pp
> +    ;  examples/cleandir/svccleandirs.pp
> +    ;  examples/cleandir/svcmap.pp
> +    ;  examples/designnonlcl/mywidgetdesigner.pas
> +    ;  examples/designnonlcl/mywidgetset.pas
> +    ;  examples/exploremenu/frmexploremenu.pas
> +    ;  examples/gridexamples/columneditors/main.pas
> +    ;  examples/gridexamples/columneditors/stringgrideditor.lpr
> +    ;  ide/editortoolbarstatic.pas
> +    ;  ide/toolbarconfig.pas
> +    ;  lcl/comboex.pas
> +    ;  lcl/defaulttranslator.pas
> +    ;  lcl/interfaces/gtk3/gtk3bindings/lazpangocairo1.pas
> +    ;  lcl/lcltranslator.pas
> +    ;  tools/iconvtable.pas
> +    ;  tools/iconvtable_dbcs.pas
> +    ;  tools/lazdatadesktop/lazdatadeskstr.pas
> +    ;  tools/lplupdate.lpr
> +    ;  tools/updatemakefiles.lpr
> +    ;  lcl/lcltaskdialog.pas
> +
> +    ; MPL-1.1:
> +    ;  components/synedit/synedithighlighter.pp
> +    ;  components/synedit/synedithighlighterfoldbase.pas
> +    ;  components/synedit/synhighlighterposition.pas
> +    ;  components/synunihighlighter/synuni.lpk
> +    ;  components/turbopower_ipro/ipanim.pas
> +    ;  components/turbopower_ipro/ipconst.pas
> +    ;  components/turbopower_ipro/ipdefct.inc
> +    ;  components/turbopower_ipro/ipdefine.inc
> +    ;  components/turbopower_ipro/ipfilebroker.pas
> +    ;  components/turbopower_ipro/iphtml.pas
> +    ;  components/turbopower_ipro/iphtmlpv.pas
> +    ;  components/turbopower_ipro/ipmsg.pas
> +    ;  components/turbopower_ipro/ipstrms.pas
> +    ;  components/turbopower_ipro/iputils.pas
> +    ;  lcl/interfaces/gtk3/gtk3bindings/lazcairo1.pas
> +
> +    ; own_dwywwi_license: components/opengl/example/uglyfont.pas
> +    ; I don't abandon the copyright, but you can use this code and the header
> +    ; (uglyfont.cpp and uglyfont.h) for your product regardless of the purpose,
> +    ; i.e., free or commercial, open source or proprietary.
> +    ;
> +    ; However, I do not take any responsibility for the consequence of using
> +    ; this code and header.  Please use on your own risks.
> +
> +    ; pascalscript-zlib-like:
> +    ;  components/PascalScript/*
> +
> +    ; public-domain:
> +    ;  components/fpdebug/macho.pas
> +    ;  lcl/images/btncalculator.png
> +    ;  lcl/images/btncalendar.png
> +    ;  lcl/images/btnfiltercancel.png
> +    ;  lcl/images/btnseldir.png
> +    ;  lcl/images/btnselfile.png
> +    ;  lcl/images/btntime.png
> +    ;  lcl/images/buttons/*
> +    ;  lcl/images/dbnavigator/*
> +    ;  lcl/images/dialogs/*
> +    ;  lcl/images/dock/lcl_dock_to_bottom.png
> +    ;  lcl/images/dock/lcl_dock_to_left.png
> +    ;  lcl/images/dock/lcl_dock_to_page.png
> +    ;  lcl/images/dock/lcl_dock_to_right.png
> +    ;  lcl/images/dock/lcl_dock_to_top.png
> +    ;  lcl/images/sortasc.png
> +    ;  lcl/images/sortdesc.png
> +    ;  lcl/images/wince/wincedialog_cancel.png
> +    ;  lcl/images/cursors/*
> +
> +    ; seems-common:
> +    ;  components/aggpas/src/*
> +    ;  components/aggpas/image_transforms.txt
> +    ;  Permission to copy, use, modify, sell and distribute this software
> +    ;  is granted provided this copyright notice appears in all copies.
> +    ;  This software is provided "as is" without express or implied
> +    ;  warranty, and with no claim as to its suitability for any purpose.
> +
> +    ; unlicense: examples/database/sqlite_encryption_pragma/unit1.pas

That's an impressive listing, but I'd rather a worded summary instead,
which is less likely to bitrot/easier to maintain.

> +    ;; All the above.
> +    (license (list license:gpl2+ license:lgpl2.0+))))

Could you please send a v2 with the above taken into account?  Thank
you!
\( March 29, 2023, 7:26 p.m. UTC | #2
Heya,

Adding on to what Maxim said:

On Thu Mar 23, 2023 at 10:16 AM GMT,  wrote:
> +    (arguments
> +     `(#:tests? #f ; No tests exist
> +       #:phases
> +       (modify-phases %standard-phases
> +        (delete 'configure)
> +        (replace 'build
> +          (lambda* (#:key inputs outputs #:allow-other-keys)
> +            ;; RUNPATH -k-rpath=
> +            ;; -Xr<x> rlink-path
> +            (let* ((libdirs
> +                    (map (lambda (x)
> +                           (assoc-ref inputs x))
> +                         '("glib" "gdk-pixbuf" "gtk+" "libx11"
> +                           "libx11" "pango" "cairo" "atk")))
> +                   (libs (append
> +                          (map (lambda (name)
> +                                 (string-append "-Fl" name "/lib"))
> +                               libdirs)
> +                          (map (lambda (name)
> +                                 (string-append "-k-rpath=" name "/lib"))
> +                               libdirs))))
> +              (setenv "LAZARUS_LIBPATHS"
> +                      (string-append ;"-XD "
> +                                     (string-join libs " ")))
> +              (setenv "MAKEFLAGS"
> +                      (string-append "LHELP_OPT="
> +                                     (string-join libs "\\ "))))
> +            (setenv "INSTALL_PREFIX" (assoc-ref outputs "out"))
> +            (invoke "make" "bigide"))))))

Please make sure you use the new-ish LIST/GEXP style for ARGUMENTS; also, much
of your modified BUILD phase could be replaced by modifying #:MAKE-FLAGS, and
LIBS could be generated in a much simpler way with FOLD from (SRFI SRFI-1):

---
> +    (arguments
> +     (list #:tests? #f ;no tests
> +           #:make-flags
> +           #~(begin
> +               (use-modules (srfi srfi-1))
> +               (let* ((lib-dirs
> +                       (list #$@(map this-package-input
> +                                     '("glib" "gdk-pixbuf" "gtk+"
> +                                       "libx11" "pango" "cairo" "atk"))))
> +                      (lib-flags
> +                       (fold (lambda (pkg flags)
> +                               (cons* (string-append "-Fl" pkg "/lib")
> +                                      (string-append "-k-rpath=" pkg "/lib")
> +                                      flags))
> +                             lib-dirs)))
> +                 (list (string-append "LAZARUS_LIBPATHS="
> +                                      (string-join lib-flags))
> +                       (string-append "LHELP_OPT="
> +                                      (string-join lib-flags "\\ "))
> +                       (string-append "INSTALL_PREFIX=" #$output))))
> +           #:phases
> +           #~(modify-phases %standard-phases
> +               (delete 'configure)
> +               (replace 'build
> +                 (lambda _
> +                   (invoke "make" "bigide"))))))
---

Note that I have not tested that this modification actually works, but I'd be
surprised if it didn't.

    -- (
Danny Milosavljevic May 1, 2023, 3:21 p.m. UTC | #3
Hi,

> Please make sure you use the new-ish LIST/GEXP style for ARGUMENTS;

Did so.

> also, much
> of your modified BUILD phase could be replaced by modifying #:MAKE-FLAGS, and
> LIBS could be generated in a much simpler way with FOLD from (SRFI SRFI-1):

That did not work so I couldn't change it to that.

I pushed lazarus to guix master as commit df504d84ca1881854f09f11ae7e72a02adad9b69.
\( May 1, 2023, 5:35 p.m. UTC | #4
Danny Milosavljevic <dannym@scratchpost.org> writes:
> That did not work so I couldn't change it to that.

Oh!  I managed to forgot to add the seed flag :(

It should have been:

```scheme
(fold (lambda (pkg flags)
        (cons* (string-append "-Fl" pkg "/lib")
               (string-append "-k-rpath=" pkg "/lib")
               flags))
      '()
      lib-dirs)
```
diff mbox series

Patch

diff --git a/gnu/packages/pascal.scm b/gnu/packages/pascal.scm
index f563f077dc..4432327bee 100644
--- a/gnu/packages/pascal.scm
+++ b/gnu/packages/pascal.scm
@@ -24,6 +24,7 @@  (define-module (gnu packages pascal)
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (guix packages)
   #:use-module (guix download)
+  #:use-module (guix git-download)
   #:use-module (guix gexp)
   #:use-module (guix utils)
   #:use-module (guix build-system gnu)
@@ -32,9 +33,13 @@  (define-module (gnu packages pascal)
   #:use-module (gnu packages bootstrap)
   #:use-module (gnu packages compression)
   #:use-module (gnu packages gcc)
+  #:use-module (gnu packages glib)
+  #:use-module (gnu packages gtk)
   #:use-module (gnu packages ncurses)
   #:use-module (gnu packages perl)
+  #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages xml)
+  #:use-module (gnu packages xorg)
   #:use-module (ice-9 match))
 
 (define %fpc-version "3.2.2")
@@ -270,3 +275,322 @@  (define-public p2c
 Pascal programs.")
     (home-page "http://users.fred.net/tds/lab/p2c/")
     (license license:gpl2+)))
+
+(define-public lazarus
+  (package
+    (name "lazarus")
+    (version "2.2.6")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                     (url
+                      "https://gitlab.com/freepascal.org/lazarus/lazarus.git")
+                     (commit (string-append "lazarus_"
+                                            (string-join
+                                             (string-split version #\.)
+                                             "_")))))
+              (file-name (string-append name "-" version "-checkout"))
+              (sha256
+               (base32
+                "0hpk6fxmy1h1q0df41jg1vnp8g8vynrg5v5ad43lv229nizfs3wj"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:tests? #f ; No tests exist
+       #:phases
+       (modify-phases %standard-phases
+        (delete 'configure)
+        (replace 'build
+          (lambda* (#:key inputs outputs #:allow-other-keys)
+            ;; RUNPATH -k-rpath=
+            ;; -Xr<x> rlink-path
+            (let* ((libdirs
+                    (map (lambda (x)
+                           (assoc-ref inputs x))
+                         '("glib" "gdk-pixbuf" "gtk+" "libx11"
+                           "libx11" "pango" "cairo" "atk")))
+                   (libs (append
+                          (map (lambda (name)
+                                 (string-append "-Fl" name "/lib"))
+                               libdirs)
+                          (map (lambda (name)
+                                 (string-append "-k-rpath=" name "/lib"))
+                               libdirs))))
+              (setenv "LAZARUS_LIBPATHS"
+                      (string-append ;"-XD "
+                                     (string-join libs " ")))
+              (setenv "MAKEFLAGS"
+                      (string-append "LHELP_OPT="
+                                     (string-join libs "\\ "))))
+            (setenv "INSTALL_PREFIX" (assoc-ref outputs "out"))
+            (invoke "make" "bigide"))))))
+    (native-inputs
+     (list fpc pkg-config))
+    (inputs
+     (list glib gdk-pixbuf gtk+-2 libx11 pango cairo atk))
+    (synopsis "Integrated development environment for Pascal")
+    (description "This package provides an integrated development environment
+for Pascal.")
+    (home-page "https://www.lazarus-ide.org/")
+    ; asl2.0: lcl/interfaces/customdrawn/android/*, lcl/lcltaskdialog.pas
+    ;
+    ; CC-BY-SA-3:
+    ;  components/onlinepackagemanager/images/*, lcl/lcltaskdialog.pas
+    ;
+    ; CC-BY-SA-4: images/icons/lazarus.svg, lcl/lcltaskdialog.pas
+    ;
+    ; Expat: components/aggpas/expat-pas/*,
+    ;  examples/database/sqldbtutorial3/dbconfig.pas,
+    ;  examples/database/tsqlscript/dbconfig.pas,
+    ;  lcl/interfaces/customdrawn/android/egl.pas, lcl/themes.pas,
+    ;  components/opengl/example/uglyfont.pas
+    ;
+    ; Freetype:
+    ;  components/lazutils/lazfreetype.pas, components/lazutils/tt*.pas
+    ;
+    ; LGPL-2+:
+    ;  components/chmhelp/lhelp/chmdataprovider.pas
+    ;  components/chmhelp/lhelp/chmspecialparser.pas
+    ;  components/customdrawn/customdrawnextras.pas
+    ;  components/datetimectrls/*
+    ;  components/dbexport/fpdataexporter.pp
+    ;  components/dbexport/frmbaseconfigexport.pp
+    ;  components/dbexport/frmexportprogress.pp
+    ;  components/dbexport/frmselectexportformat.pp
+    ;  components/dbexport/regdbexport.pp
+    ;  components/fpdebug/fpimgreaderwinpetypes.pas
+    ;  components/fpvectorial/htmlvectorialreader.pas
+    ;  components/ideintf/actionseditor.pas
+    ;  components/ideintf/actionseditorstd.pas
+    ;  components/ideintf/baseideintf.pas
+    ;  components/ideintf/dbpropedits.pas
+    ;  components/ideintf/fieldseditor.pas
+    ;  components/ideintf/idedialogs.pas
+    ;  components/ideintf/ideexterntoolintf.pas
+    ;  components/ideintf/ideutils.pas
+    ;  components/ideintf/keyvalpropeditdlg.pas
+    ;  components/ideintf/macrodefintf.pas
+    ;  components/ideintf/macrointf.pas
+    ;  components/ideintf/maskpropedit.pas
+    ;  components/ideintf/newfield.pas
+    ;  components/ideintf/toolbarintf.pas
+    ;  components/ideintf/treeviewpropedit.pas
+    ;  components/lazcontrols/checkboxthemed.pas
+    ;  components/lazcontrols/dividerbevel.pas
+    ;  components/lazcontrols/extendednotebook.pas
+    ;  components/lazcontrols/listfilteredit.pas
+    ;  components/lazcontrols/listviewfilteredit.pas
+    ;  components/lazcontrols/lvlgraphctrl.pas
+    ;  components/lazcontrols/treefilteredit.pas
+    ;  components/lazreport/source/*
+    ;  components/lazutils/asiancodepagefunctions.inc
+    ;  components/lazutils/fpcadds.pas
+    ;  components/lazutils/laz2_dom.pas
+    ;  components/lazutils/laz2_xmlcfg.pas
+    ;  components/lazutils/laz2_xmlread.pas
+    ;  components/lazutils/laz2_xmlutils.pas
+    ;  components/lazutils/laz2_xmlwrite.pas
+    ;  components/lazutils/laz2_xpath.pas
+    ;  components/lazutils/laz_xmlcfg.pas
+    ;  components/lazutils/laz_xmlstreaming.pas
+    ;  components/lazutils/lookupstringlist.pas
+    ;  components/multithreadprocs/mtpcpu.pas
+    ;  components/multithreadprocs/mtprocs.pas
+    ;  components/multithreadprocs/mtputils.pas
+    ;  components/opengl/glcocoanscontext.pas
+    ;  components/paradox/regparadox.pp
+    ;  components/printers/printer4lazstrconst.pas
+    ;  components/sparta/dockedformeditor/source/*
+    ;  components/sparta/generics/source/*
+    ;  components/wiki/myfphttpclient.pp
+    ;  examples/lpicustomdata/lpicustomdata.lpr
+    ;  ide/findinfilesdlg.pas
+    ;  ide/findreplacedialog.pp
+    ;  ide/inputfiledialog.pas
+    ;  ide/lazadvancedipc.pp
+    ;  ide/patheditordlg.pas
+    ;  ide/transfermacros.pp
+    ;  ide/wordcompletion.pp
+    ;  lcl/colorbox.pas
+    ;  lcl/customdrawncontrols.pas
+    ;  lcl/dbextctrls.pp
+    ;  lcl/dbgrids.pas
+    ;  lcl/forms/calcform.pas
+    ;  lcl/forms/timepopup.pas
+    ;  lcl/grids.pas
+    ;  lcl/include/comboex.inc
+    ;  lcl/include/controlconsts.inc
+    ;  lcl/include/customflowpanel.inc
+    ;  lcl/include/dbdateedit.inc
+    ;  lcl/include/tiffimage.inc
+    ;  lcl/interfacebase.pp
+    ;  lcl/interfaces/cocoa/cocoacaret.pas
+    ;  lcl/interfaces/cocoa/cocoawschecklst.pas
+    ;  lcl/interfaces/cocoa/cocoawsspin.pas
+    ;  lcl/interfaces/cocoa/cocoa_extra.pas
+    ;  lcl/interfaces/customdrawn/customdrawn_winextra.pas
+    ;  lcl/interfaces/gtk3/gtk3wsextdlgs.pp
+    ;  lcl/interfaces/qt/qt45.pas
+    ;  lcl/interfaces/qt/qtcaret.pas
+    ;  lcl/interfaces/win32/win32extra.pas
+    ;  lcl/interfaces/wince/winext.pas
+    ;  lcl/lclunicodedata.pas
+    ;  test/testresult-db/importtestresults.pp
+    ;  test/testresult-db/teststr.pp
+    ;  test/testresult-db/tresults.pp
+    ;  tools/lazdatadesktop/ddfiles.pp
+    ;  components/aarre/src/aarrepkglist.pas
+    ;  components/activex/activexcontainer.pas
+    ;  components/activex/lazactivexreg.pas
+    ;  components/anchordocking/anchordocking.pas
+    ;  components/anchordocking/anchordockoptionsdlg.pas
+    ;  components/anchordocking/anchordockstorage.pas
+    ;  components/anchordocking/anchordockstr.pas
+    ;  components/anchordocking/design/registeranchordocking.pas
+    ;  components/anchordocking/restoredebugger/mainunit.pas
+    ;  components/cairocanvas/cairoprinter.pas
+    ;  components/codetools/examples/sourcecloser.lpr
+    ;  components/compilers/c/lazcstrconsts.pas
+    ;  components/compilers/c/lazcutil.pas
+    ;  components/datadict/ldd_consts.pas
+    ;  components/dbexport/sdb_consts.pas
+    ;  components/externhelp/externhelpfrm.pas
+    ;  components/fpcunit/guitestrunner.pas
+    ;  components/fpcunit/ide/fpcunitlazideintf.pas
+    ;  components/fpcunit/ide/strtestcaseopts.pas
+    ;  components/fppkg/src/fppkg_const.pas
+    ;  components/fppkg/src/fppkg_details.pas
+    ;  components/fppkg/src/fppkg_mainfrm.pas
+    ;  components/fppkg/src/fppkg_optionsfrm.pas
+    ;  components/fppkg/src/lazfppkgmanagerintf.pas
+    ;  components/fpweb/fpideexteditorinsertfilenameunit.pas
+    ;  components/fpweb/fpwebfieldsettagunit.pas
+    ;  components/fpweb/fpwebhrefeditunit.pas
+    ;  components/fpweb/fpwebhtmltaglegendunit.pas
+    ;  components/fpweb/fpwebnewhtmlfileunit.pas
+    ;  components/fpweb/fpwebnewhtmlformunit.pas
+    ;  components/fpweb/fpwebnewhtmlimgunit.pas
+    ;  components/fpweb/fpwebnewhtmlinputunit.pas
+    ;  components/fpweb/fpwebnewhtmllistunit.pas
+    ;  components/fpweb/fpwebnewhtmltableunit.pas
+    ;  components/fpweb/fpwebnewhtmltagpreunit.pas
+    ;  components/fpweb/fpwebnewhtmltagtdunit.pas
+    ;  components/fpweb/fpwebnewhtmltagtrunit.pas
+    ;  components/fpweb/fpwebselectoptionsunit.pas
+    ;  components/fpweb/fpwebselecttagunit.pas
+    ;  components/fpweb/lazweb.pp
+    ;  components/fpweb/weblazideintf.pp
+    ;  components/images/lazbmp.pas
+    ;  components/images/lazjpg.pas
+    ;  components/images/lazpng.pas
+    ;  components/images/lazpnm.pas
+    ;  components/images/laztga.pas
+    ;  components/images/lazxpm.pas
+    ;  components/lazreport/samples/editor/maincalleditor.pas
+    ;  components/lazreport/source/addons/DialogControls/lrdbdialogcontrols.pas
+    ;  components/lazreport/source/addons/DialogControls/lrdialogcontrols.pas
+    ;  components/lazreport/source/addons/DialogControls/lrformstorage.pas
+    ;  components/lazreport/source/addons/DialogControls/lrformstorageeditor.pas
+    ;  components/lazreport/source/addons/lrFclPDFExport/lr_e_fclpdf.pas
+    ;  components/lazreport/source/addons/lrFclPDFExport/lr_pdfexport.lpk
+    ;  components/lazreport/source/addons/lrFclPDFExport/lrpdfexport.pas
+    ;  components/lazreport/source/addons/lrOfficeImport/lrofficeimport.pas
+    ;  components/lazreport/source/addons/lrOfficeImport/lrspreadsheetimportunit.pas
+    ;  components/lazreport/source/fr3tolrf.pas
+    ;  components/lazreport/source/lr_crossarray.pas
+    ;  components/lazreport/source/lr_crosstab.pas
+    ;  components/lazreport/source/lr_crosstabeditor.pas
+    ;  components/lazreport/source/lr_fpc.pas
+    ;  components/lazreport/source/lr_hyphen.pas
+    ;  components/messagecomposer/messagecomposer.pas
+    ;  components/mrumenu/mrumanager.pp
+    ;  components/mrumenu/reglazmru.pp
+    ;  components/multithreadprocs/examples/parallelloop1.lpr
+    ;  components/plotfunction/exprplotpanel.pp
+    ;  components/plotfunction/plotpanel.pp
+    ;  components/synedit/design/synpropertyeditobjectlist.pas
+    ;  components/vlc/lclvlc.pp
+    ;  examples/androidlcl/sqlitejniandroid.pas
+    ;  examples/cleandir/dircleaner.pp
+    ;  examples/cleandir/frmlog.pp
+    ;  examples/cleandir/frmmain.pp
+    ;  examples/cleandir/svccleandirs.pp
+    ;  examples/cleandir/svcmap.pp
+    ;  examples/designnonlcl/mywidgetdesigner.pas
+    ;  examples/designnonlcl/mywidgetset.pas
+    ;  examples/exploremenu/frmexploremenu.pas
+    ;  examples/gridexamples/columneditors/main.pas
+    ;  examples/gridexamples/columneditors/stringgrideditor.lpr
+    ;  ide/editortoolbarstatic.pas
+    ;  ide/toolbarconfig.pas
+    ;  lcl/comboex.pas
+    ;  lcl/defaulttranslator.pas
+    ;  lcl/interfaces/gtk3/gtk3bindings/lazpangocairo1.pas
+    ;  lcl/lcltranslator.pas
+    ;  tools/iconvtable.pas
+    ;  tools/iconvtable_dbcs.pas
+    ;  tools/lazdatadesktop/lazdatadeskstr.pas
+    ;  tools/lplupdate.lpr
+    ;  tools/updatemakefiles.lpr
+    ;  lcl/lcltaskdialog.pas
+
+    ; MPL-1.1:
+    ;  components/synedit/synedithighlighter.pp
+    ;  components/synedit/synedithighlighterfoldbase.pas
+    ;  components/synedit/synhighlighterposition.pas
+    ;  components/synunihighlighter/synuni.lpk
+    ;  components/turbopower_ipro/ipanim.pas
+    ;  components/turbopower_ipro/ipconst.pas
+    ;  components/turbopower_ipro/ipdefct.inc
+    ;  components/turbopower_ipro/ipdefine.inc
+    ;  components/turbopower_ipro/ipfilebroker.pas
+    ;  components/turbopower_ipro/iphtml.pas
+    ;  components/turbopower_ipro/iphtmlpv.pas
+    ;  components/turbopower_ipro/ipmsg.pas
+    ;  components/turbopower_ipro/ipstrms.pas
+    ;  components/turbopower_ipro/iputils.pas
+    ;  lcl/interfaces/gtk3/gtk3bindings/lazcairo1.pas
+
+    ; own_dwywwi_license: components/opengl/example/uglyfont.pas
+    ; I don't abandon the copyright, but you can use this code and the header
+    ; (uglyfont.cpp and uglyfont.h) for your product regardless of the purpose,
+    ; i.e., free or commercial, open source or proprietary.
+    ;
+    ; However, I do not take any responsibility for the consequence of using
+    ; this code and header.  Please use on your own risks.
+
+    ; pascalscript-zlib-like:
+    ;  components/PascalScript/*
+
+    ; public-domain:
+    ;  components/fpdebug/macho.pas
+    ;  lcl/images/btncalculator.png
+    ;  lcl/images/btncalendar.png
+    ;  lcl/images/btnfiltercancel.png
+    ;  lcl/images/btnseldir.png
+    ;  lcl/images/btnselfile.png
+    ;  lcl/images/btntime.png
+    ;  lcl/images/buttons/*
+    ;  lcl/images/dbnavigator/*
+    ;  lcl/images/dialogs/*
+    ;  lcl/images/dock/lcl_dock_to_bottom.png
+    ;  lcl/images/dock/lcl_dock_to_left.png
+    ;  lcl/images/dock/lcl_dock_to_page.png
+    ;  lcl/images/dock/lcl_dock_to_right.png
+    ;  lcl/images/dock/lcl_dock_to_top.png
+    ;  lcl/images/sortasc.png
+    ;  lcl/images/sortdesc.png
+    ;  lcl/images/wince/wincedialog_cancel.png
+    ;  lcl/images/cursors/*
+
+    ; seems-common:
+    ;  components/aggpas/src/*
+    ;  components/aggpas/image_transforms.txt
+    ;  Permission to copy, use, modify, sell and distribute this software
+    ;  is granted provided this copyright notice appears in all copies.
+    ;  This software is provided "as is" without express or implied
+    ;  warranty, and with no claim as to its suitability for any purpose.
+
+    ; unlicense: examples/database/sqlite_encryption_pragma/unit1.pas
+
+    ;; All the above.
+    (license (list license:gpl2+ license:lgpl2.0+))))