On 22/04/03 21:04, Stuart Henderson wrote:
> [ dropping misc@ from CC list ]
>
> On 2022/04/03 11:25, Ashlen wrote:
> > With the previous emails in mind, I have a diff for the build script in
> > the ports tree if it would help. My xmonad.hs hardly changes these days.
> > If the build script actually recompiled xmonad every time instead of
> > quitting if xmonad.hs hasn't changed, I don't think this issue would
> > come up in the future.
>
> How about comparing the date of /usr/local/bin/xmonad as well?
> If libraries have changed such that a rebuild is needed, that binary
> ought to have been updated too.
>
> if [ "${output_file}" -nt xmonad.hs -a "${output_file}" -nt 
> /usr/local/bin/xmonad ]; then
> ...
>
> Or is it fast enough anyway? I couldn't tell, there seem to be other problems:


I didn't think to do that, but I bet that would probably work (and is a
better solution than recompiling every time). Although I would tend to
prefer this form:


if [ "${output_file}" -nt xmonad.hs ] && [ "${output_file}" -nt 
/usr/local/bin/xmonad ]; then
...


I prefer that over the form mentioned as it avoids some potential
ambiguity/maintenance issues in the long run. Here's a relevant entry
from the shellcheck wiki on github.

https://github.com/koalaman/shellcheck/wiki/SC2166


> | Install notice:
> | XMonad is now compiled using `cabal v2-build`. If you rely on a custom
> | xmonad.hs configuration file, you should switch to using
> | ~/.xmonad/build script. An example is included in
> | /usr/local/share/examples/xmonad-0.17.0
>
> Looks like it should be ~/.config/xmonad/build rather than ~/.xmonad/build,
> but also it doesn't seem to actually work:
>
> | $ Xnest :1 &
> | [1] 13846
> | $ DISPLAY=:1 xmonad
> | XMonad is recompiling and replacing itself with another XMonad process 
> because the current process is called "xmonad" but the compiled configuration 
> should be called "xmonad-x86_64-openbsd"
> | XMonad will use build script at "/home/sthen/.config/xmonad/build" to 
> recompile.
> | XMonad recompiling because a custom build script is being used.
> | Errors detected while compiling xmonad config: 
> /home/sthen/.config/xmonad/xmonad.hs
> | $ /home/sthen/.config/xmonad/build 
> /home/sthen/.cache/xmonad/xmonad-x86_64-openbsd
> | cabal: Unknown package "exe".
> |
> |
> | Please check the file for errors.
> |
> | /home/sthen/.cache/xmonad/xmonad-x86_64-openbsd: executeFile: does not 
> exist (No such file or directory)
> ...
>


My apologies for the confusion, it would be ~/.xmonad/build by default.
Everything goes in ~/.xmonad by default. I have configured my setup so
everything isn't in ~/.xmonad, but rather split up into different
directories via XMONAD_CACHE_DIR, XMONAD_CONFIG_DIR, and
XMONAD_DATA_DIR. I prefer to follow the XDG base directory specification
when possible so that config files are in ~/.config, user scripts are in
~/.local/bin, etc.

Here are the relevant bits in ~/.profile (sourced by ~/.xsession) that I
use to make that work:


export \
        XDG_BIN_HOME="${HOME}/.local/bin" \
        XDG_CACHE_HOME="${HOME}/.cache" \
        XDG_CONFIG_HOME="${HOME}/.config" \
        XDG_DATA_HOME="${HOME}/.local/share" \
        XDG_STATE_HOME="${HOME}/.local/state"

export \
        XMONAD_CACHE_DIR="${XDG_CACHE_HOME}/xmonad" \
        XMONAD_CONFIG_DIR="${XDG_CONFIG_HOME}/xmonad" \
        XMONAD_DATA_DIR="${XDG_DATA_HOME}/xmonad"


Sorry about the mix-up. Either configuring it as above and, to be on the
safe side, making sure that $XMONAD_*_DIR all exist, should work. Or
using ~/.xmonad if you don't want it to be separated like that (this is
also easier to deal with if xmonad or the XDG base directory
specification are unfamiliar territory, since it's all in one location).

Also, you'll need to have an xmonad-config.cabal if you don't have it
already, either in ~/.config/xmonad/xmonad-config.cabal if you used the
exports above or ~/.xmonad/xmonad-config.cabal. An example config can be
found at /usr/local/share/examples/xmonad-0.17.0/xmonad-config.cabal.
I'd guess the absence of that file might be causing 'cabal: Unknown
package "exe".'

Here's an updated diff implementing your suggested change. Thanks for
your time and I hope it helps. :)


Index: files/build
===================================================================
RCS file: /cvs/ports/x11/xmonad/files/build,v
retrieving revision 1.1
diff -u -p -u -p -r1.1 build
--- files/build 1 Mar 2021 04:16:34 -0000       1.1
+++ files/build 4 Apr 2022 02:58:22 -0000
@@ -2,7 +2,7 @@

 output_file="${1}"

-if [ "${output_file}" -nt xmonad.hs ]; then
+if [ "${output_file}" -nt xmonad.hs ] && [ "${output_file}" -nt 
/usr/local/bin/xmonad ]; then
     echo "${output_file}" is newer than xmonad.hs
     exit 0
 fi


--
https://amissing.link/

Reply via email to