[mldonkey] Fix errors under gcc5 and ocaml 4.02
Christopher Meng
cicku at fedoraproject.org
Sun Feb 22 05:01:06 UTC 2015
commit a8ba0083211fd2fadb919644231098a2448c158e
Author: Christopher Meng <i at cicku.me>
Date: Sun Feb 22 13:00:16 2015 +0800
Fix errors under gcc5 and ocaml 4.02
0001-Fix-mldonkey-FTBFS-under-gcc-5.patch | 136 ++++++++++++++++++
...ken-quoted-string-syntax-under-ocaml-4.02.patch | 25 ++++
mldonkey.spec | 154 ++++++++++++---------
mldonkey.tmpfiles.conf | 2 +-
4 files changed, 248 insertions(+), 69 deletions(-)
---
diff --git a/0001-Fix-mldonkey-FTBFS-under-gcc-5.patch b/0001-Fix-mldonkey-FTBFS-under-gcc-5.patch
new file mode 100644
index 0000000..924165e
--- /dev/null
+++ b/0001-Fix-mldonkey-FTBFS-under-gcc-5.patch
@@ -0,0 +1,136 @@
+From f1c005e78aa609622b87c72f63c2bf96e993a49c Mon Sep 17 00:00:00 2001
+From: Christopher Meng <i at cicku.me>
+Date: Sun, 22 Feb 2015 10:26:07 +0800
+Subject: [PATCH 1/2] Fix mldonkey FTBFS under gcc 5
+
+---
+ src/config/mingw/os_stubs_c.c | 10 +++++-----
+ src/config/unix/os_stubs_c.c | 6 +++---
+ src/utils/cdk/zlibstubs.c | 2 +-
+ src/utils/lib/fst_hash.c | 4 ++--
+ src/utils/lib/os_stubs.h | 4 ++--
+ 5 files changed, 13 insertions(+), 13 deletions(-)
+
+diff --git a/src/config/mingw/os_stubs_c.c b/src/config/mingw/os_stubs_c.c
+index 1f67816..5d7dad5 100644
+--- a/src/config/mingw/os_stubs_c.c
++++ b/src/config/mingw/os_stubs_c.c
+@@ -110,13 +110,13 @@ int os_getdtablesize()
+
+ *******************************************************************/
+
+-int64 os_getfdsize(OS_FD fd)
++int64_t os_getfdsize(OS_FD fd)
+ {
+ long len_high;
+- int64 ret;
++ int64_t ret;
+
+ ret = GetFileSize(fd, &len_high);
+- return ((int64) len_high << 32 | ret);
++ return ((int64_t) len_high << 32 | ret);
+ }
+
+ /*******************************************************************
+@@ -127,7 +127,7 @@ int64 os_getfdsize(OS_FD fd)
+
+ *******************************************************************/
+
+-int64 os_getfilesize(char *path)
++int64_t os_getfilesize(char *path)
+ {
+ OS_FD fd = CreateFile(path, GENERIC_READ, FILE_SHARE_READ,
+ NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL,
+@@ -137,7 +137,7 @@ int64 os_getfilesize(char *path)
+ if (fd != INVALID_HANDLE_VALUE){
+ ret = GetFileSize(fd, &len_high);
+ CloseHandle(fd);
+- return ((int64) len_high << 32 | ret);
++ return ((int64_t) len_high << 32 | ret);
+ } else {
+ long err = GetLastError();
+ if (err != NO_ERROR) {
+diff --git a/src/config/unix/os_stubs_c.c b/src/config/unix/os_stubs_c.c
+index 3495271..a43dc7f 100644
+--- a/src/config/unix/os_stubs_c.c
++++ b/src/config/unix/os_stubs_c.c
+@@ -66,7 +66,7 @@ ssize_t os_read(OS_FD fd, char *buf, size_t len)
+
+ void os_ftruncate(OS_FD fd, OFF_T len, /* bool */ int sparse)
+ {
+- int64 cursize;
++ int64_t cursize;
+ if(!fd) failwith("ftruncate32: file is closed");
+
+ cursize = os_getfdsize(fd);
+@@ -109,7 +109,7 @@ int os_getdtablesize()
+
+ *******************************************************************/
+
+-int64 os_getfdsize(OS_FD fd)
++int64_t os_getfdsize(OS_FD fd)
+ {
+ struct stat buf;
+
+@@ -127,7 +127,7 @@ int64 os_getfdsize(OS_FD fd)
+
+ *******************************************************************/
+
+-int64 os_getfilesize(char *path)
++int64_t os_getfilesize(char *path)
+ {
+ struct stat buf;
+
+diff --git a/src/utils/cdk/zlibstubs.c b/src/utils/cdk/zlibstubs.c
+index 491476f..a6ec257 100644
+--- a/src/utils/cdk/zlibstubs.c
++++ b/src/utils/cdk/zlibstubs.c
+@@ -191,7 +191,7 @@ value camlzip_inflateEnd(value vzs)
+
+ value camlzip_update_crc32(value crc, value buf, value pos, value len)
+ {
+- return copy_int32(crc32((uint32) Int32_val(crc),
++ return copy_int32(crc32((uint32_t) Int32_val(crc),
+ &Byte_u(buf, Long_val(pos)),
+ Long_val(len)));
+ }
+diff --git a/src/utils/lib/fst_hash.c b/src/utils/lib/fst_hash.c
+index 2f9229c..e925bb2 100755
+--- a/src/utils/lib/fst_hash.c
++++ b/src/utils/lib/fst_hash.c
+@@ -197,7 +197,7 @@ unsigned short fst_hash_checksum (unsigned char *hash)
+ /*****************************************************************************/
+
+ // hash file
+-int fst_hash_file (unsigned char *fth, char *file, int64 filesize)
++int fst_hash_file (unsigned char *fth, char *file, int64_t filesize)
+ {
+ FILE *fp;
+ unsigned char *buf;
+@@ -271,7 +271,7 @@ int fst_hash_file (unsigned char *fth, char *file, int64 filesize)
+ }
+
+
+-void fst_hash_string (unsigned char *fth, unsigned char *file, int64 filesize)
++void fst_hash_string (unsigned char *fth, unsigned char *file, int64_t filesize)
+ {
+ unsigned char * buf = file;
+ size_t len = filesize;
+diff --git a/src/utils/lib/os_stubs.h b/src/utils/lib/os_stubs.h
+index 42f2fe8..5ec0512 100644
+--- a/src/utils/lib/os_stubs.h
++++ b/src/utils/lib/os_stubs.h
+@@ -155,8 +155,8 @@ extern OFF_T os_lseek(OS_FD fd, OFF_T pos, int dir);
+ extern void os_ftruncate(OS_FD fd, OFF_T len, int sparse);
+ extern ssize_t os_read(OS_FD fd, char *buf, size_t len);
+ extern int os_getdtablesize();
+-extern int64 os_getfdsize(OS_FD fd);
+-extern int64 os_getfilesize(char *path);
++extern int64_t os_getfdsize(OS_FD fd);
++extern int64_t os_getfilesize(char *path);
+ extern void os_set_nonblock(OS_SOCKET fd);
+ extern void os_uname(char buf[]);
+ extern int os_os_supported();
+--
+2.3.0
+
diff --git a/0002-Fix-broken-quoted-string-syntax-under-ocaml-4.02.patch b/0002-Fix-broken-quoted-string-syntax-under-ocaml-4.02.patch
new file mode 100644
index 0000000..fa546bd
--- /dev/null
+++ b/0002-Fix-broken-quoted-string-syntax-under-ocaml-4.02.patch
@@ -0,0 +1,25 @@
+From 1993fdf3850f5d52560b3406362381bcb6e218ef Mon Sep 17 00:00:00 2001
+From: Christopher Meng <i at cicku.me>
+Date: Sun, 22 Feb 2015 10:29:17 +0800
+Subject: [PATCH 2/2] Fix broken quoted string syntax under ocaml 4.02
+
+---
+ src/utils/net/terminal.ml | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/utils/net/terminal.ml b/src/utils/net/terminal.ml
+index 44a96f4..c9ecde8 100644
+--- a/src/utils/net/terminal.ml
++++ b/src/utils/net/terminal.ml
+@@ -185,7 +185,7 @@ module Output = struct
+ let canal = List.assoc chan !chanmap in
+ etat.chan <- Some (chan, canal);
+ info (sprintf "connecte au canal '%s'" chan);
+- (* {| canal ALL } *)
++ (* {| canal ALL |} *)
+ with Not_found -> (* pas encore de recepteur pour ce canal *)
+ try (* on en cree un *)
+ let serveur = nsrecord.get_loc chan in
+--
+2.3.0
+
diff --git a/mldonkey.spec b/mldonkey.spec
index ebadc9c..499169f 100644
--- a/mldonkey.spec
+++ b/mldonkey.spec
@@ -1,31 +1,36 @@
-Name: mldonkey
-Version: 3.1.5
-Release: 3%{?dist}
-Summary: Multiple P2P Network Client
-License: GPLv2+
-URL: http://mldonkey.sourceforge.net
-Source0: http://downloads.sourceforge.net/project/%{name}/%{name}/%{version}/%{name}-%{version}.tar.bz2
-Source1: mldonkey.logrotate
-Source2: mldonkey.service
-Source3: mldonkey.tmpfiles.conf
-BuildRequires: bzip2-devel
-BuildRequires: desktop-file-utils
-BuildRequires: file-devel
-BuildRequires: gtk2-devel
-BuildRequires: librsvg2-devel
-#BuildRequires: miniupnpc-devel GD
-BuildRequires: ncurses-devel
-BuildRequires: ocaml
-BuildRequires: ocaml-camlp4-devel
-BuildRequires: ocaml-lablgtk-devel
-BuildRequires: systemd
-BuildRequires: zlib-devel
-Requires: logrotate
+Name: mldonkey
+Version: 3.1.5
+Release: 4%{?dist}
+Summary: Multiple P2P Network Client
+License: GPLv2+
+URL: http://mldonkey.sourceforge.net
+Source0: http://downloads.sourceforge.net/project/%{name}/%{name}/%{version}/%{name}-%{version}.tar.bz2
+Source1: mldonkey.logrotate
+Source2: mldonkey.service
+Source3: mldonkey.tmpfiles.conf
+Patch0: 0001-Fix-mldonkey-FTBFS-under-gcc-5.patch
+Patch1: 0002-Fix-broken-quoted-string-syntax-under-ocaml-4.02.patch
+BuildRequires: bzip2-devel
+BuildRequires: desktop-file-utils
+BuildRequires: file-devel
+BuildRequires: gtk2-devel
+#BuildRequires: libnatpmp-devel >= 20131126
+BuildRequires: librsvg2-devel
+#BuildRequires: miniupnpc-devel >= 1.9
+#TODO: GD
+BuildRequires: ncurses-devel
+BuildRequires: ocaml
+#BuildRequires: ocaml-bitstring-devel
+BuildRequires: ocaml-camlp4-devel
+BuildRequires: ocaml-lablgtk-devel
+BuildRequires: systemd
+BuildRequires: zlib-devel
+Requires: logrotate
# for kill_mldonkey
-Requires: perl(LWP::UserAgent)
+Requires: perl(LWP::UserAgent)
# for mldonkey_command
-Requires: nc
-ExcludeArch: sparc64 s390 s390x
+Requires: nc
+ExcludeArch: sparc64 s390 s390x
%description
MLDonkey is a door to the 'donkey' network, a decentralized network used to
@@ -33,16 +38,16 @@ exchange big files on the Internet. It is written in a wonderful language,
called Objective-Caml, and present most features of the basic Windows donkey
client, plus some more:
- It should work on most UNIX-compatible platforms.
-- You can remotely command your client, either by telnet (port 4000),
- by a WEB browser (http://localhost:4080), or with a classical client
- interface (see http://www.nongnu.org/mldonkey)
+- You can remotely command your client, either by telnet (port 4000), by a
+WEB browser (http://localhost:4080), or with a classical client interface
+ (see http://www.nongnu.org/mldonkey).
- You can connect to several servers, and each search will query all the
- connected servers.
-- You can select mp3s by bitrates in queries (useful ?).
+ connected servers.
+- You can select mp3s by bitrates in queries.
- You can select the name of a downloaded file before moving it to your
- incoming directory.
+incoming directory.
- You can have several queries in the graphical user interface at the same
- time.
+time.
- You can remember your old queries results in the command-line interface.
- You can search in the history of all files you have seen on the network.
@@ -52,27 +57,27 @@ Several different file-sharing networks supported:
- DC++
- (FastTrack, SoulSeek, Gnutella and G2 need work)
-%package gui
-Summary: Graphical frontend for mldonkey based on GTK2
-Requires: hicolor-icon-theme
+%package gui
+Summary: Graphical frontend for mldonkey based on GTK2
+Requires: hicolor-icon-theme
# TODO requirement for mldonkey_previewer
# Requires: mplayer
-%description gui
+%description gui
The GTK interface for mldonkey provides a convenient way of managing
all mldonkey operations. It gives details about conected servers,
downloaded files, friends and lets one search for files in a pleasing
way.
-%package server
-Summary: Enables mldonkey as a system daemon
-Requires: %{name}%{?_isa} = %{version}-%{release}
-Requires(pre): shadow-utils
-Requires(post): systemd
-Requires(preun): systemd
-Requires(postun): systemd
+%package server
+Summary: Enables mldonkey as a system daemon
+Requires: %{name}%{?_isa} = %{version}-%{release}
+Requires(pre): shadow-utils
+Requires(post): systemd
+Requires(preun): systemd
+Requires(postun): systemd
-%description server
+%description server
Contains init and configs to launch mldonkey as a service.
NOTE: by default incoming dir is located in %{_localstatedir}/lib/mldonkey/incoming
@@ -83,12 +88,12 @@ NOTE: If you are using a password for your mldonkey, you need to specify
it in your %{_sysconfdir}/sysconfig/mldonkey, because mldonkey now stores
it encrypted.
-%package -n konqueror-mldonkey-ed2k-support
-Summary: Easy way to download a ed2k-link from Konqueror
-Requires: perl(LWP::UserAgent)
-Requires: kde-filesystem
+%package -n konqueror-mldonkey-ed2k-support
+Summary: Easy way to download a ed2k-link from Konqueror
+Requires: perl(LWP::UserAgent)
+Requires: kde-filesystem
-%description -n konqueror-mldonkey-ed2k-support
+%description -n konqueror-mldonkey-ed2k-support
This package contains tool which gives you an easy way to add an ed2k-link
(like ed2k://|file|filename.exe|21352658|72b0b287cab7d875ccc1d89ebe910b9g|)
with a single click to your mldonkey download queue.
@@ -96,6 +101,11 @@ You need to edit %{_sysconfdir}/sysconfig/mldonkey_submit
%prep
%setup -q
+%patch0 -p1
+%patch1 -p1
+
+# Unbundle ocaml-bitstring
+#rm -frv src/utils/bitstring/
# Let's make rpmlint happy
sed -i 's|\r||g' distrib/ed2k_submit/README.MLdonkeySubmit
@@ -118,13 +128,13 @@ chmod 644 src/networks/fasttrack/fst_crypt_ml.c
--enable-gui=newgui2 \
--disable-gd \
--enable-checks
-# --enable-upnp-natpmp without libnatpmp
+# --enable-upnp-natpmp=yes \
make depend
-make %{?_smp_mflags}
-make utils %{?_smp_mflags}
+%make_build
+%make_build utils
-perl -pi -e 's|/etc/sysconfig/mldonkey|/etc/sysconfig/mldonkey_submit|' distrib/ed2k_submit/mldonkey_submit
+perl -pi -e 's|/etc/sysconfig/mldonkey|/etc/sysconfig/mldonkey_submit|' distrib/ed2k_submit/mldonkey_submit
%install
DONT_GPRINTIFY=1
@@ -175,7 +185,7 @@ install -pDm644 %{S:3} %{buildroot}%{_tmpfilesdir}/%{name}.conf
# Create necessary directories for server
install -dm755 %{buildroot}%{_localstatedir}/cache/mldonkey
install -dm755 %{buildroot}%{_localstatedir}/lib/%{name}/incoming
-install -dm755 %{buildroot}%{_localstatedir}/run/%{name}
+install -dm755 %{buildroot}/run/%{name}
# create downloads.ini
echo -e \
@@ -196,28 +206,28 @@ install -pDm644 distrib/ed2k_submit/ed2k.protocol %{buildroot}%{_datadir}/servi
%pre server
getent group %{name} >/dev/null || groupadd -r %{name}
getent passwd %{name} >/dev/null || \
- useradd -r -g %{name} -d %{_localstatedir}/lib/%{name} -s /bin/bash \
+ useradd -r -g %{name} -d %{_localstatedir}/lib/%{name} -s /sbin/nologin \
-c "MLDonkey server" %{name}
-%post gui
+%post gui
touch --no-create %{_datadir}/icons/hicolor &>/dev/null || :
-%post server
+%post server
%systemd_post %{S:2}
-%postun gui
+%postun gui
if [ $1 -eq 0 ] ; then
touch --no-create %{_datadir}/icons/hicolor &>/dev/null
gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
fi
-%posttrans gui
+%posttrans gui
gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
-%preun server
+%preun server
%systemd_preun %{S:2}
-%postun server
+%postun server
%systemd_postun_with_restart %{S:2}
%triggerun -- mldonkey-server < 3.0.3-5
@@ -231,8 +241,9 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
/bin/systemctl try-restart mldonkey.service >/dev/null 2>&1 || :
%files
-%doc Copying.txt distrib/Authors.txt distrib/Bugs.txt distrib/ChangeLog distrib/Developers.txt
+%doc distrib/Authors.txt distrib/Bugs.txt distrib/ChangeLog distrib/Developers.txt
%doc docs
+%license Copying.txt
%{_bindir}/copysources
%{_bindir}/get_range
%{_bindir}/kill_mldonkey
@@ -249,7 +260,8 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
%{_bindir}/svg_converter
%files gui
-%doc Copying.txt distrib/Authors.txt distrib/Bugs.txt distrib/ChangeLog distrib/Developers.txt
+%doc distrib/Authors.txt distrib/Bugs.txt distrib/ChangeLog distrib/Developers.txt
+%license Copying.txt
%{_bindir}/mlbt+gui
%{_bindir}/mldc+gui
%{_bindir}/mldonkey+gui
@@ -265,14 +277,15 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
%{_datadir}/pixmaps/mldonkey.png
%files server
-%doc Copying.txt
+%license Copying.txt
%config(noreplace) %{_sysconfdir}/logrotate.d/mldonkey
%{_unitdir}/mldonkey.service
%{_tmpfilesdir}/%{name}.conf
%attr(750,mldonkey,mldonkey) %dir %{_localstatedir}/log/mldonkey
%attr(750,mldonkey,mldonkey) %dir %{_localstatedir}/cache/mldonkey
%attr(750,mldonkey,mldonkey) %dir %{_localstatedir}/lib/mldonkey
-%ghost %attr(755,mldonkey,mldonkey) %dir %{_localstatedir}/run/mldonkey
+# Controlled by tmpfiles.d
+%dir /run/mldonkey
%attr(770,mldonkey,mldonkey) %dir %{_localstatedir}/lib/mldonkey/incoming
%config(noreplace) %{_localstatedir}/lib/mldonkey/downloads.ini
@@ -282,9 +295,14 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
%{_bindir}/mldonkey_submit
%{_datadir}/services/ed2k.protocol
-# Prepare to enable UPnP support.
-
+#- Enable UPnP port forwarding support
%changelog
+* Fri Feb 13 2015 Christopher Meng <rpm at cicku.me> - 3.1.5-4
+- Fix FTBFS under GCC5
+- Set mldonkey default user shell to /sbin/nologin (BZ#1192012)
+- Fix systemctl start mldonkey-server exited with -2 (#BZ718524)
+- /var/run/mldonkey -> /run/mldonkey
+
* Sun Aug 17 2014 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 3.1.5-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
diff --git a/mldonkey.tmpfiles.conf b/mldonkey.tmpfiles.conf
index ffc2de0..3f378c1 100644
--- a/mldonkey.tmpfiles.conf
+++ b/mldonkey.tmpfiles.conf
@@ -1 +1 @@
-d /var/run/mldonkey 0755 mldonkey mldonkey
+d /run/mldonkey 0755 mldonkey mldonkey
More information about the scm-commits
mailing list