[packages] mysql: fix /bin/hostname invocation in table install script, openwrt does...
[openwrt/svn-archive/archive.git] / libs / mysql / Makefile
index 723492e..dba90cb 100644 (file)
-# 
-# Copyright (C) 2006 OpenWrt.org
+#
+# Copyright (C) 2006-2010 OpenWrt.org
 #
 # This is free software, licensed under the GNU General Public License v2.
 # See /LICENSE for more information.
 #
-# $Id$
 
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=mysql
-PKG_VERSION:=5.0.18
-PKG_RELEASE:=1
+PKG_VERSION:=5.1.53
+PKG_RELEASE:=2
 
-PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=\
-       http://mysql.planetmirror.com/Downloads/MySQL-5.0/ \
-       http://mysql.he.net/Downloads/MySQL-5.0/ \
-       http://www.linorg.usp.br/mysql/Downloads/MySQL-5.0/ \
-       http://mysql.holywar.net/Downloads/MySQL-5.0/
-PKG_MD5SUM:=f18153b0239aaa03fc5a751f2d82cb71
-PKG_CAT:=zcat
+       http://mysql.planetmirror.com/Downloads/MySQL-5.1/ \
+       http://mysql.he.net/Downloads/MySQL-5.1/ \
+       http://www.linorg.usp.br/mysql/Downloads/MySQL-5.1/ \
+       http://mysql.holywar.net/Downloads/MySQL-5.1/
+PKG_MD5SUM:=e5e7c5b0b5c382489e6a66778703bc46
+
+PKG_BUILD_DEPENDS:=libncurses libreadline
+PKG_BUILD_PARALLEL:=1
 
-PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install
-PKG_BUILDDEP:=libncurses libreadline
+PKG_FIXUP:=libtool no-autoreconf
 
 include $(INCLUDE_DIR)/package.mk
 
-define Package/libmysqlclient
+define Package/libmysqlclient/Default
   SECTION:=libs
   CATEGORY:=Libraries
-  DEPENDS:=zlib
+  DEPENDS:=+zlib
   TITLE:=MySQL client library
-  DESCRIPTION:=MySQL client library.
   URL:=http://dev.mysql.com/
 endef
 
+define Package/mysql-server/Default
+  SECTION:=utils
+  CATEGORY:=Utilities
+  DEPENDS:=+zlib +libmysqlclient +uclibcxx
+  TITLE:=MySQL Server
+  URL:=http://dev.mysql.com/
+  SUBMENU:=database
+endef
+
+define Package/mysql-server
+  $(call Package/mysql-server/Default)
+endef
+
+define Package/libmysqlclient
+  $(call Package/libmysqlclient/Default)
+endef
+
+define Package/libmysqlclient_r
+  $(call Package/libmysqlclient/Default)
+  TITLE += threadsafe
+endef
+
+TARGET_CXX=g++-uc
+
+CONFIGURE_VARS += \
+        CXXFLAGS="$$$$CXXFLAGS -fno-builtin -fno-rtti -nostdinc++"  \
+        CPPFLAGS="$$$$CPPFLAGS -I$(STAGING_DIR)/usr/include/uClibc++" \
+        LDFLAGS="$$$$LDFLAGS" \
+        LIBS="-nodefaultlibs -luClibc++ -lm $(LIBGCC_S)" \
+        CLIENTCLIBS="-nodefaultlibs -luClibc++ -lm $(LIBGCC_S)" \
+
+
 define Build/Configure
