35 | | destroot.destdir prefix=${destroot}${prefix} |
| 37 | patch.pre_args -p1 |
| 38 | |
| 39 | variant ng conflicts cloudflare description {provides the "Next Generation" zlib-ng project} {} |
| 40 | if {[variant_isset ng]} { |
| 41 | PortGroup github 1.0 |
| 42 | PortGroup cmake 1.1 |
| 43 | PortGroup muniversal 1.0 |
| 44 | long_description-append This variant provides the "Next Generation" zlib-ng library. |
| 45 | git.branch 75e76eebeb08dccea44a1d9933699f7f9a0a97ea |
| 46 | github.setup Dead2 zlib-ng ${git.branch} |
| 47 | fetch.type git |
| 48 | name zlib |
| 49 | version 1.2.11 |
| 50 | supported_archs i386 x86_64 |
| 51 | distname zlib-ng |
| 52 | worksrcdir ${distname} |
| 53 | depends_build port:cpuid |
| 54 | patchfiles ng/patch-cmakelists.diff \ |
| 55 | ng/patch-zlib-compat.diff |
| 56 | configure.args-append \ |
| 57 | -DZLIB_COMPAT:BOOL=ON \ |
| 58 | -DWITH_GZFILEOP:BOOL=ON \ |
| 59 | -DWITH_NATIVE_INSTRUCTIONS:BOOL=ON |
| 60 | pre-configure { |
| 61 | if {[catch {system "${prefix}/bin/cpuid | fgrep -i sse4.2"} has_sse4]} { |
| 62 | ui_warn "Your CPU doesn't have the SSE4.2 instruction set: ${has_sse4}" |
| 63 | configure.optflags-append \ |
| 64 | -mno-sse4 |
| 65 | } |
| 66 | if {[catch {system "${prefix}/bin/cpuid | fgrep -i pclmul"} has_pclmul]} { |
| 67 | ui_warn "Your CPU or build architecture doesn't support the PCLMUL code" |
| 68 | configure.optflags-append \ |
| 69 | -mno-pclmul |
| 70 | } |
| 71 | } |
| 72 | |
| 73 | # 1.6Ghz Intel Celeron N3150, linux 4.9.8, -O3 -march=native, gcc-6.2, 262Mb source tarball as test |
| 74 | # 13.739 user_cpu 0.133 kernel_cpu 0:13.05 total_time 106.2%CPU {2928M 18F 212R 535265I 0O 1w 12999c} |
| 75 | # 13.744 user_cpu 0.145 kernel_cpu 0:13.07 total_time 106.1%CPU {2928M 0F 219R 535265I 0O 0w 13046c} |
| 76 | # 13.804 user_cpu 0.150 kernel_cpu 0:13.13 total_time 106.2%CPU {2928M 0F 224R 535265I 0O 1w 13087c} |
| 77 | # idem, zlib 1.2.11, -O3, without -march=native: |
| 78 | # 20.514 user_cpu 0.142 kernel_cpu 0:19.43 total_time 106.2%CPU {2928M 0F 215R 535263I 0O 1w 19373c} |
| 79 | # 21.246 user_cpu 0.160 kernel_cpu 0:20.19 total_time 105.9%CPU {2928M 0F 215R 535263I 0O 1w 20116c} |
| 80 | # 20.485 user_cpu 0.147 kernel_cpu 0:19.41 total_time 106.2%CPU {2928M 0F 222R 535263I 0O 1w 19342c} |
| 81 | # 2.7 Ghz i7, OS X 10.9, -O3 -march=native, clang-4.0, 262Mb source tarball as test |
| 82 | # 4.641 user_cpu 0.083 kernel_cpu 0:04.72 total_time 100.0%CPU {978944M 0F 275R 0I 0O 0k 0w 134c} |
| 83 | # 4.644 user_cpu 0.083 kernel_cpu 0:04.73 total_time 99.7%CPU {978944M 0F 275R 0I 0O 0k 0w 130c} |
| 84 | # 4.671 user_cpu 0.084 kernel_cpu 0:04.75 total_time 100.0%CPU {978944M 0F 275R 0I 0O 0k 0w 125c} |
| 85 | # stock 1.2.11 idem but with -flto: |
| 86 | # 7.704 user_cpu 0.089 kernel_cpu 0:07.80 total_time 99.7%CPU {966656M 0F 272R 0I 0O 0k 0w 245c} |
| 87 | # 7.676 user_cpu 0.089 kernel_cpu 0:07.77 total_time 99.7%CPU {958464M 0F 270R 0I 0O 0k 0w 241c} |
| 88 | # 7.889 user_cpu 0.089 kernel_cpu 0:07.98 total_time 99.7%CPU {958464M 0F 270R 0I 0O 0k 0w 209c} |
| 89 | } else { |
| 90 | # don't muck with this setting for the +ng variant (or it will destroot directly into ${prefix}) |
| 91 | destroot.destdir prefix=${destroot}${prefix} |
| 92 | } |
| 93 | |
| 94 | global cloudflare-commit |
| 95 | variant cloudflare conflicts ng description {Applies CloudFlare's patches to use SSE for accelerated compression. \ |
| 96 | Note it is not 100% certain the zlib license continues to apply to this variant!} { |
| 97 | PortGroup github 1.0 |
| 98 | PortGroup muniversal 1.0 |
| 99 | long_description-append This variant has the CloudFlare patches for SSE accelerated compression |
| 100 | # This version contains a GPL'ed assembly file which may be incorporated. Just add GPL2+ to the license info. |
| 101 | license-append GPL-2+ |
| 102 | github.setup cloudflare zlib 836eb111a5c5df7db3f2469a867a6f7c1b2e7bdb |
| 103 | fetch.type git |
| 104 | version 1.2.8.21 |
| 105 | supported_archs i386 x86_64 |
| 106 | distname zlib-cloudflare |
| 107 | worksrcdir ${distname} |
| 108 | depends_build port:cpuid |
| 109 | if {[catch {system "${prefix}/bin/cpuid | fgrep -i sse4.2"} has_sse4]} { |
| 110 | set has_sse4 no |
| 111 | } else { |
| 112 | set has_sse4 yes |
| 113 | configure.optflags-append \ |
| 114 | -msse4 |
| 115 | } |
| 116 | pre-fetch { |
| 117 | if {!${has_sse4}} { |
| 118 | ui_error "Error checking for the SSE4.2 instruction set: ${has_sse4}" |
| 119 | return -code error "Your CPU doesn't seem to have the SSE4.2 instruction set: please install the regular zlib port" |
| 120 | } |
| 121 | } |
| 122 | global cloudflare-commit |
| 123 | set cloudflare-commit 836eb111a5c5df7db3f2469a867a6f7c1b2e7bdb |
| 124 | patchfiles cloudflare/patch-configure-clang.diff |
| 125 | if {${os.arch} eq "i386" || [catch {system "${prefix}/bin/cpuid | fgrep -i pclmul"} has_pclmul]} { |
| 126 | set has_pclmul no |
| 127 | configure.optflags-append \ |
| 128 | -mno-pclmul |
| 129 | } else { |
| 130 | set has_pclmul yes |
| 131 | configure.optflags-append \ |
| 132 | -mnpclmul |
| 133 | } |
| 134 | pre-patch { |
| 135 | if {!${has_pclmul}} { |
| 136 | ui_warn "Your CPU or build architecture doesn't support the PCLMUL code" |
| 137 | patchfiles-append \ |
| 138 | cloudflare/patch-disable-pclmul.diff |
| 139 | post-patch { |
| 140 | ui_info "removing GPL'ed file crc32-pclmul_asm.S we won't be using anyway" |
| 141 | delete ${worksrcpath}/contrib/amd64/crc32-pclmul_asm.S |
| 142 | } |
| 143 | } else { |
| 144 | platform darwin { |
| 145 | patchfiles-append \ |
| 146 | cloudflare/patch-crc32pclmul-apple.diff |
| 147 | } |
| 148 | } |
| 149 | } |
| 150 | |
| 151 | post-destroot { |
| 152 | set docdir ${prefix}/share/doc/${name} |
| 153 | xinstall -d ${destroot}${docdir} |
| 154 | xinstall -m 0644 -W ${filespath} cloudflare/CloudFlare.txt ${destroot}${docdir} |
| 155 | reinplace "s|@@HOST@@|[exec hostname]|g" ${destroot}${docdir}/CloudFlare.txt |
| 156 | reinplace "s|@@COMMIT@@|${cloudflare-commit}|g" ${destroot}${docdir}/CloudFlare.txt |
| 157 | } |
| 158 | # 1.6Ghz Intel Celeron N3150, linux 4.9.8, -O3 -march=native, gcc-6.2, 262Mb source tarball as test |
| 159 | # 12.149 user_cpu 0.144 kernel_cpu 0:11.56 total_time 106.2%CPU {2928M 0F 213R 535263I 0O 1w 11536c} |
| 160 | # 12.124 user_cpu 0.157 kernel_cpu 0:11.56 total_time 106.1%CPU {2928M 0F 212R 535263I 0O 1w 11525c} |
| 161 | # 12.156 user_cpu 0.109 kernel_cpu 0:11.54 total_time 106.1%CPU {2928M 0F 212R 535263I 0O 1w 11490c} |
| 162 | # idem, zlib 1.2.11, -O3, without -march=native: |
| 163 | # 20.514 user_cpu 0.142 kernel_cpu 0:19.43 total_time 106.2%CPU {2928M 0F 215R 535263I 0O 1w 19373c} |
| 164 | # 21.246 user_cpu 0.160 kernel_cpu 0:20.19 total_time 105.9%CPU {2928M 0F 215R 535263I 0O 1w 20116c} |
| 165 | # 20.485 user_cpu 0.147 kernel_cpu 0:19.41 total_time 106.2%CPU {2928M 0F 222R 535263I 0O 1w 19342c} |
| 166 | # 2.7 Ghz i7, OS X 10.9, -O3 -march=native, clang-4.0, 262Mb source tarball as test |
| 167 | # 4.665 user_cpu 0.086 kernel_cpu 0:04.76 total_time 99.5%CPU {958464M 0F 270R 0I 0O 0k 0w 215c} |
| 168 | # 4.520 user_cpu 0.081 kernel_cpu 0:04.60 total_time 100.0%CPU {958464M 0F 270R 0I 0O 0k 0w 117c} |
| 169 | # 4.640 user_cpu 0.084 kernel_cpu 0:04.72 total_time 100.0%CPU {958464M 0F 270R 0I 0O 0k 0w 134c} |
| 170 | # stock 1.2.11 idem but with -flto: |
| 171 | # 7.704 user_cpu 0.089 kernel_cpu 0:07.80 total_time 99.7%CPU {966656M 0F 272R 0I 0O 0k 0w 245c} |
| 172 | # 7.676 user_cpu 0.089 kernel_cpu 0:07.77 total_time 99.7%CPU {958464M 0F 270R 0I 0O 0k 0w 241c} |
| 173 | # 7.889 user_cpu 0.089 kernel_cpu 0:07.98 total_time 99.7%CPU {958464M 0F 270R 0I 0O 0k 0w 209c} |
| 174 | } |