Bug 208994 - archivers/paq is broken
Summary: archivers/paq is broken
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-ports-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-04-23 12:22 UTC by Anton Saietskii
Modified: 2016-08-19 05:08 UTC (History)
3 users (show)

See Also:
bugzilla: maintainer-feedback? (bf)


Attachments
set correct filename for patch and thus fix build (4.62 KB, patch)
2016-04-23 14:35 UTC, Anton Saietskii
no flags Details | Diff
set correct filename for patch and thus fix build when DOCS disabled (5.18 KB, patch)
2016-05-04 10:13 UTC, Anton Saietskii
vsasjason: maintainer-approval?
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Anton Saietskii 2016-04-23 12:22:08 UTC
It fails on including windows.h - obviously, FreeBSD doesn't have this header.

c++: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated
zpsfx.cpp:47:10: fatal error: 'windows.h' file not found
#include <windows.h>
         ^
1 error generated.
*** Error code 1

Stop.
make[1]: stopped in /usr/ports/archivers/paq
*** Error code 1

Stop.
make: stopped in /usr/ports/archivers/paq
Comment 1 w.schwarzenfeld 2016-04-23 14:19:43 UTC
Which FreeBSD version and platform? Compiles on 10.2-RELEASE amd64 fine.

Should not include windows.h on Unix:
look at  files/patch_zpsfx.cpp:
.....
 #include <stdio.h>
 #include <stdlib.h>
 #include <string>
+#ifdef unix
+#include <sys/stat.h>
+#else
 #include <windows.h>
+#endif
,,,,

Does the patch exist or is it a Mac?
Comment 2 Anton Saietskii 2016-04-23 14:25:29 UTC
(In reply to w.schwarzenfeld from comment #1)

root@cs0:/usr/ports/archivers/paq# svn up
Updating '.':
At revision 413875.
root@cs0:/usr/ports/archivers/paq# svn info
Path: .
Working Copy Root Path: /usr/ports
URL: https://svn.freebsd.org/ports/head/archivers/paq
Relative URL: ^/head/archivers/paq
Repository Root: https://svn.freebsd.org/ports
Repository UUID: 35697150-7ecd-e111-bb59-0022644237b5
Revision: 413875
Node Kind: directory
Schedule: normal
Last Changed Author: mat
Last Changed Rev: 400848
Last Changed Date: 2015-11-05 15:36:25 +0300 (чт, 05 ноя 2015)

root@cs0:/usr/ports/archivers/paq# svn diff
root@cs0:/usr/ports/archivers/paq# cat files/patch_zpsfx.cpp
--- zpsfx.cpp.orig      2012-04-09 04:01:23.000000000 -0400
+++ zpsfx.cpp   2012-04-09 04:02:25.000000000 -0400
@@ -16,19 +16,38 @@
 the executable smaller. -DNDEBUG turns off run time checks.
 To convert a ZPAQ archive to a self extracting archive:

+On Windows:
+
   copy/b zpsfx.exe+zpsfx.tag+archive.zpaq archive.exe

+On FreeBSD(the choice of archive name is discretionary):
+
+  cat zpsfx zpsfx.tag archive.zpaq > archive.sfx
+
 zpsfx.tag is a 13 byte file used to mark the start of the compressed data
 that is appended. Alternatively, zpaq with the "t" modifier will append
 the same tag ("a" appends).

+On Windows:
+
   copy zpsfx.exe archive.exe
   zpaq ta archive.exe files...

+On FreeBSD:
+
+  cp zpsfx archive.sfx
+  zpaq ta archive.sfx files...
+
 To extract:

+On Windows:
+
   archive.exe

+On FreeBSD:
+
+  archive.sfx
+
 The program reads itself and decompresses the appended archive.
 You must enter the .exe extension as shown. If the file is not in
 the current folder then you need to specify the path. The PATH environment
@@ -44,7 +63,11 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string>
+#ifdef unix
+#include <sys/stat.h>
+#else
 #include <windows.h>
+#endif

 // An error handler is required as shown in this example. libzpaq will
 // call it with an English language message in case of a fatal error.
@@ -96,7 +119,11 @@

 // Return '/' in Linux or '\' in Windows
 char slash() {
+#ifdef unix
+  return '/';
+#else
   return '\\';
+#endif
 }

 // Create directories as needed. For example if path="/tmp/foo/bar"
@@ -106,7 +133,11 @@
   for (int i=0; i<path.size(); ++i) {
     if (path[i]=='\\' || path[i]=='/') {
       path[i]=0;
+#ifdef unix
+      int ok=!mkdir(path.c_str(), 0777);
+#else
       int ok=CreateDirectory(path.c_str(), 0);
+#endif
       path[i]=slash();
     }
   }
root@cs0:/usr/ports/archivers/paq# freebsd-version -ku
10.3-RELEASE
10.3-RELEASE
root@cs0:/usr/ports/archivers/paq#

I think that patch isn't applied.
Comment 3 Anton Saietskii 2016-04-23 14:35:28 UTC
Created attachment 169600 [details]
set correct filename for patch and thus fix build

Fixed build - patch filename was incorrect.
Comment 4 Walter Schwarzenfeld freebsd_triage 2016-04-23 14:52:50 UTC
I  think it is more simple to change the following line in the Makefile
on 10.2 the line is
EXTRA_PATCHES+= ${FILESDIR}/patch_zpsfx.cpp
Comment 5 Anton Saietskii 2016-05-04 10:08:36 UTC
(In reply to w.schwarzenfeld from comment #4)

No:

.if ${PORT_OPTIONS:MDOCS}
PORTDOCS+=	bwt_.cpp bwtpre.cpp bwtrle.cpp divsufsort.c divsufsort.h \
		exe_jo.cpp jpeg_jo.cpp lzpre.cpp lzppre.cpp readme_bwt.txt \
		readme_bwt_j3.txt readme_exe_j1.txt readme_lazy210.txt zpsfx.cpp
READMES+=	bwt_j3 exe_j1 lazy210
EXTRA_PATCHES+=	${FILESDIR}/patch_zpsfx.cpp
.endif

Why patch SFX module only when DOCS option enabled? It's a nonsense.
Comment 6 Anton Saietskii 2016-05-04 10:13:30 UTC
Created attachment 169954 [details]
set correct filename for patch and thus fix build when DOCS disabled

Attached revised patch. SFX module should be patched unconditionally, without dependency on port's DOCS option.
Comment 7 Anton Saietskii 2016-06-18 15:27:25 UTC
NOTE: maintainer timeout was hit.
Comment 8 Rene Ladan freebsd_committer 2016-06-27 21:40:06 UTC
Maintainer reset.
Comment 9 commit-hook freebsd_committer 2016-08-19 05:07:41 UTC
A commit references this bug:

Author: marino
Date: Fri Aug 19 05:07:21 UTC 2016
New revision: 420447
URL: https://svnweb.freebsd.org/changeset/ports/420447

Log:
  archivers/paq: Fix when DOCS option is OFF

  No revbump necessary as the port would always fail to build if DOCS
  option was disabled.

  PR:		208994
  Submitted by:	Anton Sayetsky

Changes:
  head/archivers/paq/Makefile
  head/archivers/paq/files/patch-zpsfx.cpp
  head/archivers/paq/files/patch_zpsfx.cpp
Comment 10 John Marino freebsd_committer 2016-08-19 05:08:06 UTC
Thanks!