diff options
| author | Mike Wey | 2017-05-25 20:20:06 +0200 |
|---|---|---|
| committer | Mike Wey | 2017-05-25 20:20:06 +0200 |
| commit | 4df3136229de711838646a65b6cf040226eeb7cb (patch) | |
| tree | a2ee596419028cd458325d224439854f8b82063e | |
| parent | 87c811161c608f8428ff8e399c60f9672c6cfc7e (diff) | |
Add dub support.
dub will generate the import library of 32bit windows (OMF), the other
windows targets might need some more work.
See: #12
| -rw-r--r-- | GNUmakefile | 5 | ||||
| -rwxr-xr-x | build-aux/magickVersion.sh | 25 | ||||
| -rw-r--r-- | dub.json | 34 |
3 files changed, 60 insertions, 4 deletions
diff --git a/GNUmakefile b/GNUmakefile index 55e5b35..d306675 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -82,10 +82,7 @@ $(LIBNAME_DMAGICK): $(OBJECTS_DMAGICK) $(RANLIB) $@ dmagick/c/magickVersion.d: dmagick/c/magickVersion.d.in - sed 's/@MagickLibVersion@/$(subst .,,$(MAGICKVERSION))/g' $< > $@ - sed -i 's/@MagickLibVersionText@/$(MAGICKVERSION)/g' $@ - sed -i 's/@QuantumDepth@/$(subst Q,,$(QUANTUMDEPTH))/g' $@ - sed -i 's/@HDRI@/$(HDRI)/g' $@ + sed 's/@MagickLibVersion@/$(subst .,,$(MAGICKVERSION))/g' $< | sed 's/@MagickLibVersionText@/$(MAGICKVERSION)/g' | sed 's/@QuantumDepth@/$(subst Q,,$(QUANTUMDEPTH))/g' | sed 's/@HDRI@/$(HDRI)/g' > $@ ####################################################################### diff --git a/build-aux/magickVersion.sh b/build-aux/magickVersion.sh new file mode 100755 index 0000000..3a43d05 --- /dev/null +++ b/build-aux/magickVersion.sh @@ -0,0 +1,25 @@ +#!/bin/sh + +echo $PACKAGE_DIR + +MAGICK_VERSION=$(pkg-config --modversion MagickCore | tr -d '.') +MAGICK_VERSION_TEXT=$(pkg-config --modversion MagickCore) +MAGICK_QUANTUM_DEPTH="16" +MAGICK_HDRI="false" + +if [ -n "$(pkg-config --variable=libname MagickCore | grep 8)" ]; then + MAGICK_QUANTUM_DEPTH="8" +elif [ -n "$(pkg-config --variable=libname MagickCore | grep 32)" ]; then + MAGICK_QUANTUM_DEPTH="32" +elif [ -n "$(pkg-config --variable=libname MagickCore | grep 64)" ]; then + MAGICK_QUANTUM_DEPTH="64" +fi + +if [ -n "$(pkg-config --variable=libname MagickCore | grep HDRI)" ]; then + MAGICK_HDRI="true" +fi + +sed 's/@MagickLibVersion@/'$MAGICK_VERSION'/g' "$PACKAGE_DIR/dmagick/c/magickVersion.d.in" | \ +sed 's/@MagickLibVersionText@/'$MAGICK_VERSION_TEXT'/g' | \ +sed 's/@QuantumDepth@/'$MAGICK_QUANTUM_DEPTH'/g' | \ +sed 's/@HDRI@/'$MAGICK_HDRI'/g' > "$PACKAGE_DIR/dmagick/c/magickVersion.d" diff --git a/dub.json b/dub.json new file mode 100644 index 0000000..68f6288 --- /dev/null +++ b/dub.json @@ -0,0 +1,34 @@ +{ + "name": "dmagick", + "description": "An ImageMagick binding for the D Programming Language.", + "authors": ["Mike Wey"], + "license": "Zlib", + "targetType": "library", + "sourcePaths": ["dmagick"], + "importPaths": ["dmagick"], + "libs": ["MagickCore"], + "configurations": [ + { + "name": "windows", + "platforms": ["windows"], + "sourceFiles-x86": ["MagickCore.lib"], + "preGenerateCommands": [ + "powershell -Command \"get-content $PACKAGE_DIR/dmagick/c/magickVersion.d.in | %{$$_ -replace '@MagickLibVersion@','700'} | %{$$_ -replace '@MagickLibVersionText@','7.0.0'} | %{$$_ -replace '@QuantumDepth@','16'} | %{$$_ -replace '@HDRI@','false'} | Set-Content $PACKAGE_DIR/dmagick/c/magickVersion.d.in\"" + ], + "preGenerateCommands-x86": [ + "@echo @for %%i in (%1) do @if NOT \"%%~$PATH:i\"==\"\" @copy \"%%~$PATH:i\" $PACKAGE_DIR/ > copydll.bat", + "copydll CORE_RL_magick_.dll", + "implib /s $PACKAGE_DIR/MagickCore.lib $PACKAGE_DIR/CORE_RL_magick_.dll", + "@del copydll.bat", + "del $PACKAGE_DIR/CORE_RL_magick_.dll" + ] + + }, + { + "name": "other", + "preGenerateCommands": [ + "PACKAGE_DIR=$PACKAGE_DIR $PACKAGE_DIR/build-aux/magickVersion.sh" + ] + } + ] +} |
