This repository was archived by the owner on Oct 26, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
126 lines (96 loc) · 4.69 KB
/
Makefile
File metadata and controls
126 lines (96 loc) · 4.69 KB
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
120
121
122
123
124
125
126
CC ?= gcc
CXX ?= g++
VERSION := $(shell cat VERSION)
SOURCE_DIR := $(dir $(realpath $(lastword $(MAKEFILE_LIST))))
BUILD_DIR ?= $(realpath ${PWD})/
PYTHON_LIB_DIR := $(shell ${SOURCE_DIR}/get-python-dir)
RPM_SPECFILE := rpm/mantid-term.spec
RPM_NAME = $(shell rpm -q --qf %{NAME}-${VERSION} --specfile ${RPM_SPECFILE})
RPM_NAME_RELEASE = $(shell rpm -q --qf %{NAME}-${VERSION}-%{RELEASE} --specfile ${RPM_SPECFILE})
DEB_DISTRO_NAME = $(shell lsb_release -c -s)
DEB_BUILD_DIR := debbuild
DEB_BUILD_TREE := ${DEB_BUILD_DIR}/mantid-term_${VERSION}
ARCH_BUILD_DIR := archbuild
RPM_BUILD_DIR := rpmbuild
all: ${BUILD_DIR}/libmantid.so ${BUILD_DIR}/Mantid-1.0.typelib ${BUILD_DIR}/mantid.1
.PHONY: rpm srpm
rpm: srpm
rpmbuild --rebuild ${HOME}/rpmbuild/SRPMS/${RPM_NAME_RELEASE}.src.rpm
srpm:
mkdir -p ${HOME}/rpmbuild/{SPECS,SOURCES}
sed -re 's#__VERSION__#${VERSION}#' ${RPM_SPECFILE} >${HOME}/rpmbuild/SPECS/mantid-term.spec
tar --exclude=.git --exclude-caches-all -zcvf ${HOME}/rpmbuild/SOURCES/${RPM_NAME}.tar.gz .
rpmbuild -bs ${HOME}/rpmbuild/SPECS/mantid-term.spec
.PHONY: archpkg
archpkg: ${ARCH_BUILD_DIR}/mantid-term.tar.gz
sed -re 's#__VERSION__#${VERSION}#' archpkg/PKGBUILD >${ARCH_BUILD_DIR}/PKGBUILD
cd ${ARCH_BUILD_DIR} && makepkg -f
${ARCH_BUILD_DIR}/mantid-term.tar.gz:
mkdir -p ${ARCH_BUILD_DIR}
echo 'Signature: 8a477f597d28d172789f06886806bc55' >${ARCH_BUILD_DIR}/CACHEDIR.TAG
tar --transform='s/^./mantid-term/' --exclude=.git --exclude-caches-all -zcvf $@ .
deb: ${DEB_BUILD_TREE}
cd ${DEB_BUILD_TREE} && dpkg-buildpackage -uc -us
srcdeb: ${DEB_BUILD_TREE}
cd ${DEB_BUILD_TREE} && dpkg-buildpackage -S -uc -us
${DEB_BUILD_TREE}.orig.tar.gz:
mkdir -p ${DEB_BUILD_DIR}
echo 'Signature: 8a477f597d28d172789f06886806bc55' >${DEB_BUILD_DIR}/CACHEDIR.TAG
tar --exclude=.git --exclude-caches-all -zcvf $@ .
.PHONY: deb-build-deps ${DEB_BUILD_TREE}
deb-build-deps: ${DEB_BUILD_TREE}
cd ${DEB_BUILD_TREE} && mk-build-deps
${DEB_BUILD_TREE}: ${DEB_BUILD_TREE}.orig.tar.gz
rm -rf $@
mkdir -p $@
tar --exclude=.git --exclude-caches-all -C $@ -xvf $<
if [ -z "${DEB_DISTRO_NAME}" ]; then \
echo error: could not determine debian distro name. >&2 ; \
echo is lsb_release installed? >&2 ; \
exit 1; \
fi
sed -i -re 's#__DISTRO__#${DEB_DISTRO_NAME}#' ${DEB_BUILD_TREE}/debian/changelog
${BUILD_DIR}/libmantid.so: libmantid.c ${BUILD_DIR}/CACHEDIR.TAG
${CC} -O2 -std=c99 -I ${BUILD_DIR}/vte-ng/src/ `pkg-config --cflags gtk+-3.0` -shared -fpic $< -o $@
${BUILD_DIR}/Mantid-1.0.typelib: Mantid-1.0.gir ${BUILD_DIR}/CACHEDIR.TAG
g-ir-compiler $< --includedir ${BUILD_DIR}/vte-ng/bindings/gir -o $@
.PHONY: vte-ng
${BUILD_DIR}/mantid.1: mantid/*.py ${BUILD_DIR}/Mantid-1.0.typelib ${BUILD_DIR}/libmantid.so
cd ${BUILD_DIR} && ${SOURCE_DIR}/gen-man
${SOURCE_DIR}/vte-ng/configure:
NOCONFIGURE=1 ${SOURCE_DIR}/vte-ng/autogen.sh
${BUILD_DIR}/vte-ng/Makefile: ${BUILD_DIR}/CACHEDIR.TAG ${SOURCE_DIR}/vte-ng/configure
mkdir -p ${BUILD_DIR}/vte-ng
cd ${BUILD_DIR}/vte-ng && \
CC=${CC} CXX=${CXX} ${SOURCE_DIR}/vte-ng/configure --disable-static --disable-vala --disable-gtk-doc-html --with-gnutls --without-iconv --disable-glade --enable-introspection --prefix=/usr/lib/mantid
vte-ng: ${BUILD_DIR}/vte-ng/Makefile ${BUILD_DIR}/CACHEDIR.TAG
$(MAKE) -C ${BUILD_DIR}/vte-ng
cp ${SOURCE_DIR}/vte-ng/src/vte/*.h ${BUILD_DIR}/vte-ng/src/vte/
${BUILD_DIR}/CACHEDIR.TAG:
if [ "${SOURCE_DIR}" = "${BUILD_DIR}" ]; then \
echo "refusing to build in source tree"; \
exit 1; \
fi
echo 'Signature: 8a477f597d28d172789f06886806bc55' >${BUILD_DIR}/CACHEDIR.TAG
install:
if [ -z ${PYTHON_LIB_DIR} ]; then \
echo "cannot determine python install dir"; \
exit 1; \
fi
install -m 755 -d ${DESTDIR}/usr/bin \
${DESTDIR}/usr/lib/mantid \
${DESTDIR}/usr/share/man/man1
install -m 755 mantid-py ${DESTDIR}/usr/lib/mantid/mantid
ln -sf ../lib/mantid/mantid ${DESTDIR}/usr/bin/mantid
$(MAKE) -C ${BUILD_DIR}/vte-ng install DESTDIR=${DESTDIR}
install -m 644 ${BUILD_DIR}/Mantid-1.0.typelib ${DESTDIR}/usr/lib/mantid/lib/girepository-1.0
install -m 644 Mantid-1.0.gir ${DESTDIR}/usr/lib/mantid/share/gir-1.0
install -m 755 -d ${DESTDIR}/${PYTHON_LIB_DIR}/mantid
install -m 644 mantid/*.py ${DESTDIR}/${PYTHON_LIB_DIR}/mantid
install -m 755 ${BUILD_DIR}/libmantid.so ${DESTDIR}/usr/lib/mantid/lib
install -m 755 -d ${DESTDIR}/usr/share/mantid
install -m 644 config/mantid*.yml ${DESTDIR}/usr/share/mantid
install -m 644 ${BUILD_DIR}/mantid.1 ${DESTDIR}/usr/share/man/man1
install -m 755 -d ${DESTDIR}/usr/share/applications
install -m 644 mantid.desktop ${DESTDIR}/usr/share/applications
python3 -O -m compileall -d ${PYTHON_LIB_DIR}/mantid ${DESTDIR}/${PYTHON_LIB_DIR}/mantid