summaryrefslogtreecommitdiff
path: root/support-files/debian/rules
blob: e63f144a655c8914e5018c5d40dfcdc96711f116 (plain)
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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
#!/usr/bin/make -f
# Made with the aid of debmake, by Christoph Lameter,
# based on the sample debian/rules file for GNU hello by Ian Jackson.

package=mysql
CHARSET=ujis
TEMPINST=build

#CFLAGS="-O6 -mpentium -mstack-align-double -fomit-frame-pointer" CXX=gcc CXXFLAGS="-O6 -mpentium -mstack-align-double -fomit-frame-pointer -felide-constructors -fno-exceptions -fno-rtti" ./configure --prefix=/usr/local/mysql --enable-assembler --with-mysqld-ldflags=-all-static

CC=gcc
CFLAGS=-O6 -fomit-frame-pointer
CXX=gcc
CXXFLAGS=-O6 -fomit-frame-pointer -felide-constructors  -fno-exceptions -fno-rtti
# CXXFLAGS=-O6 -fomit-frame-pointer -felide-constructors -fno-rtti

SYSNAME=
COMMONCONF= --prefix=/usr --libexecdir=/usr/sbin \
		--localstatedir=/var/mysql/data \
		--enable-shared \
		--without-perl --without-readline \
		--without-docs --without-bench \
		--with-mysqld-user=mysql \
		--with-extra-charsets=all

SERVERCONF=$(COMMONCONF) --enable-assembler \
		--with-raid

#		--with-berkeley-db-includes=/usr/include/db3 \
#		--with-berkeley-db-libs=/usr/lib/libdb3.a

STATICCONF=--with-mysqld-ldflags=-all-static --with-client-ldflags=-all-static

CLIENTCONF=$(COMMONCONF) --without-server

##################################################
patches debian/stamp-patches:
	-test -e debian/stamp-patches || \
	for i in `find debian/patches -type f -print` ;	do \
	  patch -p1 < $$i ; \
	done
	touch debian/stamp-patches

##################################################
premkdir debian/stamp-premkdir:
	$(checkdir)
	-rm -rf debian/tmp debian/$(TEMPINST)*
	dh_installdirs
	-install -d debian/$(TEMPINST)/usr/{bin,sbin,share,man,include,info}
	-install -d debian/$(TEMPINST)-shared/usr/{bin,sbin,share,man,include,info}
	-install -d debian/$(TEMPINST)-debug/usr/{bin,sbin,share,man,include,info}
	touch debian/stamp-premkdir

##################################################
config debian/stamp-config: debian/stamp-premkdir debian/stamp-patches
	CC=$(CC) CFLAGS="$(CFLAGS)" CXX=$(CXX) CXXFLAGS="$(CXXFLAGS)" \
	LDFLAGS="-static" \
	./configure $(SERVERCONF) $(STATICCONF) \
		--with-charset=$(CHARSET) \
		--with-bench \
		$(SYSNAME)
#	sed 's/-fno-implicit-templates//g' sql/Makefile > .m
#	mv .m sql/Makefile
	touch debian/stamp-config

##################################################
build: debian/stamp-config
	make LDFLAGS="-static"
	make install DESTDIR=`pwd`/debian/$(TEMPINST)
	cp include/m_ctype.h `pwd`/debian/$(TEMPINST)/usr/include/mysql/
	touch build

##################################################
build-shared debian/stamp-build-shared: debian/stamp-patches
	-make distclean
	CC=$(CC) CFLAGS="$(CFLAGS)" CXX=$(CXX) CXXFLAGS="$(CXXFLAGS)" \
	./configure $(SERVERCONF) \
		--with-charset=$(CHARSET) \
		$(SYSNAME)

#	./configure $(CLIENTCONF)

	make
	make install DESTDIR=`pwd`/debian/$(TEMPINST)-shared

	touch debian/stamp-build-shared

##################################################
build-debug debian/stamp-build-debug: debian/stamp-patches
	-make distclean
	CC=$(CC) CFLAGS="$(CFLAGS)" CXX=$(CXX) CXXFLAGS="$(CXXFLAGS)" \
	./configure $(SERVERCONF) \
		--with-charset=$(CHARSET) \
		--with-debug \
		$(SYSNAME)

#	./configure $(CLIENTCONF)

	make
	make install DESTDIR=`pwd`/debian/$(TEMPINST)-debug

	touch debian/stamp-build-debug
	
##################################################
clean:
	$(checkdir)
	-make distclean
	-test -e debian/stamp-patches && \
	for i in `find debian/patches -type f -print` ;	do \
	  patch -R -p1 < $$i ; \
	done
	-rm -rf build debian/stamp-* debian/$(TEMPINST)*
	-dh_clean
	-rm -f `find . -name "*~"`
	-rm -rf debian/tmp debian/files* core
	-rm -f debian/*substvars
	-rm -f `cat debian/gomi`

##################################################
binary-indep:	checkroot build
	$(checkdir)
# There are no architecture-independent files to be uploaded
# generated by this package.  If there were any they would be
# made here.

binary-arch:	checkroot build debian/stamp-build-shared debian/stamp-build-debug
	sh debian/move

### init, post*
	dh_installdeb
	cp debian/shlibs debian/libmysqlclient9/DEBIAN/

	cp debian/my.cnf debian/mysql-server/etc/
	cp support-files/mysql.server debian/mysql-server/etc/init.d/mysql ; chmod +x debian/mysql-server/etc/init.d/mysql

### dpkg-xxx
	dh_compress

	dh_fixperms

	dh_strip

	dh_shlibdeps
	dh_gencontrol

	dpkg --build debian/libmysqlclient9 ..
	dpkg --build debian/mysql-client ..
	dpkg --build debian/mysql-server ..
	dpkg --build debian/mysql-server-shared ..
	dpkg --build debian/mysql-server-debug ..
	dpkg --build debian/mysql-dev ..
	dpkg --build debian/mysql-bench ..
	dpkg --build debian/mysql-doc ..

define checkdir
	test -f debian/rules
endef

# Below here is fairly generic really

binary:		binary-indep binary-arch

##################################################
checkroot:
	$(checkdir)
	test root = "`whoami`"

##################################################
.PHONY: binary binary-arch binary-indep clean checkroot