Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 26 Nov 2009 16:23:42 GMT
From:      Eugene Perevyazko <john@dnepro.net>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   ports/140903: [patch] archivers/p7zip add option to build minimal possible executable supporting only 7zip archives
Message-ID:  <200911261623.nAQGNghg061512@www.freebsd.org>
Resent-Message-ID: <200911261630.nAQGU4PX039907@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         140903
>Category:       ports
>Synopsis:       [patch] archivers/p7zip add option to build minimal possible executable supporting only 7zip archives
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Thu Nov 26 16:30:03 UTC 2009
>Closed-Date:
>Last-Modified:
>Originator:     Eugene Perevyazko
>Release:        7.2
>Organization:
-
>Environment:
FreeBSD klinger 7.2-RELEASE FreeBSD 7.2-RELEASE #0: Fri May  1 08:49:13 UTC 2009     root@walker.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC  i386

>Description:
  In many cases current 7z/7za executable is an overkill with it's ability to handle tar, gzip and other file formats, because there exist native tools for this.
  This patch adds an option to allow build only 7zr executable which is the smallest and supports only 7zip file format.
>How-To-Repeat:

>Fix:


Patch attached with submission follows:

diff -ruN p7zip/Makefile p7zip.my/Makefile
--- p7zip/Makefile	2009-09-30 23:35:33.000000000 +0300
+++ p7zip.my/Makefile	2009-11-26 18:05:15.000000000 +0200
@@ -13,21 +13,45 @@
 
 MAINTAINER=	nox@FreeBSD.org
 COMMENT=	File archiver with high compression ratio
+OPTIONS=	MINIMAL	"Support only .7z file format" off
 
 USE_BZIP2=	yes
 MAKEFILE=	makefile
 WRKSRC=		${WRKDIR}/${PORTNAME}_${PORTVERSION}
-MAN1=		7z.1 7za.1 7zr.1 p7zip.1
 MAKE_JOBS_UNSAFE=	yes
 
-DLLDIR=		${PREFIX}/libexec/p7zip
-PLIST_SUB=	MODULES=""
-ALL_TARGET=	7z 7za 7zr Client7z sfx
-7ZBIN=		7z 7za 7zr Client7z 7zCon.sfx
-.if defined(WITHOUT_MODULES)
+.include <bsd.port.options.mk>
+
+.if defined(WITH_MINIMAL)
+MAN1=		7zr.1
+MLINKS=		7zr.1 7z.1
 PLIST_SUB=	MODULES="@comment "
+ALL_TARGET=	7zr
+7ZBIN=		7zr
+PLIST_FILES=	bin/7zr \
+		bin/7z
+.else
+MAN1=		7z.1 7za.1 7zr.1 p7zip.1
+DLLDIR=		${PREFIX}/libexec/p7zip
 ALL_TARGET=	7za 7zr sfx
 7ZBIN=		7za 7zr 7zCon.sfx
+PLIST_DIRS=	libexec/p7zip
+PLIST_FILES=	bin/7z \
+		bin/7za \
+		bin/7zr \
+		bin/p7zip \
+		libexec/p7zip/7za \
+		libexec/p7zip/7zr \
+		libexec/p7zip/7zCon.sfx
+.if !defined(WITHOUT_MODULES)
+ALL_TARGET=	7z 7za 7zr Client7z sfx
+7ZBIN=		7z 7za 7zr Client7z 7zCon.sfx
+PLIST_DIRS+=	libexec/p7zip/Codecs
+PLIST_FILES+=	libexec/p7zip/7z \
+		libexec/p7zip/7z.so \
+		libexec/p7zip/Client7z \
+		libexec/p7zip/Codecs/Rar29.so
+.endif
 .endif
 
 .include <bsd.port.pre.mk>
@@ -51,6 +75,10 @@
 	${MV} ${WRKSRC}/contrib/gzip-like_CLI_wrapper_for_7z/man1/p7zip.1 ${WRKSRC}/man1/
 
 do-install:
+.if defined(WITH_MINIMAL)
+	cd ${WRKSRC}/bin/&&${INSTALL_PROGRAM} ${7ZBIN} ${PREFIX}/bin/
+	${LN} -sf ${PREFIX}/bin/7zr ${PREFIX}/bin/7z
+.else
 	${INSTALL} -d ${DLLDIR}/
 	cd ${WRKSRC}/bin/&&${INSTALL_PROGRAM} ${7ZBIN} ${DLLDIR}/
 	${INSTALL_SCRIPT} ${FILESDIR}/7z ${PREFIX}/bin/
@@ -62,6 +90,7 @@
 	${INSTALL_PROGRAM} ${WRKSRC}/bin/Codecs/Rar29.so ${DLLDIR}/Codecs/
 	${INSTALL_PROGRAM} ${WRKSRC}/bin/7z.so ${DLLDIR}/
 .endif
+.endif
 .if !defined(NOPORTDOCS)
 	@cd ${WRKSRC}/DOCS/&&${COPYTREE_SHARE} . ${DOCSDIR}/
 .endif
diff -ruN p7zip/pkg-plist p7zip.my/pkg-plist
--- p7zip/pkg-plist	2007-12-15 22:01:49.000000000 +0200
+++ p7zip.my/pkg-plist	2009-11-26 17:23:46.000000000 +0200
@@ -1,16 +1,3 @@
-bin/7z
-bin/7za
-bin/7zr
-bin/p7zip
-%%MODULES%%libexec/p7zip/7z
-%%MODULES%%libexec/p7zip/7z.so
-%%MODULES%%libexec/p7zip/Client7z
-libexec/p7zip/7za
-libexec/p7zip/7zr
-libexec/p7zip/7zCon.sfx
-%%MODULES%%libexec/p7zip/Codecs/Rar29.so
-%%MODULES%%@dirrm libexec/p7zip/Codecs
-@dirrm libexec/p7zip
 %%PORTDOCS%%%%DOCSDIR%%/7zC.txt
 %%PORTDOCS%%%%DOCSDIR%%/7zFormat.txt
 %%PORTDOCS%%%%DOCSDIR%%/License.txt


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200911261623.nAQGNghg061512>