49 | | xinstall -m 0644 -W ${worksrcpath} ChangeLog FAQ README zlib.3.pdf ${destroot}${docdir} |
50 | | |
51 | | set examplesdir ${prefix}/share/examples/${name} |
52 | | xinstall -d ${destroot}${examplesdir} |
53 | | xinstall -m 0644 {*}[glob ${worksrcpath}/example{.c,s/*}] ${destroot}${examplesdir} |
| 54 | if {[variant_isset ng]} { |
| 55 | xinstall -m 0644 -W ${worksrcpath} ChangeLog.zlib README.md README.zlib zlib.3.pdf ${destroot}${docdir} |
| 56 | } else { |
| 57 | xinstall -m 0644 -W ${worksrcpath} ChangeLog FAQ README zlib.3.pdf ${destroot}${docdir} |
| 58 | set examplesdir ${prefix}/share/examples/${name} |
| 59 | xinstall -d ${destroot}${examplesdir} |
| 60 | xinstall -m 0644 {*}[glob ${worksrcpath}/example{.c,s/*}] ${destroot}${examplesdir} |
| 61 | } |
| 62 | } |
| 63 | |
| 64 | variant ng conflicts cloudflare description {provides the "Next Generation" zlib-ng project} {} |
| 65 | if {[variant_isset ng]} { |
| 66 | PortGroup github 1.0 |
| 67 | PortGroup cmake 1.1 |
| 68 | PortGroup muniversal 1.0 |
| 69 | long_description-append This variant provides the "Next Generation" zlib-ng library. |
| 70 | git.branch 75e76eebeb08dccea44a1d9933699f7f9a0a97ea |
| 71 | github.setup Dead2 zlib-ng ${git.branch} |
| 72 | fetch.type git |
| 73 | name zlib |
| 74 | version 1.2.11 |
| 75 | supported_archs i386 x86_64 |
| 76 | distname zlib-ng |
| 77 | worksrcdir ${distname} |
| 78 | depends_build port:cpuid |
| 79 | patch.pre_args -Np1 |
| 80 | patchfiles ng/patch-cmakelists.diff \ |
| 81 | ng/patch-zlib-compat.diff |
| 82 | configure.args-append \ |
| 83 | -DZLIB_COMPAT:BOOL=ON \ |
| 84 | -DWITH_GZFILEOP:BOOL=ON \ |
| 85 | -DWITH_NATIVE_INSTRUCTIONS:BOOL=ON |
| 86 | pre-configure { |
| 87 | if {[catch {system "${prefix}/bin/cpuid | fgrep -i sse4.2"} has_sse4]} { |
| 88 | ui_warn "Your CPU doesn't have the SSE4.2 instruction set: ${has_sse4}" |
| 89 | configure.optflags-append \ |
| 90 | -mno-sse4 |
| 91 | } |
| 92 | if {[catch {system "${prefix}/bin/cpuid | fgrep -i pclmul"} has_pclmul]} { |
| 93 | ui_warn "Your CPU or build architecture doesn't support the PCLMUL code" |
| 94 | configure.optflags-append \ |
| 95 | -mno-pclmul |
| 96 | } |
| 97 | } |
| 98 | } |
| 99 | |
| 100 | global cloudflare-commit |
| 101 | variant cloudflare conflicts ng description {Applies CloudFlare's patches to use SSE for accelerated compression. \ |
| 102 | Note it is not 100% certain the zlib license continues to apply to this variant!} {} |
| 103 | if {[variant_isset cloudflare]} { |
| 104 | PortGroup github 1.0 |
| 105 | PortGroup muniversal 1.0 |
| 106 | long_description-append This variant has the CloudFlare patches for SSE accelerated compression |
| 107 | # This version contains a GPL'ed assembly file which may be incorporated. Just add GPL2+ to the license info. |
| 108 | license-append GPL-2+ |
| 109 | github.setup cloudflare zlib 836eb111a5c5df7db3f2469a867a6f7c1b2e7bdb |
| 110 | fetch.type git |
| 111 | version 1.2.8.21 |
| 112 | revision 1 |
| 113 | supported_archs i386 x86_64 |
| 114 | distname zlib-cloudflare |
| 115 | worksrcdir ${distname} |
| 116 | depends_build port:cpuid |
| 117 | if {[catch {system "${prefix}/bin/cpuid | fgrep -i sse4.2"} has_sse4]} { |
| 118 | set has_sse4 no |
| 119 | } else { |
| 120 | set has_sse4 yes |
| 121 | configure.optflags-append \ |
| 122 | -msse4 |
| 123 | } |
| 124 | pre-fetch { |
| 125 | if {!${has_sse4}} { |
| 126 | ui_error "Error checking for the SSE4.2 instruction set: ${has_sse4}" |
| 127 | return -code error "Your CPU doesn't seem to have the SSE4.2 instruction set: please install the regular zlib port" |
| 128 | } |
| 129 | } |
| 130 | global cloudflare-commit |
| 131 | set cloudflare-commit 836eb111a5c5df7db3f2469a867a6f7c1b2e7bdb |
| 132 | patchfiles cloudflare/patch-configure-clang.diff \ |
| 133 | cloudflare/patch-restore-uLong-API.diff |
| 134 | if {${os.arch} eq "i386" || [catch {system "${prefix}/bin/cpuid | fgrep -i pclmul"} has_pclmul]} { |
| 135 | set has_pclmul no |
| 136 | configure.optflags-append \ |
| 137 | -mno-pclmul |
| 138 | } else { |
| 139 | set has_pclmul yes |
| 140 | configure.optflags-append \ |
| 141 | -mnpclmul |
| 142 | } |
| 143 | pre-patch { |
| 144 | if {!${has_pclmul}} { |
| 145 | ui_warn "Your CPU or build architecture doesn't support the PCLMUL code" |
| 146 | patchfiles-append \ |
| 147 | cloudflare/patch-disable-pclmul.diff |
| 148 | post-patch { |
| 149 | ui_info "removing GPL'ed file crc32-pclmul_asm.S we won't be using anyway" |
| 150 | delete ${worksrcpath}/contrib/amd64/crc32-pclmul_asm.S |
| 151 | } |
| 152 | } else { |
| 153 | platform darwin { |
| 154 | patchfiles-append \ |
| 155 | cloudflare/patch-crc32pclmul-apple.diff |
| 156 | } |
| 157 | } |
| 158 | } |
| 159 | |
| 160 | post-destroot { |
| 161 | set docdir ${prefix}/share/doc/${name} |
| 162 | xinstall -d ${destroot}${docdir} |
| 163 | xinstall -m 0644 -W ${filespath} cloudflare/CloudFlare.txt ${destroot}${docdir} |
| 164 | reinplace "s|@@HOST@@|[exec hostname]|g" ${destroot}${docdir}/CloudFlare.txt |
| 165 | reinplace "s|@@COMMIT@@|${cloudflare-commit}|g" ${destroot}${docdir}/CloudFlare.txt |
| 166 | } |