Index: files/patch-Makefile-links.diff
===================================================================
--- files/patch-Makefile-links.diff	(révision 28880)
+++ files/patch-Makefile-links.diff	(copie de travail)
@@ -6,16 +6,16 @@
  	cp -f bzgrep $(PREFIX)/bin/bzgrep
 -	ln -s -f $(PREFIX)/bin/bzgrep $(PREFIX)/bin/bzegrep
 -	ln -s -f $(PREFIX)/bin/bzgrep $(PREFIX)/bin/bzfgrep
-+	ln -f $(PREFIX)/bin/bzgrep $(PREFIX)/bin/bzegrep
-+	ln -f $(PREFIX)/bin/bzgrep $(PREFIX)/bin/bzfgrep
++	(cd $(PREFIX)/bin; ln -s -f bzgrep bzegrep)
++	(cd $(PREFIX)/bin; ln -s -f bzgrep bzfgrep)
  	chmod a+x $(PREFIX)/bin/bzgrep
  	cp -f bzmore $(PREFIX)/bin/bzmore
 -	ln -s -f $(PREFIX)/bin/bzmore $(PREFIX)/bin/bzless
-+	ln -f $(PREFIX)/bin/bzmore $(PREFIX)/bin/bzless
++	(cd $(PREFIX)/bin; ln -s -f bzmore bzless)
  	chmod a+x $(PREFIX)/bin/bzmore
  	cp -f bzdiff $(PREFIX)/bin/bzdiff
 -	ln -s -f $(PREFIX)/bin/bzdiff $(PREFIX)/bin/bzcmp
-+	ln -f $(PREFIX)/bin/bzdiff $(PREFIX)/bin/bzcmp
++	(cd $(PREFIX)/bin; ln -s -f bzdiff bzcmp)
  	chmod a+x $(PREFIX)/bin/bzdiff
  	cp -f bzgrep.1 bzmore.1 bzdiff.1 $(PREFIX)/man/man1
  	chmod a+r $(PREFIX)/man/man1/bzgrep.1
Index: files/patch-Makefile-so.diff
===================================================================
--- files/patch-Makefile-so.diff	(révision 28880)
+++ files/patch-Makefile-so.diff	(copie de travail)
@@ -4,8 +4,8 @@
  
  # Suitably paranoid flags to avoid bugs in gcc-2.7
  BIGFILES=-D_FILE_OFFSET_BITS=64
--CFLAGS=-Wall -Winline -O2 -fomit-frame-pointer -fno-strength-reduce $(BIGFILES)
-+CFLAGS=-Wall -Winline -O2 -fPIC -fpic -fomit-frame-pointer -fno-strength-reduce $(BIGFILES)
+-CFLAGS=-Wall -Winline -O2 -g $(BIGFILES)
++CFLAGS=-Wall -Winline -O2 -g -fPIC -fpic $(BIGFILES)
  
  # Where you want it installed when you do 'make install'
  PREFIX=/usr
Index: files/patch-Makefile-man.diff
===================================================================
--- files/patch-Makefile-man.diff	(révision 28880)
+++ files/patch-Makefile-man.diff	(copie de travail)
@@ -1,47 +1,17 @@
---- Makefile.orig	Fri Jan 25 15:34:53 2002
-+++ Makefile	Tue Dec  9 07:16:30 2003
-@@ -60,8 +60,8 @@
- install: bzip2 bzip2recover
- 	if ( test ! -d $(PREFIX)/bin ) ; then mkdir -p $(PREFIX)/bin ; fi
- 	if ( test ! -d $(PREFIX)/lib ) ; then mkdir -p $(PREFIX)/lib ; fi
--	if ( test ! -d $(PREFIX)/man ) ; then mkdir -p $(PREFIX)/man ; fi
--	if ( test ! -d $(PREFIX)/man/man1 ) ; then mkdir -p $(PREFIX)/man/man1 ; fi
-+	if ( test ! -d $(PREFIX)/share/man ) ; then mkdir -p $(PREFIX)/share/man ; fi
-+	if ( test ! -d $(PREFIX)/share/man/man1 ) ; then mkdir -p $(PREFIX)/share/man/man1 ; fi
- 	if ( test ! -d $(PREFIX)/include ) ; then mkdir -p $(PREFIX)/include ; fi
- 	cp -f bzip2 $(PREFIX)/bin/bzip2
- 	cp -f bzip2 $(PREFIX)/bin/bunzip2
-@@ -71,8 +71,8 @@
- 	chmod a+x $(PREFIX)/bin/bunzip2
- 	chmod a+x $(PREFIX)/bin/bzcat
- 	chmod a+x $(PREFIX)/bin/bzip2recover
--	cp -f bzip2.1 $(PREFIX)/man/man1
--	chmod a+r $(PREFIX)/man/man1/bzip2.1
-+	cp -f bzip2.1 $(PREFIX)/share/man/man1
-+	chmod a+r $(PREFIX)/share/man/man1/bzip2.1
- 	cp -f bzlib.h $(PREFIX)/include
- 	chmod a+r $(PREFIX)/include/bzlib.h
- 	cp -f libbz2.a $(PREFIX)/lib
-@@ -87,14 +87,14 @@
- 	cp -f bzdiff $(PREFIX)/bin/bzdiff
- 	ln $(PREFIX)/bin/bzdiff $(PREFIX)/bin/bzcmp
- 	chmod a+x $(PREFIX)/bin/bzdiff
--	cp -f bzgrep.1 bzmore.1 bzdiff.1 $(PREFIX)/man/man1
--	chmod a+r $(PREFIX)/man/man1/bzgrep.1
--	chmod a+r $(PREFIX)/man/man1/bzmore.1
--	chmod a+r $(PREFIX)/man/man1/bzdiff.1
+--- Makefile.orig	2007-08-30 02:40:10.000000000 +0200
++++ Makefile	2007-08-30 02:48:20.000000000 +0200
+@@ -103,10 +103,10 @@
+ 	chmod a+r $(PREFIX)/man/man1/bzgrep.1
+ 	chmod a+r $(PREFIX)/man/man1/bzmore.1
+ 	chmod a+r $(PREFIX)/man/man1/bzdiff.1
 -	echo ".so man1/bzgrep.1" > $(PREFIX)/man/man1/bzegrep.1
 -	echo ".so man1/bzgrep.1" > $(PREFIX)/man/man1/bzfgrep.1
 -	echo ".so man1/bzmore.1" > $(PREFIX)/man/man1/bzless.1
 -	echo ".so man1/bzdiff.1" > $(PREFIX)/man/man1/bzcmp.1
