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