tags 912122 patch
user [email protected]
usertags 912122 + bsp-2019-02-de-bonn
thanks

Dear maintainer,

find attached the fix for linux-ftpd.

This goes beyond the usual scope of an NMU but it seemed wise to brush
up the entire build system so it is robust for any forseeable changes
to the Debian toolchain.

For a full explanation, see
    https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=911154#44

Upload to DELAYED+3 will follow in a few hours, I'd like to give
myself a moment to settle down, then ultimately revisit the
changes done. Feel free to tell me if I should wait a little longer.

Packaging could still take a lot of love.

It might be an idea to drop linux-ftpd in favour of linux-ftpd-ssl,
however linux-ftp has patches that might be worth preserving.

Regards,

    Christoph

diff -Nru linux-ftpd-0.17/debian/changelog linux-ftpd-0.17/debian/changelog
--- linux-ftpd-0.17/debian/changelog    2016-12-06 16:09:38.000000000 +0100
+++ linux-ftpd-0.17/debian/changelog    2019-02-24 14:39:25.000000000 +0100
@@ -1,3 +1,10 @@
+linux-ftpd (0.17-36.1) unstable; urgency=high
+
+  * Non-maintainer upload
+  * Use cmake as build system. Closes: #912122
+
+ -- Christoph Biedl <[email protected]>  Sun, 24 Feb 2019 
14:39:25 +0100
+
 linux-ftpd (0.17-36) unstable; urgency=low
 
   * Step up to Standards version 3.9.8, no changes.
diff -Nru linux-ftpd-0.17/debian/compat linux-ftpd-0.17/debian/compat
--- linux-ftpd-0.17/debian/compat       2016-12-06 15:39:49.000000000 +0100
+++ linux-ftpd-0.17/debian/compat       2018-12-05 00:45:35.000000000 +0100
@@ -1 +1 @@
-9
+10
diff -Nru linux-ftpd-0.17/debian/control linux-ftpd-0.17/debian/control
--- linux-ftpd-0.17/debian/control      2016-12-06 16:05:24.000000000 +0100
+++ linux-ftpd-0.17/debian/control      2018-12-05 00:45:35.000000000 +0100
@@ -3,7 +3,7 @@
 Priority: extra
 Maintainer: Mats Erik Andersson <[email protected]>
 Uploaders: Alberto Gonzalez Iniesta <[email protected]>
-Build-Depends: bison, debhelper (>= 9), libpam0g-dev | libpam-dev
+Build-Depends: bison, debhelper (>= 10~), libpam0g-dev | libpam-dev, cmake
 Standards-Version: 3.9.8
 Homepage: http://ftp.uk.linux.org/pub/linux/Networking/netkit/
 
diff -Nru linux-ftpd-0.17/debian/dirs linux-ftpd-0.17/debian/dirs
--- linux-ftpd-0.17/debian/dirs 2016-12-06 15:39:49.000000000 +0100
+++ linux-ftpd-0.17/debian/dirs 1970-01-01 01:00:00.000000000 +0100
@@ -1,4 +0,0 @@
-etc/pam.d
-usr/share/man/man5
-usr/share/man/man8
-usr/sbin
diff -Nru linux-ftpd-0.17/debian/ftpd.install 
linux-ftpd-0.17/debian/ftpd.install
--- linux-ftpd-0.17/debian/ftpd.install 1970-01-01 01:00:00.000000000 +0100
+++ linux-ftpd-0.17/debian/ftpd.install 2018-12-05 00:45:35.000000000 +0100
@@ -0,0 +1,4 @@
+
+debian/ftpchroot    etc/
+debian/ftpusers     etc/
+debian/pam.d/ftp    etc/pam.d/
diff -Nru linux-ftpd-0.17/debian/ftpd.manpages 
linux-ftpd-0.17/debian/ftpd.manpages
--- linux-ftpd-0.17/debian/ftpd.manpages        1970-01-01 01:00:00.000000000 
+0100
+++ linux-ftpd-0.17/debian/ftpd.manpages        2018-12-05 00:45:35.000000000 
+0100
@@ -0,0 +1,2 @@
+
+debian/ftpchroot.5
diff -Nru linux-ftpd-0.17/debian/patches/001-from_hamm.diff 
linux-ftpd-0.17/debian/patches/001-from_hamm.diff
--- linux-ftpd-0.17/debian/patches/001-from_hamm.diff   2016-12-06 
15:39:49.000000000 +0100
+++ linux-ftpd-0.17/debian/patches/001-from_hamm.diff   2018-12-05 
00:45:35.000000000 +0100
@@ -4,8 +4,8 @@
  and Rainer Weikusat
 Forwarded: no
 Last-Update: 2002-02-09
