Revision
105499
Author
ryandesign@macports.org
Date
2013-04-22 15:52:40 -0700 (Mon, 22 Apr 2013)

Log Message

file: separate libmagic into a subport (#38888)

Modified Paths

Diff

Modified: trunk/dports/sysutils/file/Portfile (105498 => 105499)


--- trunk/dports/sysutils/file/Portfile	2013-04-22 22:19:20 UTC (rev 105498)
+++ trunk/dports/sysutils/file/Portfile	2013-04-22 22:52:40 UTC (rev 105499)
@@ -5,6 +5,7 @@
 
 name                file
 version             5.14
+revision            1
 categories          sysutils
 license             BSD
 maintainers         nomaintainer
@@ -43,6 +44,34 @@
 use_autoreconf      yes
 autoreconf.args     -fvi
 
-livecheck.type      regex
-livecheck.url       ftp://ftp.astron.com/pub/${name}/
-livecheck.regex     "${name}-(\\d+(?:\\.\\d+)*)${extract.suffix}"
+if {${name} == ${subport}} {
+    depends_lib-append port:libmagic
+    
+    destroot {
+        xinstall -W ${worksrcpath}/src/.libs file ${destroot}${prefix}/bin
+        xinstall -m 644 -W ${worksrcpath}/doc file.1 ${destroot}${prefix}/share/man/man1
+    }
+    
+    livecheck.type      regex
+    livecheck.url       ftp://ftp.astron.com/pub/${name}/
+    livecheck.regex     ${name}-(\\d+(?:\\.\\d+)*)${extract.suffix}
+} else {
+    livecheck.type      none
+}
+
+subport libmagic {
+    post-destroot {
+        delete ${destroot}${prefix}/bin/file ${destroot}${prefix}/share/man/man1/file.1
+    }
+    
+    pre-activate {
+        # file @5.14_0 and earlier installed some files now provided by libmagic
+        if {![catch {set installed [lindex [registry_active file] 0]}]} {
+            set file_version [lindex ${installed} 1]
+            set file_revision [lindex ${installed} 2]
+            if {[vercmp ${file_version} 5.14] < 0 || ([vercmp ${file_version} 5.14] == 0 && ${file_revision} < 1)} {
+                registry_deactivate_composite file "" [list ports_nodepcheck 1]
+            }
+        }
+    }
+}