Ticket #39018: Portfile.3

File Portfile.3, 6.7 KB (added by cooljeanius (Eric Gallager), 10 years ago)

my latest Portfile for dpkg

Line 
1# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
2# $Id: Portfile 105815 2013-05-06 14:52:20Z landonf@macports.org $
3
4PortSystem          1.0
5
6name                dpkg
7version             1.16.12
8revision            0
9platforms           darwin freebsd
10categories          sysutils archivers
11license             GPL-2+
12maintainers         gwmail.gwu.edu:egall openmaintainer
13description         Debian package maintenance system
14long_description    ${name} is the basis of the ${description}. \
15                    Installing this port allows the usage of the \
16                    \`port dpkg\` command.
17
18homepage            http://wiki.debian.org/Teams/Dpkg
19
20master_sites        debian:d/${name}/
21checksums           md5     b7e9cac52ff7882b088a3058b52081b5 \
22                    sha1    5969bb7f30ade840a56f512571ca5ab56d434af1 \
23                    rmd160  1912afd35b835901e661d2c0df563198de4e8420 \
24                    sha256  af96447758ecbfda51fc57d4b3bc3d208ad6393e71b91c9b52c6687697a208da
25
26use_xz              yes
27extract.asroot      yes
28
29depends_build-append \
30                    port:pkgconfig \
31                    port:autoconf-archive \
32                    port:xorg-util-macros \
33                    port:gnutar \
34                    port:perl5 \
35                    bin:git:git-core \
36                    bin:lzma:xz
37
38# Use MacPorts versions explicitly
39depends_lib-append  port:gettext \
40                    port:libiconv \
41                    port:perl5 \
42                    port:coreutils \
43                    port:bzip2 \
44                    port:zlib \
45                    port:ncurses \
46                    port:gnutar \
47                    path:lib/pkgconfig/liblzma.pc:xz
48
49depends_run-append  port:gnutar \
50                    bin:lzma:xz \
51                    bin:perl:perl5 \
52                    port:debianutils
53
54# got to do some underscore-to-hyphen twiddling...
55distname            ${name}_${version}
56worksrcdir          ${name}-${version}
57
58configure.perl      ${prefix}/bin/perl5
59configure.pkg_config ${prefix}/bin/pkg-config
60configure.env-append TAR=${prefix}/bin/gnutar
61configure.args-append \
62                    --with-libintl-prefix=${prefix} \
63                    --with-libiconv-prefix=${prefix} \
64                    --with-admindir=${prefix}/var/db/${name} \
65                    --with-logdir=${prefix}/var/log \
66                    --mandir=${prefix}/share/man \
67                    --with-zlib \
68                    --with-bz2 \
69                    --with-liblzma \
70                    --disable-linker-optimisations \
71                    --disable-silent-rules \
72                    --disable-start-stop-daemon
73# The start-stop-daemon patch now applies again, but now it leads to build
74# errors, so disabling it with a configure flag again (as done above)
75
76# ccache is trouble
77configure.ccache          no
78
79# Older versions of gcc choke with the -Wvla warning flag
80configure.cflags-delete   -Wvla
81configure.cppflags-delete -Wvla
82configure.ldflags-delete  -Wvla
83
84post-configure {
85    reinplace "s|-Wvla||" ${worksrcpath}/Makefile
86    eval reinplace "s|-Wvla||" [glob ${worksrcpath}/*/Makefile]
87    eval reinplace "s|-Wvla||" [glob ${worksrcpath}/lib/*/Makefile]
88    reinplace "s|-Wvla||" ${worksrcpath}/lib/dpkg/test/Makefile
89    reinplace "s|-Wmissing-declarations||" ${worksrcpath}/dselect/Makefile
90}
91
92compiler.blacklist-append cc gcc-3.3 gcc-4.0 apple-gcc-4.0
93
94build.type          gnu
95
96set vardpkg ${destroot}${prefix}/var/db/${name}
97destroot.keepdirs-append \
98                    ${vardpkg} \
99                    ${vardpkg}/updates \
100                    ${vardpkg}/info \
101                    ${destroot}${prefix}/var/log \
102                    ${destroot}${prefix}/etc/${name}
103
104patchfiles-append   patch-configure.ac.diff \
105                    patch-lib_dpkg_dpkg.h.diff \
106                    patch-lib_dpkg_tarfn.c.diff \
107                    patch-src_remove.c.diff \
108                    patch-src_archives.c.diff \
109                    patch-utils_start-stop-daemon.c.diff
110
111patch.args-append   --backup
112
113post-patch {
114    set scripts ${worksrcpath}/scripts
115    reinplace "s|/etc/${name}/|${prefix}/etc/${name}/|" \
116            ${scripts}/${name}-shlibdeps.pl \
117            ${scripts}/${name}-source.pl
118    reinplace "s|AC_ERROR|AC_MSG_ERROR|" ${worksrcpath}/m4/dpkg-build.m4
119    file copy ${prefix}/share/aclocal/ax_check_gnu_make.m4 ${worksrcpath}/m4
120    file copy ${prefix}/share/aclocal/xorg-macros.m4 ${worksrcpath}/m4
121    system -W ${worksrcpath} "git init"
122}
123
124use_autoreconf      yes
125autoreconf.args     -fvi --warnings=all
126
127pre-destroot {
128    file mkdir ${destroot}${prefix}/share/doc/${name}
129}
130
131post-destroot {
132    file mkdir ${vardpkg}
133    file mkdir ${vardpkg}/updates
134    file mkdir ${vardpkg}/info
135    system "touch ${vardpkg}/available ${vardpkg}/status"
136}
137
138# These platform variants had previously had patches associated
139# with them...
140platform darwin {
141    depends_build-append    bin:gnumake:gmake
142}
143
144platform freebsd {
145    depends_build-append    bin:gmake:gmake
146}
147
148# This variant sometimes hangs while building...
149variant docs description {Build documentation (warning: building documentation takes a long time)} {
150    depends_build-append    port:doxygen \
151                            path:bin/dot:graphviz \
152                            port:fontconfig \
153                            port:freefont-ttf
154    set docdir ${prefix}/share/doc/${name}
155    configure.args-append   --docdir=${docdir} \
156                            --htmldir=${docdir}/html \
157                            --dvidir=${docdir}/dvi \
158                            --pdfdir=${docdir}/pdf \
159                            --psdir=${docdir}/ps
160    build.target-append     doc
161    pre-build {
162        elevateToRoot "doxygen"
163        system -W ${worksrcpath}/doc "${prefix}/bin/doxygen -u"
164    }
165    post-build {
166        system -W ${worksrcpath}/doc "${prefix}/bin/doxygen"
167        dropPrivileges
168        set destroot_docdir ${destroot}${prefix}/share/doc/${name}
169        xinstall -d ${destroot_docdir}
170        copy ${worksrcpath}/doc/doc ${destroot_docdir}
171        copy ${worksrcpath}/doc/html ${destroot_docdir}
172        foreach docfile {coding-style.txt triggers.txt README.feature-removal-schedule frontend.txt README.api} {
173            xinstall -m 644 ${worksrcpath}/doc/${docfile} ${destroot_docdir}
174        }
175    }
176}
177
178# Tests currently fail, this needs to be fixed eventually:
179test.run            yes
180test.target         check
181
182pre-test {
183    elevateToRoot "test"
184}
185post-test {
186    dropPrivileges
187}
188
189# odd-numbered releases are unstable, so ignore them
190livecheck.type      none
191livecheck.url       http://ftp.debian.org/debian/pool/main/d/${name}/
192livecheck.regex     "${name}_(\\d+\\.\\d+(\\.\\d+)*)"