---- linux-ftpd-0.17.orig/ftpd/ftpcmd.y
-+++ linux-ftpd-0.17/ftpd/ftpcmd.y
+--- a/ftpd/ftpcmd.y
++++ b/ftpd/ftpcmd.y
 @@ -55,6 +55,7 @@
  #include <ctype.h>
  #include <errno.h>
@@ -110,8 +110,8 @@
                break; }
        default:
                reply(504, "SIZE not implemented for Type %c.", "?AEIL"[type]);
---- linux-ftpd-0.17.orig/ftpd/ftpd.8
-+++ linux-ftpd-0.17/ftpd/ftpd.8
+--- a/ftpd/ftpd.8
++++ b/ftpd/ftpd.8
 @@ -67,7 +67,9 @@
  .It Fl A
  Permit only anonymous ftp connections or accounts listed in
@@ -145,8 +145,8 @@
  .It Pa ~ftp/pub
  Make this directory mode 555 and owned by
  .Dq root .
---- linux-ftpd-0.17.orig/ftpd/ftpd.c
-+++ linux-ftpd-0.17/ftpd/ftpd.c
+--- a/ftpd/ftpd.c
++++ b/ftpd/ftpd.c
 @@ -80,6 +80,7 @@
  #include <pwd.h>
  #include <setjmp.h>
@@ -1059,8 +1059,8 @@
                        return (0);
                }
        }
---- linux-ftpd-0.17.orig/ftpd/logwtmp.c
-+++ linux-ftpd-0.17/ftpd/logwtmp.c
+--- a/ftpd/logwtmp.c
++++ b/ftpd/logwtmp.c
 @@ -41,7 +41,6 @@
    "$Id: logwtmp.c,v 1.5 1999/07/16 00:34:29 dholland Exp $";
  
@@ -1077,23 +1077,8 @@
  #include "extern.h"
  
  static int fd = -1;
---- linux-ftpd-0.17.orig/support/Makefile
-+++ linux-ftpd-0.17/support/Makefile
-@@ -1,6 +1,6 @@
- include ../MCONFIG
- 
--OBJS=daemon.o setproctitle.o isexpired.o vis.o
-+OBJS=setproctitle.o isexpired.o vis.o
- 
- all: libsupport.a
- 
-@@ -16,4 +16,3 @@
-       rm -f *.o libsupport.a
- 
- setproctitle.o: setproctitle.h
--daemon.o: daemon.h
---- linux-ftpd-0.17.orig/support/setproctitle.c
-+++ linux-ftpd-0.17/support/setproctitle.c
+--- a/support/setproctitle.c
++++ b/support/setproctitle.c
 @@ -139,7 +139,7 @@
        (void) strcpy(Argv[0], buf);
        p = &Argv[0][i];
