Overview
Comment: | Many build script updates |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | packages |
Files: | files | file ages | folders |
SHA1: | 4a0ff085ab1147d8408129df286f820e8b71d330 |
User & Date: | rkeene on 2018-11-16 21:38:43 |
Other Links: | manifest | tags |
Context
2018-11-16
| ||
21:38 | Many build script updates Leaf check-in: 4a0ff085ab user: rkeene tags: packages | |
21:38 | Upgraded to latest Tcl check-in: 3f2cfe4d81 user: rkeene tags: packages | |
Changes
Modified build from [28a52cfdd8] to [970bc0b0dc].
14 14 pkg="$(echo "$1" | sed 's@/*$@@;s@^\.*/*@@')" 15 15 16 16 if [ -z "${pkg}" ]; then 17 17 echo "Usage: build [--cpio] <package>" 2>&1 18 18 19 19 exit 1 20 20 fi 21 + 22 +function predownload() { 23 + : 24 +} 21 25 22 26 function download() { 23 27 if [ ! -e "${pkgarchive}" ]; then 24 28 # Download 25 29 ## Cleanup 26 30 rm -f src.new 27 31 28 32 ## Fetch file 29 - wget -O src.new "${url}" || exit 1 33 + wget --no-check-certificate -O src.new "${url}" || exit 1 30 34 31 35 ## Verify signature 32 36 src_sha256="$(openssl sha256 'src.new' | sed 's@^.*= @@')" 33 37 if [ "${src_sha256}" != "${sha256}" ]; then 34 38 echo "SHA256 mismatch: Downloaded: ${src_sha256} != Expected: ${sha256}" >&2 35 39 36 40 exit 1 ................................................................................ 102 106 patch -p1 < "${patch}" 103 107 done 104 108 } 105 109 106 110 function verifyRequiredPackages() { 107 111 local pkg pkgdomain pkgversion 108 112 local pkgdir pkgconfigdir pkgfound 113 + local use_native_platform 114 + local add_headers_str 115 + 116 + SAVE_PKG_CONFIG_PATH="${PKG_CONFIG_PATH}" 117 + PKG_CONFIG_PATH='' 118 + export PKG_CONFIG_PATH 119 + 120 + use_native_platform='0' 121 + for pkg in "${require[@]}"; do 122 + case "${pkg}" in 123 + @native-os) 124 + use_native_platform='1' 125 + ;; 126 + esac 127 + done 128 + 129 + if [ "${use_native_platform}" = '1' ]; then 130 + add_headers_str='-I' 131 + else 132 + add_headers_str='-isystem ' 133 + fi 109 134 110 135 for pkg in "${require[@]}"; do 111 136 pkgdomain='' 112 137 pkgversion='' 113 138 pkgchanges=(CFLAGS LDFLAGS PATH PKG_CONFIG_PATH) 114 139 115 140 case "${pkg}" in ................................................................................ 116 141 *:*) 117 142 pkgchanges=($(echo "${pkg}" | cut -f 2 -d ':')) 118 143 pkg="$(echo "${pkg}" | cut -f 1 -d ':')" 119 144 ;; 120 145 esac 121 146 122 147 case "${pkg}" in 148 + @native-os) 149 + PKG_CONFIG_PATH="${PKG_CONFIG_PATH}:${SAVE_PKG_CONFIG_PATH}" 150 + 151 + continue 152 + ;; 123 153 @*) 124 154 # Fake package 125 155 continue 126 156 ;; 127 157 */*@*) 128 158 pkgdomain="$(echo "${pkg}" | cut -f 2 -d '@')" 129 159 pkgversion="$(echo "${pkg}" | cut -f 2 -d '/' | cut -f 1 -d '@')" ................................................................................ 140 170 esac 141 171 142 172 if [ -z "${pkgdomain}" ]; then 143 173 pkgdomain="${domain}" 144 174 fi 145 175 146 176 pkgfound='0' 147 - for pkgdir in "/opt/appfs/${pkgdomain}/${pkg}/platform"/${pkgversion:-latest} "/opt/appfs/${pkgdomain}/${pkg}/platform"/${pkgversion:-*}; do 177 + ADD_PATH='' 178 + for pkgdir in "/opt/appfs/${pkgdomain}/${pkg}/${os}-${arch}"/${pkgversion:-latest} "/opt/appfs/${pkgdomain}/${pkg}/${os}-${arch}"/${pkgversion:-*}; do 148 179 pkgconfigdir="${pkgdir}/lib/pkgconfig" 149 180 150 181 if [ ! -d "${pkgdir}" ]; then 151 182 continue 152 183 fi 153 184 154 185 # If the package version was unspecified, fully resolve ................................................................................ 158 189 fi 159 190 160 191 pkgfound='1' 161 192 162 193 for pkgchange in "${pkgchanges[@]}"; do 163 194 case "${pkgchange}" in 164 195 CFLAGS) 165 - CFLAGS="${CFLAGS} -isystem ${pkgdir}/include" 166 - CPPFLAGS="${CPPFLAGS} -isystem ${pkgdir}/include" 167 - export CFLAGS CPPFLAGS 196 + CFLAGS="${CFLAGS} ${add_headers_str}${pkgdir}/include" 197 + CXXFLAGS="${CFLAGS} ${add_headers_str}${pkgdir}/include" 198 + CPPFLAGS="${CPPFLAGS} ${add_headers_str}${pkgdir}/include" 199 + export CFLAGS CXXFLAGS CPPFLAGS 168 200 ;; 169 201 LDFLAGS) 170 202 LDFLAGS="${LDFLAGS} -L${pkgdir}/lib -Wl,-rpath,${pkgdir}/lib" 171 203 export LDFLAGS 172 204 ;; 173 205 PATH) 174 - PATH="${PATH}:${pkgdir}/bin" 175 - export PATH 206 + ADD_PATH="${ADD_PATH}:${pkgdir}/bin" 207 + ;; 208 + PERL5LIB) 209 + PERL5LIB="${pkgdir}/lib/perl5:${PERL5LIB}" 210 + PERL5LIB="${pkgdir}/lib/site_perl:${PERL5LIB}" 211 + export PERL5LIB 176 212 ;; 177 213 PKG_CONFIG_PATH) 178 214 if [ -d "${pkgconfigdir}" ]; then 179 215 PKG_CONFIG_PATH="${PKG_CONFIG_PATH}:${pkgconfigdir}" 180 216 export PKG_CONFIG_PATH 181 217 fi 182 218 ;; ................................................................................ 185 221 186 222 break 187 223 done 188 224 189 225 if [ "${pkgfound}" = '0' ]; then 190 226 die "Package ${pkg}/${pkgversion:-*}@${pkgdomain} not found." 191 227 fi 228 + 229 + ADD_PATH="$(echo "${ADD_PATH}" | sed 's@^:*@@')" 230 + 231 + PATH="${ADD_PATH}:${PATH}" 192 232 done 193 233 } 194 234 195 235 function verifyPrerequisites() { 196 236 : 197 237 } 198 238 199 239 function determineOsArch() { 200 - os="$(uname -s | dd conv=lcase 2>/dev/null)" 201 - arch="$(uname -m | dd conv=lcase 2>/dev/null)" 240 + if [ -z "${APPFS_BUILD_OS}" ]; then 241 + os="$(uname -s | dd conv=lcase 2>/dev/null)" 242 + else 243 + os="${APPFS_BUILD_OS}" 244 + fi 202 245 203 - case "${arch}" in 204 - i?86) 205 - arch='ix86' 206 - ;; 207 - esac 246 + if [ -z "${APPFS_BUILD_ARCH}" ]; then 247 + arch="$(uname -m | dd conv=lcase 2>/dev/null)" 248 + 249 + case "${arch}" in 250 + i?86) 251 + arch='ix86' 252 + ;; 253 + esac 254 + else 255 + arch="${APPFS_BUILD_ARCH}" 256 + fi 208 257 } 209 258 210 259 function determinePrefix() { 211 260 determineOsArch 212 261 213 262 prefixsuffix="${pkg}/${os}-${arch}/${version}" 214 263 prefix="/opt/appfs/${domain}/${prefixsuffix}" ................................................................................ 224 273 function postconfigure() { 225 274 : 226 275 } 227 276 228 277 function configure_gcc() { 229 278 local glibcdir linuxheadersdir 230 279 local dynlinker 231 - local gcc_default_headers 280 + local gcc_default_headers_c gcc_default_headers_cxx 232 281 local pkg use_native_platform 233 282 234 - glibcdir="/opt/appfs/core.appfs.rkeene.org/glibc/platform/latest" 283 + glibcdir="/opt/appfs/core.appfs.rkeene.org/glibc/${os}-${arch}/latest" 235 284 glibcdir="$(readlink -f "${glibcdir}")" 236 285 237 - linuxheadersdir="/opt/appfs/core.appfs.rkeene.org/linux-headers/platform/latest" 286 + linuxheadersdir="/opt/appfs/core.appfs.rkeene.org/linux-headers/${os}-${arch}/latest" 238 287 linuxheadersdir="$(readlink -f "${linuxheadersdir}")" 239 288 240 289 dynlinker="$(ls "${glibcdir}"/lib/ld-linux*.so.* | tail -n 1)" 241 290 242 291 if [ ! -f "${dynlinker}" ]; then 243 292 die 'glibc directory is not available (appfs running/working?)' 244 293 fi ................................................................................ 249 298 @native-os) 250 299 use_native_platform='1' 251 300 ;; 252 301 esac 253 302 done 254 303 255 304 if [ "${use_native_platform}" = '0' ]; then 256 - gcc_default_headers="$(echo '' | ${CPP:-cpp} -v 2>&1 | sed '/^End of search list/,$ d;0,/search starts here:$/ d' | grep '/gcc/' | sed 's@^ *@-isystem @' | tr $'\n' ' ')" 305 + gcc_default_headers_c="$(echo '' | ${CPP:-cpp} -v 2>&1 | sed '/^End of search list/,$ d;0,/search starts here:$/ d' | grep '/gcc/' | sed 's@^ *@-isystem @' | tr $'\n' ' ')" 306 + gcc_default_headers_cxx="$(echo '' | ${CPP:-cpp} -x c++ -v 2>&1 | sed '/^End of search list/,$ d;0,/search starts here:$/ d' | grep '/gcc/' | sed 's@^ *@-isystem @' | tr $'\n' ' ')" 257 307 258 - CC="${CC:-gcc} -nostdinc ${gcc_default_headers} -isystem ${glibcdir}/include" 259 - CXX="${CXX:-g++} -nostdinc ${gcc_default_headers} -isystem ${glibcdir}/include" 308 + CC="${CC:-gcc} -nostdinc ${gcc_default_headers_c} -isystem ${glibcdir}/include" 309 + CXX="${CXX:-g++} -nostdinc ${gcc_default_headers_cxx} -isystem ${glibcdir}/include" 260 310 261 311 if ! echo " ${require[*]} " | grep ' linux-headers[/@: ]' >/dev/null; then 262 312 CC="${CC} -isystem ${linuxheadersdir}/include" 263 313 CXX="${CXX} -isystem ${linuxheadersdir}/include" 264 314 fi 265 315 else 266 - CC="${CC:-gcc} -isystem ${glibcdir}/include" 267 - CXX="${CXX:-g++} -isystem ${glibcdir}/include" 316 + CC="${CC:-gcc}" 317 + CXX="${CXX:-g++}" 268 318 fi 269 319 270 320 BUILD_CC="${CC}" 271 321 HOST_CC="${CC}" 322 + BUILD_CXX="${CXX}" 323 + HOST_CXX="${CXX}" 272 324 273 - LDFLAGS="${LDFLAGS} -L${glibcdir}/lib -Wl,-rpath,${glibcdir}/lib -Wl,--dynamic-linker,${dynlinker}" 325 + if [ "${use_native_platform}" = '0' ]; then 326 + LDFLAGS="${LDFLAGS} -L${glibcdir}/lib -Wl,-rpath,${glibcdir}/lib -Wl,--dynamic-linker,${dynlinker}" 327 + fi 328 + 274 329 if [ -z "${appfs_build_no_default_symver}" ]; then 275 330 LDFLAGS="${LDFLAGS} -Wl,--default-symver" 276 331 fi 277 332 278 333 PKG_CONFIG_LIBDIR="${glibcdir}/lib/pkgconfig" 279 334 280 - export CC BUILD_CC HOST_CC LDFLAGS PKG_CONFIG_LIBDIR 335 + export CC CXX BUILD_CC HOST_CC BUILD_CXX HOST_CXX LDFLAGS PKG_CONFIG_LIBDIR 281 336 } 282 337 283 338 function configure() { 284 339 configure_gcc 285 340 ./configure --prefix="${prefix}" --sysconfdir="${prefix}/etc" --libdir="${prefix}/lib" --localstatedir=/var "${configure_extra[@]}" 286 341 } 287 342 ................................................................................ 304 359 } 305 360 306 361 function postinstall() { 307 362 : 308 363 } 309 364 310 365 function install() { 311 - make install DESTDIR="${destdir}" 366 + make "${make_extra[@]}" install DESTDIR="${destdir}" 312 367 } 313 368 314 369 function cleanup() { 315 370 cd "${workdir}" || exit 1 316 371 cd .. || exit 1 317 372 rm -rf "${workdir}" 318 373 } ................................................................................ 368 423 pkgarchive="${archivedir}/${pkg}-${version}.archive" 369 424 mkdir "${archivedir}" >/dev/null 2>/dev/null 370 425 mkdir "${workdir}" || exit 1 371 426 cd "${workdir}" || exit 1 372 427 workdir="$(pwd)" 373 428 374 429 # Download 430 +predownload 375 431 download 376 432 377 433 # Extract 378 434 extract 379 435 380 436 # If we just have one directory, use that directory 381 437 dir="$(echo *)" 382 438 if [ -e "${dir}" ]; then 383 - mv "${dir}"/* . 439 + ( 440 + shopt -s dotglob 441 + mv "${dir}"/* . 442 + ) 384 443 fi 385 444 386 -# Verify pre-requisites are met 387 -verifyRequiredPackages || die 'Required packages missing' 388 -verifyPrerequisites || die 'Prerequisities failed' 445 +# Determine properties 446 +determinePrefix 389 447 390 448 # Start logging 391 449 set -x 392 450 393 -# Determine properties 394 -determinePrefix 451 +# Verify pre-requisites are met 452 +verifyRequiredPackages || die 'Required packages missing' 453 +verifyPrerequisites || die 'Prerequisities failed' 395 454 396 455 # Apply patches 397 456 apply_patches 398 457 399 458 # Start the build 400 459 preconfigure || die 'preconfigure failed' 401 460 configure || die 'configure failed'