-+	cp -f bzgrep.1 bzmore.1 bzdiff.1 $(PREFIX)/share/man/man1
-+	chmod a+r $(PREFIX)/share/man/man1/bzgrep.1
-+	chmod a+r $(PREFIX)/share/man/man1/bzmore.1
-+	chmod a+r $(PREFIX)/share/man/man1/bzdiff.1
-+	echo ".so man1/bzgrep.1" > $(PREFIX)/share/man/man1/bzegrep.1
-+	echo ".so man1/bzgrep.1" > $(PREFIX)/share/man/man1/bzfgrep.1
-+	echo ".so man1/bzmore.1" > $(PREFIX)/share/man/man1/bzless.1
-+	echo ".so man1/bzdiff.1" > $(PREFIX)/share/man/man1/bzcmp.1
++	(cd $(PREFIX)/man/man1; ln -s -f bzgrep.1 bzegrep.1)
++	(cd $(PREFIX)/man/man1; ln -s -f bzgrep.1 bzfgrep.1)
++	(cd $(PREFIX)/man/man1; ln -s -f bzmore.1 bzless.1)
++	(cd $(PREFIX)/man/man1; ln -s -f bzdiff.1 bzcmp.1)
  
- distclean: clean
  clean: 
+ 	rm -f *.o libbz2.a bzip2 bzip2recover \
Index: Portfile
===================================================================
--- Portfile	(révision 28880)
+++ Portfile	(copie de travail)
@@ -1,36 +1,39 @@
 # $Id$
 
-PortSystem 1.0
+PortSystem      1.0
+
 name            bzip2
 version         1.0.4
-revision        1
+revision        2
 platforms       darwin freebsd linux sunos
 categories      sysutils archivers
-maintainers     ryandesign openmaintainer@macports.org
+maintainers     ryandesign openmaintainer
 description     bzip2 compression library and tools
 
 homepage        http://www.bzip.org/
-master_sites    http://www.bzip.org/${version}/
+master_sites    ${homepage}${version}/
+
 checksums       md5 fc310b254f6ba5fbb5da018f04533688 \
                 sha1 f2388ec8f2c506e02aa89e67577b3c6331cbaa4c \
                 rmd160 438365cb911ef84b3bd6643e0d39f6b7567f0447
+
 patchfiles      patch-Makefile-man.diff \
                 patch-Makefile-links.diff
 
-platform darwin {
-	patchfiles-append		patch-Makefile-dylib.diff
-}
-
-platform freebsd {
-	patchfiles-append		patch-Makefile-so.diff
+post-patch {
+    reinplace -E "/\\/bin\\//s/ln -s -f/ln -f/" ${worksrcpath}/Makefile
+    reinplace "s|\\\$(PREFIX)/man|\$(PREFIX)/share/man|g" ${worksrcpath}/Makefile
+    reinplace -E "/^all:/s/test//" ${worksrcpath}/Makefile
 }
 
-platform linux {
-	patchfiles-append		patch-Makefile-so.diff
+platform darwin {
+    patchfiles-append   patch-Makefile-dylib.diff
 }
 
-platform sunos {
-	patchfiles-append		patch-Makefile-so.diff
+foreach {platform} {freebsd linux sunos} {
+    platform ${platform} {
+        patchfiles-append   patch-Makefile-so.diff
+    }
 }
 
 platform darwin 7 {
@@ -39,9 +42,17 @@
 
 use_configure       no
 build.args          PREFIX="${prefix}"
-destroot.destdir    PREFIX="${destroot}/${prefix}"
+destroot.destdir    PREFIX="${destroot}${prefix}"
+test.run            yes
+
+post-destroot {
+    set docdir ${prefix}/share/doc/${name}-${version}
+    xinstall -d ${destroot}${docdir}
+    xinstall -m 0644 -W ${worksrcpath} CHANGES LICENSE README ${destroot}${docdir}
+}
 
 variant universal { 
 	build.args-append \
 		CC="gcc ${configure.universal_cflags}" 
 }
+