diff -Nru linux-ftpd-0.17/debian/patches/014-adjust_infrastruct.diff 
linux-ftpd-0.17/debian/patches/014-adjust_infrastruct.diff
--- linux-ftpd-0.17/debian/patches/014-adjust_infrastruct.diff  2016-12-06 
15:39:49.000000000 +0100
+++ linux-ftpd-0.17/debian/patches/014-adjust_infrastruct.diff  1970-01-01 
01:00:00.000000000 +0100
@@ -1,16 +0,0 @@
-Description: Corrections to infrastructure for builds.
- Insert harmless omission that eases tailored builds.
-Author: Mats Erik Andersson <[email protected]>
-Forwarded: no
-Last-Update: 2010-04-26
---- linux-ftpd-0.17.debian/ftpd/Makefile
-+++ linux-ftpd-0.17/ftpd/Makefile
-@@ -26,7 +26,7 @@
-       -mv -f y.tab.c $@
- 
- ftpd: $(OBJS)
--      $(CC) $(LDFLAGS) $^ $(LIBS) -o $@
-+      $(CC) $(LDFLAGS) $^ $(LIBS) $(LDADD) -o $@
- 
- install: ftpd
-       install -s -m$(DAEMONMODE) ftpd $(INSTALLROOT)$(SBINDIR)/in.ftpd
diff -Nru linux-ftpd-0.17/debian/patches/040-refine_config.diff 
linux-ftpd-0.17/debian/patches/040-refine_config.diff
--- linux-ftpd-0.17/debian/patches/040-refine_config.diff       2016-12-06 
15:39:49.000000000 +0100
+++ linux-ftpd-0.17/debian/patches/040-refine_config.diff       1970-01-01 
01:00:00.000000000 +0100
@@ -1,30 +0,0 @@
-Description: Do not link with libcrypt.
- The test for libcrypt is only needed in cases
- when USE_PAM is not set to active.
-Author: Mats Erik Andersson <[email protected]>
-Forwarded: no
-Last-Update: 2012-03-29
-
---- linux-ftpd-0.17.debian/configure
-+++ linux-ftpd-0.17/configure
-@@ -261,6 +261,11 @@
- 
- ##################################################
- 
-+# libcrypt is only needed in the absence of libpam.
-+
-+if test -z "$USE_PAM"; then
-+## Missing indentation in this clause!
-+
- echo -n 'Checking for crypt... '
- cat <<EOF >__conftest.c
- int main() { crypt("aa", "bb"); }
-@@ -285,6 +290,8 @@
- fi
- rm -f __conftest*
- 
-+fi    # test -z "$USE_PAM"
-+
- ##################################################
- 
- echo -n 'Checking for socklen_t... '
diff -Nru linux-ftpd-0.17/debian/patches/series 
linux-ftpd-0.17/debian/patches/series
--- linux-ftpd-0.17/debian/patches/series       2016-12-06 15:39:49.000000000 
+0100
+++ linux-ftpd-0.17/debian/patches/series       2019-02-24 11:07:58.000000000 
+0100
@@ -2,11 +2,11 @@
 002-from_sarge.diff
 003-from_etch.diff
 010-ftpd_csrf.diff
-014-adjust_infrastruct.diff
 016-family_independence.diff
 020-support_ipv6.diff
 024-failing_va_list.diff
 026-support_glibc_bsd_and_gnu.diff
 030-manpage_typos.diff
-040-refine_config.diff
 044-support_gnu_hurd.diff
