| 1 |
#!/usr/bin/make -f |
| 2 |
# -*- makefile -*- |
| 3 |
|
| 4 |
# This has to be exported to make some magic below work. |
| 5 |
export DH_OPTIONS |
| 6 |
|
| 7 |
DPKG_EXPORT_BUILDFLAGS = 1 |
| 8 |
include /usr/share/dpkg/buildflags.mk |
| 9 |
|
| 10 |
export DEB_BUILD_MAINT_OPTIONS=hardening=+all |
| 11 |
|
| 12 |
STATIC_BUILD_PATH=DEB_build_static |
| 13 |
SHARED_BUILD_PATH=DEB_build_shared |
| 14 |
|
| 15 |
# TODO: possibly consider enabling CIFTI code -- needed by AFNI: -DUSE_CIFTI_CODE=ON \ |
| 16 |
|
| 17 |
CMAKE_FLAGS=-DNIFTI_INSTALL_INCLUDE_DIR:PATH=include/nifti \ |
| 18 |
-DUSE_FSL_CODE:BOOL=OFF \ |
| 19 |
-DUSE_CIFTI_CODE=OFF \ |
| 20 |
-DNIFTI_BUILD_TESTING:BOOL=OFF |
| 21 |
|
| 22 |
# one ring to rule them all ... |
| 23 |
%: |
| 24 |
dh $@ --buildsystem=cmake |
| 25 |
|
| 26 |
override_dh_auto_clean: |
| 27 |
rm -rf $(STATIC_BUILD_PATH) $(SHARED_BUILD_PATH) |
| 28 |
rm -rf docs/html |
| 29 |
dh_clean |
| 30 |
|
| 31 |
override_dh_auto_configure: |
| 32 |
dh_auto_configure --builddir=$(STATIC_BUILD_PATH) -- \ |
| 33 |
$(CMAKE_FLAGS) \ |
| 34 |
-DBUILD_SHARED_LIBS:BOOL=OFF \ |
| 35 |
-DBUILD_TESTING:BOOL=ON |
| 36 |
dh_auto_configure --builddir=$(SHARED_BUILD_PATH) -- \ |
| 37 |
$(CMAKE_FLAGS) \ |
| 38 |
-DBUILD_SHARED_LIBS:BOOL=ON \ |
| 39 |
-DBUILD_TESTING:BOOL=OFF |
| 40 |
|
| 41 |
override_dh_auto_build: |
| 42 |
# build static libs |
| 43 |
cd $(STATIC_BUILD_PATH) && $(MAKE) VERBOSE=1 |
| 44 |
# build shared libs and binaries |
| 45 |
cd $(SHARED_BUILD_PATH) && $(MAKE) VERBOSE=1 |
| 46 |
# build api reference |
| 47 |
cd docs && doxygen Doxy_nifti.txt |
| 48 |
# remove jquery (use from package dependency) |
| 49 |
rm -f docs/html/jquery.js |
| 50 |
|
| 51 |
override_dh_auto_test: |
| 52 |
ifeq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS))) |
| 53 |
cd $(STATIC_BUILD_PATH) && ctest |
| 54 |
endif |
| 55 |
|
| 56 |
override_dh_auto_install: |
| 57 |
# install binaries and shared libs |
| 58 |
cd $(SHARED_BUILD_PATH) && $(MAKE) install DESTDIR=$(CURDIR)/debian/tmp |
| 59 |
# install static libs |
| 60 |
cd $(STATIC_BUILD_PATH)/znzlib \ |
| 61 |
&& $(MAKE) install DESTDIR=$(CURDIR)/debian/tmp |
| 62 |
cd $(STATIC_BUILD_PATH)/niftilib \ |
| 63 |
&& $(MAKE) install DESTDIR=$(CURDIR)/debian/tmp |
| 64 |
cd $(STATIC_BUILD_PATH)/nifticdf \ |
| 65 |
&& $(MAKE) install DESTDIR=$(CURDIR)/debian/tmp |
| 66 |
cp -a DEB_build_static/*/lib*.a debian/tmp/usr/lib |
| 67 |
# install manpage |
| 68 |
$(STATIC_BUILD_PATH)/utils/nifti_tool -help | \ |
| 69 |
python3 debian/makeniftitoolmanpage.py > debian/tmp/nifti_tool.1 |
| 70 |
# Remove unecessary header file |
| 71 |
rm -f $(CURDIR)/debian/tmp/usr/include/nifti/nifti_tool.h |
| 72 |
d-shlibmove --commit \ |
| 73 |
--multiarch \ |
| 74 |
--devunversioned \ |
| 75 |
--exclude-la \ |
| 76 |
--override s/libznz[0-9.]*-dev/libznz-dev/ \ |
| 77 |
--movedev debian/tmp/usr/include/* usr/include \ |
| 78 |
debian/tmp/usr/lib/libnifti*.so |
| 79 |
d-shlibmove --commit \ |
| 80 |
--multiarch \ |
| 81 |
--devunversioned \ |
| 82 |
--exclude-la \ |
| 83 |
--movedev debian/libnifti2-dev/usr/include/nifti/znzlib.h usr/include/nifti \ |
| 84 |
debian/tmp/usr/lib/libznz*.so |
| 85 |
d-shlibmove --commit \ |
| 86 |
--t64 \ |
| 87 |
--multiarch \ |
| 88 |
--devunversioned \ |
| 89 |
--exclude-la \ |
| 90 |
--override s/libznz[0-9.]*-dev/libznz-dev/ \ |
| 91 |
--movedev debian/libnifti2-dev/usr/include/nifti/nifti1_io.h usr/include/nifti \ |
| 92 |
--movedev debian/libnifti2-dev/usr/include/nifti/nifti2_io.h usr/include/nifti \ |
| 93 |
debian/tmp/usr/lib/libniftiio*.so |
| 94 |
d-shlibmove --commit \ |
| 95 |
--multiarch \ |
| 96 |
--devunversioned \ |
| 97 |
--exclude-la \ |
| 98 |
--override s/libznz[0-9.]*-dev/libznz-dev/ \ |
| 99 |
--movedev debian/libnifti2-dev/usr/include/nifti/nifticdf.h usr/include/nifti \ |
| 100 |
debian/tmp/usr/lib/libnifticdf*.so |
| 101 |
find debian -name "lib*.la" -delete |
| 102 |
|
| 103 |
override_dh_installchangelogs: |
| 104 |
dh_installchangelogs -k Updates.txt |