Changes of Revision 4
[-] | Changed | mysql-community-server.spec |
x 1
2 Source7: rc.mysql-multi 3 Source8: README.SuSE 4 Source9: mysql-patches.tar.bz2 5 -Source10: build.inc 6 -Source11: install.inc 7 +Source10: build.include 8 +Source11: install.include 9 Source12: series 10 BuildRoot: %{_tmppath}/%{name}-%{version}-build 11 %if 0%{?suse_version} 12
13 #------------------------------------------------------------------------------- 14 %build 15 #------------------------------------------------------------------------------- 16 -%{expand:%(cat %_sourcedir/build.inc)} 17 +%{expand:%(cat %_sourcedir/build.include)} 18 19 #------------------------------------------------------------------------------- 20 %install 21 #------------------------------------------------------------------------------- 22 -%{expand:%(cat %_sourcedir/install.inc)} 23 +%{expand:%(cat %_sourcedir/install.include)} 24 25 #------------------------------------------------------------------------------- 26 %pre 27 |
||
[+] | Added | build.include ^ |
@@ -0,0 +1,112 @@ +%if 0%{?suse_version} < 1120 && 0%{?suse_version} > 0 +%define socketpath /var/lib/mysql +%else +%define socketpath /var/run/mysql +%endif +export CFLAGS="$RPM_OPT_FLAGS -DPIC -fPIC -DUNDEF_HAVE_INITGROUPS -DFORCE_INIT_OF_VARS -fno-strict-aliasing -Wno-unused-parameter" +export CXXFLAGS="$CFLAGS -fno-exceptions -fno-rtti" + +%if 0%{use_cmake} < 1 +autoreconf -f -i +# Make the compile a function, since we do multiple builds +BuildMySQL() { + # The --enable-assembler simply does nothing on systems that do not + # support assembler speedups. + suffix="$1"; shift + mkdir _build$suffix + pushd _build$suffix + ../configure \ + --enable-assembler \ + --without-readline \ + --infodir=%{_infodir} \ + --libdir=%{_libdir} \ + --libexecdir=/usr/sbin \ + --localstatedir=/var/lib/mysql \ + --mandir=%{_mandir} \ + --prefix=%{_prefix} \ + --sysconfdir=/etc \ + --with-mysqld-user=mysql \ + --with-mysqld-group=mysql \ + --without-debug \ + --datadir=/usr/share \ + --includedir=/usr/include \ + --with-charset=utf8 \ + --with-collation=utf8_unicode_ci \ + --with-extra-charsets=all \ + --with-unix-socket-path=%{socketpath}/mysql.sock \ + --enable-thread-safe-client \ + --with-comment="SUSE MySQL RPM" \ + --with-libwrap \ + --with-server-suffix=$suffix \ +%ifarch s390 s390x + --with-atomic-ops=rwlocks \ +%else + --with-atomic-ops=smp \ +%endif + --with-ssl=/usr \ + --with-plugins=%{builtin_plugins} \ + HOSTNAME="/bin/hostname -f" \ + "$@" + # Add this for MyISAM RAID support: + # --with-raid + # benchdir does not fit in above model. Fix when we make a separate package + make %{?jobs:-j%jobs} + nm --numeric-sort sql/mysqld > sql/mysqld.sym + # needed for make check, which is not VPATH aware + # copy the files unconditionally so that manual 'make check' after + # the build works, too + cp -a ../mysql-test/* mysql-test/ + for i in ../sql/share/{english,charsets}; do + [ -d $i ] && cp -a $i sql/share/ + done + cp -a ../scripts/*.sql scripts/ +%if %{?_with_testsuite:1}0 + pushd mysql-test; perl ./mysql-test-run.pl --force; popd +%endif + popd +} +# Build the client, extra tools, libraries +BuildMySQL "" --with-embedded-server +# build mysqld-debug +BuildMySQL "-debug" --with-debug --without-embedded-server + +%if 0%{?prefered} > 0 +mkdir -p _buildlibmysqld/tmp +cd _buildlibmysqld/tmp +ar -x ../../_build/libmysqld/libmysqld.a +gcc $CFLAGS $LDFLAGS -shared -Wl,-soname,libmysqld.so.0 -o ../libmysqld.so.0.0.1 \ +*.o \ +-lpthread -lcrypt -lnsl -lssl -lcrypto -lz -lrt -lstdc++ -lm -lc +cd .. +rm -rf tmp +cd .. +%endif + +%else # cmake build + +BuildMySQL() { + mkdir _build$1 + pushd _build$1 + shift + cmake -DWITH_SSL=system \ + -DWITH_ZLIB=system \ + -DWITH_READLINE=0 \ + -DWITH_LIBEDIT=0 \ + -DINSTALL_LAYOUT=RPM \ + -DMYSQL_UNIX_ADDR=%{socketpath}/mysql.sock \ + -DWITH_COMMENT="openSUSE MySQL rpm" \ + -DWITH_EXTRA_CHARSET=all \ + -DDEFAULT_CHARSET=utf-8 -DDEFAULT_COLLATION=utf8_unicode_ci \ + -DWITH_INNOBASE_STORAGE_ENGINE=1 \ + -DWITH_PERFSCHEMA_STORAGE_ENGINE=1 \ + -DWITH_EMBEDDED_SERVER=true \ + -DDENABLE_DOWNLOADS=false \ + "$@" .. + make %{?jobs:-j%jobs} + nm --numeric-sort sql/mysqld > sql/mysqld.sym + popd +} + +BuildMySQL "" -DCMAKE_BUILD_TYPE=Release -DINSTALL_SQLBENCHDIR=share +BuildMySQL "-debug" -DCMAKE_BUILD_TYPE=Debug +%endif | ||
[+] | Added | install.include ^ |
@@ -0,0 +1,126 @@ +# install the debug server first, so that we don't overwrite the standard +# /usr/sbin/mysqld +mkdir -p %buildroot%_libdir/mysql +make -C _build-debug/sql install DESTDIR=%buildroot +mv %buildroot/usr/sbin/mysqld %buildroot/usr/sbin/mysqld-debug +install -m 644 _build-debug/sql/mysqld.sym %buildroot%_libdir/mysql/mysqld-debug.sym +# install the client, extra tools, libraries and the standard server +make -C _build install DESTDIR=%buildroot benchdir_root=/usr/share/ +install -m 644 _build/sql/mysqld.sym %buildroot%_libdir/mysql/mysqld.sym +# remove most static libs (FIXME: don't build them at all...) +rm -f %buildroot%_libdir/libmysqlclient*a +rm -f %buildroot%_libdir/mysql/*.a %buildroot%_libdir/mysql/*.la +rm -f %buildroot%_libdir/mysql/plugin/*a +# XXX: package these? The ndb tools are linked statically atm +rm -f %buildroot%_libdir/mysql/libndbclient.* +rm -f %{buildroot}/usr/share/mysql-test/mysql-test-run +rm -f %{buildroot}/usr/share/mysql-test/mtr +ln -sf mysql-test-run.pl %{buildroot}/usr/share/mysql-test/mtr +ln -sf mysql-test-run.pl %{buildroot}/usr/share/mysql-test/mysql-test-run +mv %{buildroot}/usr/share/mysql-test/lib/My/SafeProcess/my_safe_process %{buildroot}%{_bindir} +# generate filelist for binaries and their manpages (easier than enumerating +# all the binaries and manapages manually, esp. when there are new manpages in +# each release) +filelist() +{ + echo '%%defattr(-, root, root)' + pushd %buildroot >/dev/null + for i; do + if test -e usr/sbin/"$i"; then + echo /usr/sbin/"$i" + fi + if test -e usr/bin/"$i"; then + echo /usr/bin/"$i" + fi + if ls usr/share/man/*/"$i".[1-9]* >/dev/null 2>&1; then + echo "%%doc %_mandir/*/$i.[1-9]*" + fi + done + popd >/dev/null +} +filelist innochecksum my_print_defaults myisam_ftdump myisamchk myisamlog myisampack mysql_fix_extensions mysql_fix_privilege_tables mysql_install_db mysql_secure_installation mysql_upgrade mysqlbug mysqld mysqld_multi mysqld_safe mysqlbinlog mysqldumpslow mysqlmanager resolve_stack_dump resolveip {m,}aria_chk {m,}aria_dump_log {m,}aria_ftdump {m,}aria_pack {m,}aria_read_log xtstat >mysql.files +filelist mysql mysqladmin mysqlcheck mysqldump mysqlimport mysqlshow >mysql-client.files +filelist mysql_config >libmysqlclient-devel.files +filelist mysqlslap >mysql-bench.files +filelist mysql_client_test mysql_client_test_embedded mysql_waitpid mysqltest mysqltest_embedded >mysql-test.files +# all binaries that don't need to be in a "default" install (mysql.rpm + +# mysql-client.rpm) +filelist msql2mysql mysql_convert_table_format mysql_find_rows mysql_setpermission mysql_tzinfo_to_sql mysql_zap mysqlaccess mysqlhotcopy perror replace >mysql-tools.files +filelist ndbd ndbmtd ndbd_redo_log_reader >mysql-ndb-storage.files +filelist ndb_mgmd >mysql-ndb-management.files +filelist ndb_{config,desc,error_reporter,mgm,print_backup_file,print_schema_file,print_sys_file,restore,select_all,select_count,show_tables,size.pl,test_platform,waiter} >mysql-ndb-tools.files +filelist ndb_{cpcd,delete_all,drop_index,drop_table} >mysql-ndb-extra.files +### files not installed by make install +# Create directory structure +DOCS=(COPYING README EXCEPTIONS-CLIENT %_sourcedir/README.debug %_sourcedir/README.SuSE) +DOCDIR=%buildroot%_defaultdocdir/%name +install -d -m 755 ${DOCDIR} +install -d -m 755 %buildroot/etc/logrotate.d +install -d -m 755 %buildroot/etc/init.d +install -m 644 _build/support-files/mysql-log-rotate %buildroot/etc/logrotate.d/mysql +%if 0%{?prefered} > 0 +install -m 644 _buildlibmysqld/*.so* %buildroot%_libdir +ln -s libmysqld.so.0.0.1 %buildroot%_libdir/libmysqld.so.0 +ln -s libmysqld.so.0.0.1 %buildroot%_libdir/libmysqld.so +%endif +install -m 660 _build/support-files/my-medium.cnf %buildroot/etc/my.cnf +install -m 640 scripts/mysqlaccess.conf %buildroot/etc/mysqlaccess.conf +install -m 644 "${DOCS[@]}" ${DOCDIR} || true +install -m 755 %_sourcedir/rc.mysql-multi %buildroot/etc/init.d/mysql +ln -sf ../../etc/init.d/mysql %buildroot/usr/sbin/rcmysql +# this is used by the init script +install -m 755 -d %buildroot/var/run/mysql +# SuSEfirewall service description +install -D -m 644 %_sourcedir/mysql.SuSEfirewall2 \ + %buildroot/etc/sysconfig/SuSEfirewall2.d/services/mysql +# testsuite +mkdir -p '%buildroot'/usr/share/mysql-test/ +install -m 755 suse-test-run '%buildroot'/usr/share/mysql-test/ +# XXX this should go under /var/..., but some tests get confused by a symlink +# var -> ../../../var/... +#ln -sf ../../../var/lib/mysql/mysql-test %buildroot/usr/share/mysql-test/var +mkdir '%buildroot'/usr/share/mysql-test/var +# Final fixes +find '%buildroot'/usr/share/mysql-test -name '*.orig' -delete +%if 0%{?suse_version} > 1030 +%fdupes -s '%buildroot'/usr/share/mysql-test +%endif +%if 0%{?fedora_version} > 8 +fdupes -q -n -r '%buildroot'/usr/share/mysql-test +%endif +dos2unixConversion() { + %{__sed} -i 's/\r//g' "$1" +} +for i in `grep -Rl '\r' '%buildroot'/usr/share/sql-bench`; do + dos2unixConversion "$i" +done +%if ! 0%{cluster} > 0 +cat mysql-ndb-storage.files mysql-ndb-management.files \ + mysql-ndb-tools.files mysql-ndb-extra.files | \ + sed 's|^%%doc\ ||' | while read tmp; do + cd '%buildroot' + rm -f .$tmp +done +%endif +%if ! 0%{prefered} > 0 +cat libmysqlclient-devel.files | while read tmp; do + cd '%buildroot' + rm -f .$tmp +done +rm -rf '%buildroot'/%_libdir/libmysqld.* +rm -rf '%buildroot'/%_libdir/*.la +rm -rf '%buildroot'/%_libdir/*.so +rm -rf '%buildroot'/%_libdir/*.a +rm -rf '%buildroot'/%_includedir +rm -rf '%buildroot'/%_datadir/man/*/mysql_config* +rm -rf '%buildroot'/%_datadir/aclocal +%endif +sed -i 's|doc/packages/mysql|doc/packages/%{name}|g' '%buildroot'/etc/init.d/mysql +ln -s mysqlcheck '%buildroot'%_bindir/mysqlrepair +ln -s mysqlcheck '%buildroot'%_bindir/mysqlanalyze +ln -s mysqlcheck '%buildroot'%_bindir/mysqloptimize +if [ -f '%buildroot'/usr/bin/mysqlaccess.conf ]; then + mv '%buildroot'/usr/bin/mysqlaccess.conf '%buildroot'/etc/mysqlaccess.conf +fi +mkdir -p '%buildroot'/etc/mysql +[ -z "`ls -1 %_sourcedir/*.cnf`" ] || cp %_sourcedir/*.cnf '%buildroot'/etc/mysql |