diff --git a/bldpkg b/bldpkg index a3162ff..f344891 100755 --- a/bldpkg +++ b/bldpkg @@ -233,6 +233,14 @@ verifychecksums() { unset IFS } +pythonfix() { + if [[ -d $pkg/usr ]] ; then + info "Shifting contents out of $pkg/usr" + cp -ar $pkg/usr/* $pkg/ + rm -r $pkg/usr + fi +} + # Function to validate MAKEFLAGS passed on by getopts validatemakeflags() { local makeflags="$1" @@ -513,6 +521,10 @@ promptuser() { *) info "Nope? Alright." ;; esac fi + + if [[ $pkgstatus = 0 ]] ; then + exit 0 + fi } # This function will set the interrupt variable so prepbuildoutput can output the right build status @@ -528,7 +540,7 @@ interruptoutput() { # Terminate sccache sccacheprocess stop - return 0 + exit 0 } # Function to perform post-compile tasks. @@ -554,13 +566,19 @@ mkfinalpkg() { # Check if /lib64 was created inside $pkg [[ -d lib64 ]] && err "Multilib directory '/lib64' created inside '$pkg' not supported by musl C library." - # Check if /usr and /sbin were created inside staging directory $pkg - # of its build file. Ignore their existence if $ignoreusr is set to 1 in the pkg build file - if [[ -z $ignoreusr ]] ; then - for directory in usr sbin ; do - [[ -d $directory ]] && err "$pkg/$directory is a symlink to '/bin'. Fix your build options and ensure such a directory is not created" - done - fi + # Check if /usr and /sbin were created inside staging directory $pkg. + # If they are, check if the directory contains python-specific site-packages + # directory or has ignoreusr variable set. + for directory in sbin usr ; do + if [[ -d $directory ]] ; then + detectsitepackages="$(find . -name "site-packages" | wc -l)" + if [[ $detectsitepackages -gt 0 ]] || [[ -n $ignoreusr ]] ; then + pythonfix + else + err "$pkg/$directory is a symlink to '/bin'. Fix your build options and ensure such a directory is not created" + fi + fi + done info "Copying post-install files..." @@ -615,10 +633,12 @@ EOF fi # If $preservestaticlibs is not set in the package build file, delete all static libraries - if [[ -d lib ]] && [[ -z $preservestaticlibs ]] ; then - if [[ "$(findarchivefiles | wc -l)" -ge 1 ]] ; then - info "Discarding static libraries..." - findarchivefiles | xargs rm -v + if [[ -d lib ]] ; then + if [[ -z $preservestaticlibs ]] ; then + if [[ "$(findarchivefiles | wc -l)" -ge 1 ]] ; then + info "Discarding static libraries..." + findarchivefiles | xargs rm -v + fi fi fi @@ -631,6 +651,12 @@ EOF fi fi + # Move package documentation and licenses into $pkgdocs + if [[ -d share/doc/$app ]] ; then + cp -ar share/doc/$app $pkgdocs/ + rm -r share/doc/$app + fi + # Calculate total files, directories, symlinks and uncompressed staging directory size if [[ $showsummary = 1 ]] ; then totalfilecount=$(find "$pkg" -type f | wc -l) @@ -1119,11 +1145,8 @@ rustc-wrapper = "/bin/sccache"' if [[ $verbosebuild = 1 ]] || [[ $getoptsverbosebuild = 1 ]] ; then V=1 VERBOSE=1 - else - V=0 - VERBOSE=0 + export V VERBOSE fi - export V VERBOSE fi @@ -1296,23 +1319,12 @@ manualbuild() { esac fi + verifychecksums # If $resumepkgbuild variable is not set in getopts, only then execute prepbuilddir variable if [[ -z $resumepkgbuild ]] ; then - verifychecksums prepbuilddir - fi - - stage1prep - trap "prepbuildoutput" EXIT - build - - # If $resumepkgbuild is set either in getopts or from the user prompt above, execute mkandenterbuilddir - # function to enter the build directory. This is being done because mkandenterbuilddir is part of prepbuilddir - # function in the build file and ignoring prepbuilddir will not cause mkandenterbuilddir to be invoked - # separately unless the build system is told to. - if [[ -n $resumepkgbuild ]] ; then + else mkandenterbuilddir - # fixbuilddirpermissions places a file ".$app-$version.extraction.complete". Only resume the build if that file exists if [[ ! -f $buildresumepath ]] ; then err "Can't resume build of '"$app"'! Are you certain the source was extracted completely?" @@ -1320,6 +1332,10 @@ manualbuild() { cd ${buildresumepath%/*} fi fi + + stage1prep + trap "prepbuildoutput" EXIT + build fi }