diff --git a/client/Makefile.in b/client/Makefile.in index 1a9310c..05b49c9 100644 --- a/client/Makefile.in +++ b/client/Makefile.in @@ -3,10 +3,10 @@ COMPILE = $(CC) $(CFLAGS) ENABLE_STATIC_LIB = $(ENABLE_STATIC_LIB) ENABLE_SHARED_LIB = $(ENABLE_SHARED_LIB) -INC_PATH = -I../common -I../tracker -I/usr/local/include +INC_PATH = -I../common -I../tracker -I/usr/include LIB_PATH = $(LIBS) TARGET_PATH = $(TARGET_PREFIX)/bin -TARGET_LIB = $(TARGET_PREFIX)/lib +TARGET_LIB = $(TARGET_PREFIX)/lib64 TARGET_INC = $(TARGET_PREFIX)/include CONFIG_PATH = $(TARGET_CONF_PATH) @@ -77,17 +77,18 @@ ALL_PRGS = fdfs_monitor fdfs_test fdfs_test1 fdfs_crc32 fdfs_upload_file \ STATIC_LIBS = libfastcommon.a libfdfsclient.a -SHARED_LIBS = libfastcommon.so.1 libfdfsclient.so.1 +SHARED_LIBS = libfastcommon.so libfdfsclient.so +CLIENT_SHARED_LIBS = libfdfsclient.so ALL_LIBS = $(STATIC_LIBS) $(SHARED_LIBS) all: $(ALL_OBJS) $(ALL_PRGS) $(ALL_LIBS) -libfastcommon.so.1: +libfastcommon.so: $(COMPILE) -o $@ $< -shared $(FAST_SHARED_OBJS) $(LIB_PATH) - ln -fs libfastcommon.so.1 libfastcommon.so -libfdfsclient.so.1: - $(COMPILE) -o $@ $< -shared $(FDFS_SHARED_OBJS) $(LIB_PATH) -L. -lfastcommon - ln -fs libfdfsclient.so.1 libfdfsclient.so +# ln -fs libfastcommon.so.1 libfastcommon.so +libfdfsclient.so: + $(COMPILE) -o $@ $< -shared $(FDFS_SHARED_OBJS) $(LIB_PATH) -lfastcommon +# ln -fs libfdfsclient.so.1 libfdfsclient.so libfastcommon.a: ar cru $@ $< $(FAST_STATIC_OBJS) libfdfsclient.a: @@ -106,19 +107,11 @@ install: mkdir -p $(TARGET_LIB) cp -f $(ALL_PRGS) $(TARGET_PATH) if [ $(ENABLE_STATIC_LIB) -eq 1 ]; then cp -f $(STATIC_LIBS) $(TARGET_LIB); fi - if [ $(ENABLE_SHARED_LIB) -eq 1 ]; then cp -f $(SHARED_LIBS) $(TARGET_LIB); fi - if [ $(ENABLE_SHARED_LIB) -eq 1 ]; then ln -fs $(TARGET_LIB)/libfastcommon.so.1 $(TARGET_LIB)/libfastcommon.so; fi - if [ $(ENABLE_SHARED_LIB) -eq 1 ]; then ln -fs $(TARGET_LIB)/libfdfsclient.so.1 $(TARGET_LIB)/libfdfsclient.so; fi + if [ $(ENABLE_SHARED_LIB) -eq 1 ]; then cp -f $(CLIENT_SHARED_LIBS) $(TARGET_LIB); fi - if [ ! -f $(CONFIG_PATH)/client.conf ]; then cp -f ../conf/client.conf ../conf/http.conf $(CONFIG_PATH); fi - - mkdir -p $(TARGET_INC) - mkdir -p $(TARGET_INC)/fastcommon mkdir -p $(TARGET_INC)/fastdfs - cp -f $(FAST_HEADER_FILES) $(TARGET_INC)/fastcommon cp -f $(FDFS_HEADER_FILES) $(TARGET_INC)/fastdfs - - if [ $(ENABLE_SHARED_LIB) -eq 1 -a $(TARGET_LIB) = "/usr/local/lib" ]; then sh ./fdfs_link_library.sh; fi + if [ ! -f $(CONFIG_PATH)/client.conf ]; then cp -f ../conf/client.conf $(CONFIG_PATH)/client.conf.sample; fi clean: - rm -f $(ALL_OBJS) $(ALL_PRGS) $(ALL_LIBS) libfastcommon.so libfdfsclient.so + rm -f $(ALL_OBJS) $(ALL_PRGS) $(ALL_LIBS) diff --git a/fastdfs.spec b/fastdfs.spec new file mode 100644 index 0000000..68b4902 --- /dev/null +++ b/fastdfs.spec @@ -0,0 +1,120 @@ +%define FastDFS fastdfs +%define FastdfsServer fastdfs-server +%define ClientName libfdfsclient +%define FastTool fastdfs-tool +%define FastVersion 5.0.3 + +Name: %{FastDFS} +Version: %{FastVersion} +Release: 1%{?dist} +Summary: The fastdfs manager +License: GPL +Group: Arch/Tech +URL: http://perso.orange.fr/sebastien.godard/ +Source: http://perso.orange.fr/sebastien.godard/%{name}-%{version}.tar.gz + +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) + +Requires: %__cp %__mv %__chmod %__grep %__mkdir %__install %__id + +%description +This package provides tracker & storage of fastdfs + +%package -n %{FastdfsServer} +Summary: fastdfs tracker & storage + +%package -n %{FastTool} +Requires: libfastcommon +Summary: fastdfs tools + +%package -n %{ClientName} +Requires: libfastcommon +Summary: The client dynamic library of fastdfs + +%package -n %{ClientName}-devel +Requires: %{ClientName} +Summary: The client header of fastdfs + +%description -n %{FastdfsServer} +This package provides tracker & storage of fastdfs + +%description -n %{ClientName} +This package is client dynamic library of fastdfs + +%description -n %{ClientName}-devel +This package is client header of fastdfs + +%description -n %{FastTool} +This package is tools for fastdfs + +%prep +%setup -q + +%build +# FIXME: I need to fix the upstream Makefile to use LIBDIR et al. properly and +# send the upstream maintainer a patch. +# add DOCDIR to the configure part +./make.sh + +%install +rm -rf %{buildroot} +DESTDIR=$RPM_BUILD_ROOT ./make.sh install +#make install IGNORE_MAN_GROUP=y DOC_DIR=%{_docdir}/%{name}-%{version} INIT_DIR=%{_initrddir} + +#install -m 0644 sysstat.crond %{buildroot}/%{_sysconfdir}/cron.d/sysstat + +#%find_lang %{name} + +%post -n %{FastdfsServer} +/sbin/chkconfig --add fdfs_trackerd +/sbin/chkconfig --add fdfs_storaged + +%preun -n %{FastdfsServer} +/sbin/chkconfig --del fdfs_trackerd +/sbin/chkconfig --del fdfs_storaged + +%postun + +%clean +#rm -rf %{buildroot} + +%files +#%defattr(-,root,root,-) +#/usr/local/bin/* +#/usr/local/include/* + +%files -n %{FastdfsServer} +%defattr(-,root,root,-) +/usr/bin/fdfs_trackerd +/usr/bin/fdfs_storaged +/usr/bin/restart.sh +/usr/bin/stop.sh +/etc/init.d/* +/etc/fdfs/tracker.conf.sample +/etc/fdfs/storage.conf.sample + +%files -n %{ClientName} +/usr/lib64/libfdfsclient* +/etc/fdfs/client.conf.sample + +%files -n %{ClientName}-devel +%defattr(-,root,root,-) +/usr/include/fastdfs/* + +%files -n %{FastTool} +/usr/bin/fdfs_monitor +/usr/bin/fdfs_test +/usr/bin/fdfs_test1 +/usr/bin/fdfs_crc32 +/usr/bin/fdfs_upload_file +/usr/bin/fdfs_download_file +/usr/bin/fdfs_delete_file +/usr/bin/fdfs_file_info +/usr/bin/fdfs_appender_test +/usr/bin/fdfs_appender_test1 +/usr/bin/fdfs_append_file +/usr/bin/fdfs_upload_appender + +%changelog +* Mon Jun 23 2014 Zaixue Liao +- first RPM release (1.0) diff --git a/make.sh b/make.sh index a8d30d6..1c47f72 100755 --- a/make.sh +++ b/make.sh @@ -58,10 +58,11 @@ EOF ENABLE_STATIC_LIB=0 ENABLE_SHARED_LIB=1 -TARGET_PREFIX=/usr/local -TARGET_CONF_PATH=/etc/fdfs +TARGET_PREFIX=$DESTDIR/usr +TARGET_CONF_PATH=$DESTDIR/etc/fdfs +TARGET_INIT_PATH=$DESTDIR/etc/init.d -#WITH_LINUX_SERVICE=1 +WITH_LINUX_SERVICE=1 DEBUG_FLAG=1 @@ -194,17 +195,15 @@ if [ "$1" = "install" ]; then if [ "$WITH_LINUX_SERVICE" = "1" ]; then if [ ! -d /etc/fdfs ]; then mkdir -p /etc/fdfs - cp -f conf/tracker.conf /etc/fdfs/ - cp -f conf/storage.conf /etc/fdfs/ - cp -f conf/client.conf /etc/fdfs/ - cp -f conf/http.conf /etc/fdfs/ - cp -f conf/mime.types /etc/fdfs/ + cp -f conf/tracker.conf $TARGET_CONF_PATH/tracker.conf.sample + cp -f conf/storage.conf $TARGET_CONF_PATH/storage.conf.sample + cp -f conf/client.conf $TARGET_CONF_PATH/client.conf.sample fi - - cp -f init.d/fdfs_trackerd /etc/rc.d/init.d/ - cp -f init.d/fdfs_storaged /etc/rc.d/init.d/ - /sbin/chkconfig --add fdfs_trackerd - /sbin/chkconfig --add fdfs_storaged + mkdir -p $TARGET_INIT_PATH + cp -f init.d/fdfs_trackerd $TARGET_INIT_PATH + cp -f init.d/fdfs_storaged $TARGET_INIT_PATH +# /sbin/chkconfig --add fdfs_trackerd +# /sbin/chkconfig --add fdfs_storaged fi fi fi diff --git a/storage/Makefile.in b/storage/Makefile.in index 4ebc2cf..16a315f 100644 --- a/storage/Makefile.in +++ b/storage/Makefile.in @@ -44,6 +44,6 @@ install: mkdir -p $(TARGET_PATH) mkdir -p $(CONFIG_PATH) cp -f $(ALL_PRGS) $(TARGET_PATH) - if [ ! -f $(CONFIG_PATH)/storage.conf ]; then cp -f ../conf/storage.conf ../conf/mime.types ../conf/http.conf $(CONFIG_PATH); fi + if [ ! -f $(CONFIG_PATH)/storage.conf ]; then cp -f ../conf/storage.conf $(CONFIG_PATH)/storage.conf.sample; fi clean: rm -f $(ALL_OBJS) $(ALL_PRGS) diff --git a/tracker/Makefile.in b/tracker/Makefile.in index ae70a1c..4ac5522 100644 --- a/tracker/Makefile.in +++ b/tracker/Makefile.in @@ -34,6 +34,6 @@ install: mkdir -p $(TARGET_PATH) mkdir -p $(CONFIG_PATH) cp -f $(ALL_PRGS) $(TARGET_PATH) - if [ ! -f $(CONFIG_PATH)/tracker.conf ]; then cp -f ../conf/tracker.conf ../conf/mime.types ../conf/http.conf $(CONFIG_PATH); fi + if [ ! -f $(CONFIG_PATH)/tracker.conf ]; then cp -f ../conf/tracker.conf $(CONFIG_PATH)/tracker.conf.sample; fi clean: rm -f $(ALL_OBJS) $(ALL_PRGS)