+use-cmake-as-buildsystem.patch
+use-cmake-as-buildsystem-debian-extras.patch
diff -Nru 
linux-ftpd-0.17/debian/patches/use-cmake-as-buildsystem-debian-extras.patch 
linux-ftpd-0.17/debian/patches/use-cmake-as-buildsystem-debian-extras.patch
--- linux-ftpd-0.17/debian/patches/use-cmake-as-buildsystem-debian-extras.patch 
1970-01-01 01:00:00.000000000 +0100
+++ linux-ftpd-0.17/debian/patches/use-cmake-as-buildsystem-debian-extras.patch 
2019-02-24 14:28:26.000000000 +0100
@@ -0,0 +1,76 @@
+Description: Debian-specific changes to the cmake build system
+Author: Christoph Biedl <[email protected]>
+Forwarded: not-needed
+Last-Update: 2019-02-24
+
+--- a/ftpd/CMakeLists.txt
++++ b/ftpd/CMakeLists.txt
+@@ -1,4 +1,6 @@
+ 
++set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DHASSETPROCTITLE")
++
+ include_directories(
+     BEFORE
+     "../support/"
+@@ -6,7 +8,7 @@
+ )
+ 
+ add_executable(
+-    ftpd
++    in.ftpd
+     ftpd.c
+     logutmp.c
+     logwtmp.c
+@@ -15,12 +17,12 @@
+     ftpcmd.c
+ )
+ target_link_libraries(
+-    ftpd
++    in.ftpd
+     crypt
+     support
+ )
+ install(
+-    TARGETS ftpd
++    TARGETS in.ftpd
+     DESTINATION ${SBIN_DIR}
+ )
+ 
+@@ -31,6 +33,7 @@
+         yacc ${CMAKE_CURRENT_SOURCE_DIR}/ftpcmd.y
+     DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/ftpcmd.y
+ )
++
+ add_custom_command(
+     COMMENT "Creating ftpcmd.c"
+     OUTPUT ftpcmd.c
+@@ -45,12 +48,6 @@
+     DESTINATION ${MAN_DIR}/man8/
+     RENAME in.ftpd.8
+ )
+-install(
+-    CODE "execute_process( \
+-        COMMAND ${CMAKE_COMMAND} -E create_symlink \
+-        in.ftpd.8 \$ENV{DESTDIR}${MAN_DIR}/man8/ftpd.8 \
+-    )"
+-)
+ 
+ install(
+     FILES ftpusers.5
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -5,6 +5,14 @@
+ set(MAN_DIR "${CMAKE_INSTALL_PREFIX}/share/man")
+ 
+ find_library(USE_CRYPT crypt REQUIRED)
++find_library(USE_PAM pam)
++
++if(USE_PAM)
++    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DUSE_PAM=1")
++    set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lpam")
++endif()
++
++set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_FILE_OFFSET_BITS=64")
+ 
+ add_subdirectory(ftpd)
+ add_subdirectory(support)
diff -Nru linux-ftpd-0.17/debian/patches/use-cmake-as-buildsystem.patch 
linux-ftpd-0.17/debian/patches/use-cmake-as-buildsystem.patch
--- linux-ftpd-0.17/debian/patches/use-cmake-as-buildsystem.patch       
1970-01-01 01:00:00.000000000 +0100
+++ linux-ftpd-0.17/debian/patches/use-cmake-as-buildsystem.patch       
2019-02-24 14:28:26.000000000 +0100
@@ -0,0 +1,91 @@
+Description: Use cmake as build system
+Author: Christoph Biedl <[email protected]>
+Bug-Debian: https://bugs.debian.org/912122
+Last-Update: 2019-02-24
+
+--- /dev/null
++++ b/CMakeLists.txt
+@@ -0,0 +1,10 @@
++cmake_minimum_required(VERSION 3.7)
++project(linux-ftpd)
++
++set(SBIN_DIR "${CMAKE_INSTALL_PREFIX}/sbin")
++set(MAN_DIR "${CMAKE_INSTALL_PREFIX}/share/man")
++
++find_library(USE_CRYPT crypt REQUIRED)
++
++add_subdirectory(ftpd)
++add_subdirectory(support)
+--- /dev/null
++++ b/ftpd/CMakeLists.txt
+@@ -0,0 +1,58 @@
++
++include_directories(
++    BEFORE
++    "../support/"
++    ${CMAKE_CURRENT_SOURCE_DIR}
++)
++
++add_executable(
++    ftpd
++    ftpd.c
++    logutmp.c
++    logwtmp.c
++    popen.c
++    extern.h
++    ftpcmd.c
++)
++target_link_libraries(
++    ftpd
++    crypt
++    support
++)
++install(
++    TARGETS ftpd
++    DESTINATION ${SBIN_DIR}
++)
++
++add_custom_command(
++    COMMENT "Creating y.tab.c"
++    OUTPUT y.tab.c
++    COMMAND
++        yacc ${CMAKE_CURRENT_SOURCE_DIR}/ftpcmd.y
++    DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/ftpcmd.y
++)
++add_custom_command(
++    COMMENT "Creating ftpcmd.c"
++    OUTPUT ftpcmd.c
++    COMMAND
++        ${CMAKE_COMMAND} -E rename
++        y.tab.c ftpcmd.c
++    DEPENDS y.tab.c
++)
++
++install(
++    FILES ftpd.8
++    DESTINATION ${MAN_DIR}/man8/
++    RENAME in.ftpd.8
++)
++install(
++    CODE "execute_process( \
++        COMMAND ${CMAKE_COMMAND} -E create_symlink \
++        in.ftpd.8 \$ENV{DESTDIR}${MAN_DIR}/man8/ftpd.8 \
++    )"
++)
++
++install(
++    FILES ftpusers.5
++    DESTINATION ${MAN_DIR}/man5/
++)
+--- /dev/null
++++ b/support/CMakeLists.txt
+@@ -0,0 +1,9 @@
++
++set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DHASSETPROCTITLE")
++
++add_library(
++    support
++    isexpired.c
++    setproctitle.c
++    vis.c
++)
diff -Nru linux-ftpd-0.17/debian/rules linux-ftpd-0.17/debian/rules
--- linux-ftpd-0.17/debian/rules        2016-12-06 15:53:42.000000000 +0100
+++ linux-ftpd-0.17/debian/rules        2018-12-05 00:45:35.000000000 +0100
@@ -1,83 +1,4 @@
 #!/usr/bin/make -f
-# Sample debian/rules that uses debhelper. GNU copyright 1997 by Joey Hess.
 
-# Uncomment this to turn on verbose mode.
-#export DH_VERBOSE=1
-CDEFS := -D_FILE_OFFSET_BITS=64 -g
-LDDEFS := -Wl,-z,defs -Wl,--as-needed
-
-build: build-arch build-indep
-build-arch: build-stamp
-build-indep: build-stamp
-build-stamp:
-       dh_testdir
-
-       if [ ! -f MCONFIG ]; then \
-               USE_PAM=1 ./configure; \
-               sed -e 's/^CFLAGS=\(.*\)$$/CFLAGS=$(CDEFS) \1 
-fno-strict-aliasing/' \
-                   -e 's/^LDFLAGS=\(.*\)$$/LDFLAGS=$(LDDEFS) \1/' \
-                       MCONFIG > MCONFIG.new; \
-               mv MCONFIG.new MCONFIG; \
-               echo CFLAGS+=-DUSE_PAM=1 \
-                       `dpkg-buildflags --get CFLAGS`  -fPIE -pie \
-                       `dpkg-buildflags --get CPPFLAGS` >> MCONFIG; \
-               echo LIBS+=-lpam `dpkg-buildflags --get LDFLAGS` -Wl,-z,now >> 
MCONFIG; \
-       fi
-       $(MAKE)
-       touch build-stamp
-
-clean:
-       dh_testdir
-       dh_testroot
-       rm -f build-stamp
-       touch MCONFIG
-       [ ! -f Makefile ] || $(MAKE) distclean
-
-       dh_clean
-
-install: build
-       dh_testdir
-       dh_testroot
-       dh_prep
-       dh_installdirs
-
-       cp ftpd/ftpd debian/ftpd/usr/sbin/in.ftpd
-       cp ftpd/ftpd.8 debian/ftpd/usr/share/man/man8/in.ftpd.8
-       cp ftpd/*.5 debian/*.5 debian/ftpd/usr/share/man/man5
-       cp debian/ftpchroot debian/ftpusers debian/ftpd/etc
-       cp debian/pam.d/ftp debian/ftpd/etc/pam.d
-
-# Build architecture-independent files here.
-binary-indep: build install
-# We have nothing to do by default.
-
-# Build architecture-dependent files here.
-binary-arch: build install
-#      dh_testversion
-       dh_testdir
-       dh_testroot
-#      dh_installdebconf
-       dh_installdocs
-       dh_installexamples
-       dh_installmenu
-#      dh_installemacsen
-#      dh_installinit
-       dh_installcron
-#      dh_installmanpages
-#      dh_undocumented
-       dh_installchangelogs ChangeLog
-       dh_strip
-       dh_compress
-       dh_fixperms
-       dh_installdeb
-       dh_shlibdeps
-       dh_gencontrol
-#      dh_makeshlibs
-       dh_md5sums
-       dh_builddeb
-
-source diff:                                                                  
-       @echo >&2 'source and diff are obsolete - use dpkg-source -b'; false
-
-binary: binary-indep binary-arch
-.PHONY: build clean binary-indep binary-arch binary install
+%:
+       dh $@ --buildsystem=cmake

Reply via email to