MikeWey / DMagick

An ImageMagick binding for the D Programming Language.
zlib License
17 stars 4 forks source link

DMagick is always rebuilt even if a rebuild is not needed #24

Closed finitemonkey closed 4 years ago

finitemonkey commented 4 years ago

During the DMagick pre-build time, the file dmagick/c/magickVersion.d is recreated, resulting in an updated mtime for that file, which triggers a rebuild of DMagick every time regardless of whether there are any actual changes to any DMagick files.

In order to fix this, I have modified my own dmagick/build-aux/magickVersion.sh like so;

if [ ! -f "$PACKAGE_DIR/dmagick/c/magickVersion.d" ]; then
     ... sed operations ...
fi

i.e. if the file has already been created, don't create it again.

However, I suspect that the solution above won't work generally, as it will mean that if the version of MagickCore is changed on the system, it will not be picked up and trigger a rebuild of DMagick, possibly resulting in breakage? Is that the case and the reason why things are as they are?

If so, I thought that perhaps a way around that problem would be to write the version number(s) out to another file when first retreived, then read that in if it exists (on subsequent runs) and if the numbers have changed, regenerate magickVersion.d, otherwise skip any writing of files. Would that work? I would be happy to write it if so and if it would help.