Ticket #64613: Portfile

File Portfile, 4.9 KB (added by ballapete (Peter "Pete" Dyballa), 3 years ago)

Corected version of Portfile

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
3PortSystem              1.0
4PortGroup               legacysupport 1.0
5PortGroup               cmake 1.1
6
7name                    clamav-legacy
8set realname            clamav
9conflicts               clamav clamav-server
10version                 0.104.2
11revision                1
12categories              sysutils
13maintainers             {Peter_Dyballa@Web.DE}
14description             clamav anti-virus software adapted to old macs
15license                 {GPL-2 OpenSSLException}
16
17long_description        Clam AntiVirus is a GPL anti-virus toolkit for UNIX. The \
18                        main purpose of this software is the integration with mail \
19                        servers (attachment scanning). This Port supports old Macs \
20                        with Mac OS X 10.410.6 (Tiger, Leopard, Snow Leopard)
21
22homepage                https://www.clamav.net
23master_sites            https://www.clamav.net/downloads
24distname                ${realname}-${version}
25
26checksums               rmd160  62915fde0cb4d659bb4c77ca2278560e7b141bda \
27                        sha256  3e45e46d9aaeb3a6956ed30376237ab7c4cd9573bc0f5d6fc15c588d30978d9d \
28                        size    11950409
29
30platforms               darwin
31supported_archs         i386 ppc ppc64 x86_64
32use_xcode               no
33use_parallel_build      yes
34
35compiler.cxx_standard       2014
36configure.cxxflags-append   -std=c++14
37
38# Disable tests to avoid extra dependencies
39configure.args-append   -DENABLE_TESTS=OFF
40
41depends_build-append    port:pkgconfig
42
43depends_lib             port:openssl3 \
44                        port:zlib \
45                        port:bzip2 \
46                        port:libxml2 \
47                        port:pcre2 \
48                        port:libiconv \
49                        port:json-c \
50                        port:ncurses \
51                        port:curl \
52                        port:libtool
53
54if {${os.major} > 10} { # Lion and more modern
55    pre-fetch {
56        ui_error "$name is made for Mac OS X 10.4 through 10.7 to support the old systems."
57        error "Your OS version is not supported."
58    }
59}
60
61## older systems support
62post-extract {
63    if { ${os.platform} eq "darwin" && ${os.major} < 11 } {
64
65        # use linux version of openssl cert util on systems < 10.7 that don't support the macOS version
66        # ./common/linux/cert_util_linux.c -> ./common/mac/cert_util_mac.m
67        # passes all tests. See: https://trac.macports.org/ticket/59168
68
69        ui_msg  "Replacing the port's Mac security with plain Linux security"
70        delete  ${worksrcpath}/common/mac/cert_util_mac.m
71        copy    ${worksrcpath}/common/linux/cert_util_linux.c \
72                ${worksrcpath}/common/mac/cert_util_mac.m
73    }
74}
75
76platform darwin 8 {     # Tiger, Mac OS X 10.4, uname -r
77        configure.args-append   -DOPTIMIZE=OFF
78        patchfiles              libclamav-others_common.c-O_SYMLINK@Tiger.patch
79}
80
81pre-test {
82    if {![variant_isset tests]} {
83        ui_error "'tests' variant must be activated to enable test support"
84        error "Please enable the 'tests' variant, choose a suitable Python version,"
85        error "install and select the matching version of 'pytest' and try again!"
86    }
87}
88
89variant tests description {Enable running 'port test'} {
90    ui_msg "Tests run use the installed version of this port somehow."
91    ui_msg "(If no version of ClamAV is installed most test will fail.)"
92    depends_build-append        port:check
93
94    configure.args-delete       -DENABLE_TESTS=OFF
95#
96    # CMake problem with RPATH: https://github.com/macports/macports-ports/blob/fdc80cd761af072aa4ec52f0a5082f8c0c5135de/_resources/port1.0/group/cmake-1.1.tcl#L105
97# The following statement does not seem to have an effect on build…
98    configure.pre_args-replace  -DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=ON \
99                                -DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=OFF
100# so instead the following statement should do the job (but does not cure) – except "CMAKE_BUILD_WITH_INSTALL_RPATH" is universal?
101## Remove recording of RPATH for the tests, otherwise they will fail?
102#       reinplace "s/CMAKE_MACOSX_RPATH 1/CMAKE_MACOSX_RPATH 0/"    ${worksrcpath}/CMakeLists.txt
103
104## Meant for debugging the failing tests:
105##   Set these to see the C header files and shared libraries used during build (takes 3–4 times more time)
106##   Commands: egrep '^\.‘ | awk '{ print $NF }' | egrep '\.h$' | sort -u
107##             egrep '^[/\.].*dylib‘ | grep -v clang | sort -u
108#    configure.cflags-append     "-H"
109#    configure.ldflags-append    "-Wl,-t"
110
111    test.run yes
112#    test.cmd ctest
113#    test.target --rerun-failed --output-on-failure
114
115#    test.cmd make
116#    test.target test
117#    test.target check
118#   Either use 'make' above and define a target or use 'ctest':
119    test.cmd ctest
120    test.args -V
121    test.target
122}