88 | | pre-configure { |
89 | | set php_debug_variant [regexp {/debug-[^/]+$} ${php5extension.extension_dir}] |
90 | | if {${php_debug_variant} && ![variant_isset debug]} { |
91 | | ui_error "${name} cannot be installed without the debug variant because PHP is installed with the debug variant." |
92 | | return -code error "incompatible variant selection" |
93 | | } elseif {[variant_isset debug] && !${php_debug_variant}} { |
94 | | ui_error "${name} cannot be installed with the debug variant because PHP is installed without the debug variant." |
95 | | return -code error "incompatible variant selection" |
| 87 | if {"pear" != ${php5extension.source}} { |
| 88 | name php5-[lindex ${php5extension.extensions} 0] |
| 89 | pre-configure { |
| 90 | set php_debug_variant [regexp {/debug-[^/]+$} ${php5extension.extension_dir}] |
| 91 | if {${php_debug_variant} && ![variant_isset debug]} { |
| 92 | ui_error "${name} cannot be installed without the debug variant because PHP is installed with the debug variant." |
| 93 | return -code error "incompatible variant selection" |
| 94 | } elseif {[variant_isset debug] && !${php_debug_variant}} { |
| 95 | ui_error "${name} cannot be installed with the debug variant because PHP is installed without the debug variant." |
| 96 | return -code error "incompatible variant selection" |
| 97 | } |
| 98 | foreach dir ${php5extension.build_dirs} { |
| 99 | ui_debug "Generating configure script in [file tail ${dir}]" |
| 100 | system "cd ${dir} && ${prefix}/bin/phpize" |
| 101 | } |
108 | | } |
109 | | |
110 | | build { |
111 | | foreach build.dir ${php5extension.build_dirs} { |
112 | | ui_debug "Building in [file tail ${build.dir}]" |
113 | | portbuild::build_main |
| 117 | |
| 118 | destroot.destdir INSTALL_ROOT=${destroot} |
| 119 | |
| 120 | destroot { |
| 121 | foreach destroot.dir ${php5extension.build_dirs} { |
| 122 | ui_debug "Staging in [file tail ${destroot.dir}]" |
| 123 | portdestroot::destroot_main |
| 124 | } |
| 125 | xinstall -m 755 -d ${destroot}${php5extension.inidir} |
| 126 | if {"zend" == ${php5extension.type}} { |
| 127 | set extension_prefix "zend_extension=${php5extension.extension_dir}/" |
| 128 | } else { |
| 129 | set extension_prefix "extension=" |
| 130 | } |
| 131 | set fp [open ${destroot}${php5extension.inidir}/${php5extension.ini} w] |
| 132 | puts $fp "; Do not edit this file; it is automatically generated by MacPorts." |
| 133 | puts $fp "; Any changes you make will be lost if you upgrade or uninstall ${name}." |
| 134 | puts $fp "; To configure PHP, edit ${php5extension.php_ini}." |
| 135 | foreach extension ${php5extension.extensions} { |
| 136 | puts $fp "${extension_prefix}${extension}.so" |
| 137 | } |
| 138 | close $fp |
115 | | } |
116 | | |
117 | | destroot.destdir INSTALL_ROOT=${destroot} |
118 | | |
119 | | destroot { |
120 | | foreach destroot.dir ${php5extension.build_dirs} { |
121 | | ui_debug "Staging in [file tail ${destroot.dir}]" |
122 | | portdestroot::destroot_main |
123 | | } |
124 | | xinstall -m 755 -d ${destroot}${php5extension.inidir} |
125 | | if {"zend" == ${php5extension.type}} { |
126 | | set extension_prefix "zend_extension=${php5extension.extension_dir}/" |
127 | | } else { |
128 | | set extension_prefix "extension=" |
129 | | } |
130 | | set fp [open ${destroot}${php5extension.inidir}/${php5extension.ini} w] |
131 | | puts $fp "; Do not edit this file; it is automatically generated by MacPorts." |
132 | | puts $fp "; Any changes you make will be lost if you upgrade or uninstall ${name}." |
133 | | puts $fp "; To configure PHP, edit ${php5extension.php_ini}." |
134 | | foreach extension ${php5extension.extensions} { |
135 | | puts $fp "${extension_prefix}${extension}.so" |
136 | | } |
137 | | close $fp |
138 | | } |
139 | | |
140 | | post-install { |
141 | | if {[file exists ${php5extension.php_ini}]} { |
142 | | set count 0 |
143 | | set fp [open ${php5extension.php_ini} r] |
144 | | while {![eof $fp]} { |
145 | | set line [gets $fp] |
146 | | regexp {^extension_dir *= *"?([^\"]*)"?} $line -> phpiniextensiondir |
147 | | if {[info exists phpiniextensiondir]} { |
148 | | ui_debug "Found extension_dir ${phpiniextensiondir} in ${php5extension.php_ini}" |
149 | | if {${phpiniextensiondir} != ${php5extension.extension_dir}} { |
150 | | if {0 == ${count}} { |
151 | | ui_msg "Your php.ini contains a line that will prevent ${name}" |
152 | | ui_msg "and other PHP extensions from working. To fix this," |
153 | | ui_msg "edit ${php5extension.php_ini} and delete this line:" |
154 | | ui_msg "" |
| 140 | |
| 141 | post-install { |
| 142 | if {[file exists ${php5extension.php_ini}]} { |
| 143 | set count 0 |
| 144 | set fp [open ${php5extension.php_ini} r] |
| 145 | while {![eof $fp]} { |
| 146 | set line [gets $fp] |
| 147 | regexp {^extension_dir *= *"?([^\"]*)"?} $line -> phpiniextensiondir |
| 148 | if {[info exists phpiniextensiondir]} { |
| 149 | ui_debug "Found extension_dir ${phpiniextensiondir} in ${php5extension.php_ini}" |
| 150 | if {${phpiniextensiondir} != ${php5extension.extension_dir}} { |
| 151 | if {0 == ${count}} { |
| 152 | ui_msg "Your php.ini contains a line that will prevent ${name}" |
| 153 | ui_msg "and other PHP extensions from working. To fix this," |
| 154 | ui_msg "edit ${php5extension.php_ini} and delete this line:" |
| 155 | ui_msg "" |
| 156 | } |
| 157 | ui_msg ${line} |
| 158 | incr count |
| 166 | |
| 167 | } else { |
| 168 | |
| 169 | global prefix extract.suffix distname |
| 170 | global name_package php_dir |
| 171 | |
| 172 | set name_package [lindex ${php5extension.extensions} 0] |
| 173 | name pear-[lindex ${php5extension.extensions} 0] |
| 174 | supported_archs noarch |
| 175 | depends_lib-append port:php5-pear |
| 176 | dist_subdir pear |
| 177 | extract.suffix .tgz |
| 178 | |
| 179 | use_configure no |
| 180 | |
| 181 | set php_dir ${prefix}/lib/php/pear |
| 182 | |
| 183 | extract {} |
| 184 | |
| 185 | build { |
| 186 | system "${php_dir}/pear.sh -d php_dir=${php_dir} -d doc_dir=${php_dir}/docs -d cache_dir=${worksrcpath}/tmp/pear/cache -d data_dir=${worksrcpath}/tmp/pear/data -d download_dir=${distpath} -d temp_dir=${worksrcpath}/tmp/pear/installer -d test_dir=${php_dir}/tests -d www_dir=${php_dir}/www install --loose --nodeps --offline --nobuild --ignore-errors --packagingroot=${worksrcpath}/packagingroot ${distpath}/${distname}${extract.suffix}" |
| 187 | } |
| 188 | |
| 189 | destroot { |
| 190 | xinstall -d ${destroot}${php_dir} |
| 191 | foreach file [glob -directory ${worksrcpath}/packagingroot/${php_dir} *] { |
| 192 | copy $file ${destroot}${php_dir} |
| 193 | } |
| 194 | } |
| 195 | |