-       (cd $(PKG_BUILD_DIR); rm -f config.cache; \
-               touch configure.in; \
-               touch aclocal.m4; \
-               touch Makefile.in; \
-               touch config.h.in; \
-               touch configure; \
-               $(TARGET_CONFIGURE_OPTS) \
-               CFLAGS="$(TARGET_CFLAGS)" \
-               CXXFLAGS="$(TARGET_CFLAGS)" \
-               CPPFLAGS="-I$(STAGING_DIR)/usr/include -I$(STAGING_DIR)/include" \
-               LDFLAGS="-L$(STAGING_DIR)/usr/lib -L$(STAGING_DIR)/lib" \
-               ac_atomic_add=yes \
-               ac_atomic_sub=yes \
-               ac_cv_sys_restartable_syscalls=yes \
-               ac_cv_conv_longlong_to_float=yes \
+       (cd $(PKG_BUILD_DIR); touch \
+               configure.in \
+               aclocal.m4 \
+               Makefile.in \
+               config.h.in \
+               configure \
+       );
+       $(CP) files/lex_hash.h $(PKG_BUILD_DIR)/sql/lex_hash.h
+
+       $(call Build/Configure/Default, \
+               --enable-shared \
+               --enable-static \
+               --enable-thread-safe-client \
+               --disable-assembler \
+               --with-pthread \
+               --with-server \
+               --without-mysqlmanager \
+               --without-raid \
+               --with-mysqld-user=root \
+               --with-unix-socket-path=/tmp \
+               --without-libwrap \
+               --without-pstack \
+               --with-low-memory \
+               --without-embedded-server \
+               --without-query-cache \
+               --without-mysqlfs \
+               --without-vio \
+               --without-ssl \
+               --without-docs \
+               --without-man \
+               --without-bench \
+               --without-readline \
+               --without-debug \
+               --with-named-thread-libs=-lpthread \
+               , \
                mysql_cv_compress=yes \
                mysql_cv_gethostname_style=glibc2 \
-               ./configure \
-                       --target=$(GNU_TARGET_NAME) \
-                       --host=$(GNU_TARGET_NAME) \
-                       --build=$(GNU_HOST_NAME) \
-                       --program-prefix="" \
-                       --program-suffix="" \
-                       --prefix=/usr \
-                       --exec-prefix=/usr \
-                       --bindir=/usr/bin \
-                       --datadir=/usr/share \
-                       --includedir=/usr/include \
-                       --infodir=/usr/share/info \
-                       --libdir=/usr/lib \
-                       --libexecdir=/usr/lib \
-                       --localstatedir=/var \
-                       --mandir=/usr/share/man \
-                       --sbindir=/usr/sbin \
-                       --sysconfdir=/etc \
-                       $(DISABLE_LARGEFILE) \
-                       $(DISABLE_NLS) \
-                       --enable-shared \
-                       --enable-static \
-                       --disable-assembler \
-                       --with-pthread \
-                       --without-raid \
-                       --with-unix-socket-path=/tmp \
-                       --without-libwrap \
-                       --without-pstack \
-                       --with-low-memory \
-                       --without-server \
-                       --without-embedded-server \
-                       --without-query-cache \
-                       --without-mysqlfs \
-                       --without-vio \
-                       --without-openssl \
-                       --without-docs \
-                       --without-bench \
-                       --without-readline \
-                       --with-named-thread-libs=-lpthread \
+               ac_cv_c_stack_direction=-1 \
        );
 endef
 
+TARGET_CFLAGS += $(FPIC)
+
 define Build/Compile
-       rm -rf $(PKG_INSTALL_DIR)
-       mkdir -p $(PKG_INSTALL_DIR)
+       $(MAKE) $(PKG_JOBS) -C "$(PKG_BUILD_DIR)" \
+               SUBDIRS="include" \
+               DESTDIR="$(PKG_INSTALL_DIR)" \
+               all
        $(MAKE) -C "$(PKG_BUILD_DIR)" \
                SUBDIRS="include" \
                DESTDIR="$(PKG_INSTALL_DIR)" \
-               all install
-       $(MAKE) -C "$(PKG_BUILD_DIR)/libmysql" \
+               install
+       $(MAKE) $(PKG_JOBS) -C "$(PKG_BUILD_DIR)/libmysql" \
                CC="$(HOSTCC)" \
                LINK="$(HOSTCC) -o conf_to_src -lc" \
                CFLAGS="" \
                CPPFLAGS="" \
                conf_to_src
+       $(MAKE) $(PKG_JOBS) -C "$(PKG_BUILD_DIR)" \
+               SUBDIRS="libmysql" \
+               DESTDIR="$(PKG_INSTALL_DIR)" \
+               all
        $(MAKE) -C "$(PKG_BUILD_DIR)" \
                SUBDIRS="libmysql" \
                DESTDIR="$(PKG_INSTALL_DIR)" \
-               all install
+               install
+       $(MAKE) $(PKG_JOBS) -C "$(PKG_BUILD_DIR)" \
+               SUBDIRS="libmysql_r" \
+               DESTDIR="$(PKG_INSTALL_DIR)" \
+               all
+       $(MAKE) -C "$(PKG_BUILD_DIR)" \
+               SUBDIRS="libmysql_r" \
+               DESTDIR="$(PKG_INSTALL_DIR)" \
+               install
        $(MAKE) -C "$(PKG_BUILD_DIR)" \
                SUBDIRS="scripts" \
                DESTDIR="$(PKG_INSTALL_DIR)" \
                bin_SCRIPTS="mysql_config" \
                install
+       $(MAKE) $(PKG_JOBS) -C "$(PKG_BUILD_DIR)" \
+               DESTDIR="$(PKG_INSTALL_DIR)" \
+               all
+       $(MAKE) -C "$(PKG_BUILD_DIR)" \
+               DESTDIR="$(PKG_INSTALL_DIR)" \
+               install
+endef
+
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(2)/bin $(1)/usr/bin $(1)/usr/include $(1)/usr/lib
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/mysql_config $(1)/usr/bin/
+       ln -sf $(STAGING_DIR)/usr/bin/mysql_config $(2)/bin/
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/mysql $(1)/usr/include/
+       # NOTE: needed for MySQL-Python
+       $(CP) $(PKG_BUILD_DIR)/include/mysqld_error.h $(1)/usr/include/mysql/
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/mysql $(1)/usr/lib/
+       rm -f $(1)/usr/lib/mysql/libmysqlclient.la
 endef
 
 define Package/libmysqlclient/install
-       install -d -m0755 $(1)/usr/lib
+       $(INSTALL_DIR) $(1)/usr/lib
        $(CP) $(PKG_INSTALL_DIR)/usr/lib/mysql/libmysqlclient.so.* $(1)/usr/lib/
 endef
-
-define Build/InstallDev
-       mkdir -p $(STAGING_DIR)/usr/bin
-       $(CP) $(PKG_INSTALL_DIR)/usr/bin/mysql_config $(STAGING_DIR)/usr/bin/
-       mkdir -p $(STAGING_DIR)/usr/include
-       $(CP) $(PKG_INSTALL_DIR)/usr/include/mysql $(STAGING_DIR)/usr/include/
-       mkdir -p $(STAGING_DIR)/usr/lib
-       $(CP) $(PKG_INSTALL_DIR)/usr/lib/mysql $(STAGING_DIR)/usr/lib/
-       rm -f $(STAGING_DIR)/usr/lib/mysql/libmysqlclient.la
+define Package/libmysqlclient_r/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/mysql/libmysqlclient_r.so.* $(1)/usr/lib/
 endef
 
-define Build/UninstallDev
-       rm -rf \
-               $(STAGING_DIR)/usr/bin/mysql_config \
-               $(STAGING_DIR)/usr/include/mysql \
-               $(STAGING_DIR)/usr/lib/mysql
+define Package/mysql-server/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/mysql $(1)/usr/bin/
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/mysqld $(1)/usr/bin/
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/myisamchk $(1)/usr/bin/
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/mysqladmin $(1)/usr/bin/
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/mysqldump $(1)/usr/bin/
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/mysql_install_db $(1)/usr/bin/
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/my_print_defaults $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/etc/init.d/
+       $(INSTALL_BIN) files/mysqld.init $(1)/etc/init.d/mysqld
+       $(INSTALL_CONF) conf/my.cnf $(1)/etc/
+       $(INSTALL_DIR) $(1)/usr/share/mysql
+       $(INSTALL_DIR) $(1)/usr/share/mysql/english
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/share/mysql/english/errmsg.sys $(1)/usr/share/mysql/english
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/share/mysql/fill_help_tables.sql $(1)/usr/share/mysql/
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/share/mysql/mysql_system_tables.sql $(1)/usr/share/mysql/
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/share/mysql/mysql_system_tables_data.sql $(1)/usr/share/mysql/
 endef
 
+$(eval $(call BuildPackage,mysql-server))
 $(eval $(call BuildPackage,libmysqlclient))
+$(eval $(call BuildPackage,libmysqlclient_r))