Browse Source

Hacking D

master
pjotrp 2 years ago
parent
commit
f29b044763
  1. 40
      DLANG.org
  2. 28
      HACKING.org

40
DLANG.org

@ -1,6 +1,6 @@
* D Language support in GNU Guix
* Packaging D Language support in GNU Guix
(WIP)
/Fixing complicated packages with the D compiler as an example/
** Packaging ldc
@ -14,6 +14,24 @@ failing tests.
*** Building ldc compiler and phobos
Note D's ldc2 compiler now uses the gold linker by default. This has
caused me some headaches because it does not honour LIBRARY_PATH. The
workaround is to set
: export LD_LIBRARY_PATH=$LIBRARY_PATH
in the build system. This can be done with something like
: (setenv "LD_LIBRARY_PATH" (getenv "LIBRARY_PATH"))
only problem is that the path won't get recognized at runtime. This
is why I am defaulting to ld for now.
Also it may be wise with gold to default to the
--no-allow-shlib-undefined switch, so it complains when it can't find
a shared library at link time.
Build the package with -K option.
#+BEGIN_SRC sh
@ -70,13 +88,29 @@ in all build dependencies)
#+BEGIN_SRC sh
~/.config/guix/current/bin/guix environment -C guix --ad-hoc ldc clang llvm unzip gdb ncurses vim git make cmake which less tzdata binutils
cd ldc-$ver
source ./environment-variables
rm -rf CMakeFiles CMakeCache.txt
cmake .
make clean
make -j 24
#+END_SRC
to run the tests
alternatively, you may use the pre-inst-env from a prebuilt guix directory which may be in sync with
your new packages.
Note with ldc-1.14 I had to touch two files:
#+BEGIN_SRC
touch /tmp/guix-build-ldc-1.14.0.drv-8/ldc-1.14.0/.git/packed-refs
touch /tmp/guix-build-ldc-1.14.0.drv-8/ldc-1.14.0/CMakeFiles/git-data/head-ref
#+END_SRC
which makes sure cmake . passes.
and I had to set LD_LIBRARY_PATH to point to the LLVM lib dir. Somehow
that was not the same one used by the build system.
To run the tests
: cmake .

28
HACKING.org

@ -1013,6 +1013,8 @@ not get applied. In this case comment out
And rerun the Error log to get a full list of errors.
**** Force a build to stop
You may also want to force the build to stop right after unpacking by
injecting
@ -1030,6 +1032,18 @@ Now the build will fail with
: ERROR: In procedure #f:
: note: keeping build directory `/tmp/guix-build-elixir-1.5.1.drv-5'
Another option is to inject (#f)
#+BEGIN_SRC scheme
(replace 'build
(lambda _
(invoke "bash" "-c" "set")
(#f)
(invoke "./build.sh")))
#+END_SRC
will halt after showing the environment
*** Use git to create a patch
Initialize git using a first terminal
@ -1365,6 +1379,20 @@ If that does not work you can also run a command that fails, such as
(chdir "END HERE")
#+end_src
*** Show environment settings
Another useful hack is to show the environment
#+BEGIN_SRC scheme
(replace 'build
(lambda _
(setenv "LD_LIBRARY_PATH" (getenv "LIBRARY_PATH"))
(invoke "bash" "-c" "set")
(...)
(invoke "./build.sh")))
#+END_SRC
** Using -K (keep build) to create a patch
Using -K you can keep the build dir after failure (induced in above

Loading…
Cancel
Save