1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119
|
#!/usr/bin/make -f
include /usr/share/dpkg/architecture.mk
include /usr/share/dpkg/pkg-info.mk
ifneq (,$(filter $(DEB_BUILD_ARCH),armhf arm64 armel ppc64el s390x))
SIGNED_CHAR = -fsigned-char
else
SIGNED_CHAR =
endif
CFLAGS = $(shell dpkg-buildflags --get CFLAGS) $(shell dpkg-buildflags --get CPPFLAGS) $(SIGNED_CHAR) -Wno-error -fcommon
CXXFLAGS = $(shell dpkg-buildflags --get CXXFLAGS) $(shell dpkg-buildflags --get CPPFLAGS) -std=gnu++98 -Wno-error
LDFLAGS = $(shell dpkg-buildflags --get LDFLAGS)
cmake_options = \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_VERBOSE_MAKEFILE=ON \
-DCMAKE_BUILD_TYPE=relwithdebinfo \
-DCMAKE_C_FLAGS_RELWITHDEBINFO="$(CFLAGS)" \
-DCMAKE_CXX_FLAGS_RELWITHDEBINFO="$(CXXFLAGS)" \
-DCMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO="$(LDFLAGS)" \
-DCMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO="$(LDFLAGS)" \
-DCMAKE_INSTALL_RPATH=/usr/lib/$(DEB_HOST_MULTIARCH)/cuneiform
parallel = -j$(or $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS))),1)
# These don't need to be exported and if they are we'll get the flags
# duplicated in the command line.
unexport CFLAGS
unexport CXXFLAGS
unexport LDFLAGS
export DPKG_GENSYMBOLS_CHECK_LEVEL = 4
# build and build-{arch,indep} targets
# ====================================
.PHONY: build build-arch build-indep
build: build-arch build-indep
build-indep:
# Nothing to do here.
build-arch: obj/build-stamp obj/test-stamp
obj/CMakeCache.txt: CMakeLists.txt
mkdir -p obj
cd obj && cmake .. $(cmake_options)
obj/build-stamp: obj/CMakeCache.txt
$(MAKE) $(parallel) -C obj
touch $(@)
obj/test-stamp: obj/build-stamp
ifeq "$(filter nocheck,$(DEB_BUILD_OPTIONS))" ""
CF_DATADIR=$(CURDIR)/datafiles/ debian/tests/ground-truth obj/cuneiform
endif
touch $(@)
# binary and binary-{arch,indep} targets
# ======================================
.PHONY: binary binary-arch binary-indep
binary: binary-arch binary-indep
binary-arch: build-arch
dh_testroot
dh_prep -a
$(MAKE) -C obj install DESTDIR=$(CURDIR)/debian/tmp/
dh_install -p libcuneiform-dev '/usr/lib*/libcuneiform.so' /usr/lib/$(DEB_HOST_MULTIARCH)/
dh_install -p libcuneiform0 '/usr/lib*/lib*.so.*' /usr/lib/$(DEB_HOST_MULTIARCH)/cuneiform/
cd debian/libcuneiform0/usr/lib/$(DEB_HOST_MULTIARCH)/cuneiform/ && mv -t ../ libcuneiform.so.*
dh_install -a
dh_installdocs -a
dh_installchangelogs -a
dh_buildinfo -a
dh_installman -a
dh_compress -a
dh_fixperms -a
dh_strip -a
dh_makeshlibs -a -X/cuneiform/
dh_shlibdeps -a
dh_installdeb -a
dh_gencontrol -a
dh_md5sums -a
dh_builddeb -a
binary-indep: build-indep
dh_testroot
dh_prep -i -X tmp
dh_install -i
dh_installdocs -i
dh_installchangelogs -i
dh_buildinfo -a
dh_compress -i
dh_fixperms -i
dh_installdeb -i
dh_gencontrol -i
dh_md5sums -i
dh_builddeb -i
# clean target
# ============
.PHONY: clean
clean:
dh_clean
rm -rf obj
# get-orig-source target
# ======================
.PHONY: get-orig-source
get-orig-source:
sh $(here)/debian/get-orig-source.sh $(DEB_VERSION_UPSTREAM)
|