-# Cleanup rpath and libtool .la files
-find $WORKSPACE/build/lib -name "*.so" -exec chrpath --delete {} \;
-find $WORKSPACE/build/lib -name "*.la" -exec rm -f {} \;
+ # Ignore level 1 of tar
+ $TAR xvf ./*.tar.* --strip 1
+
+ BUILD_PATH="$(mktemp -d)"
+ cd "$BUILD_PATH"
+
+ # Build oot from extracted sources
+ CPPFLAGS="$CPPFLAGS" LDFLAGS="$LDFLAGS" "$NEWSRC_PATH/configure" --prefix="$PREFIX" $CONF_OPTS
+ ;;
+
+*)
+ echo "Standard in-tree build"
+ CPPFLAGS="$CPPFLAGS" LDFLAGS="$LDFLAGS" "$BUILD_PATH/configure" --prefix="$PREFIX" $CONF_OPTS
+ ;;
+esac
+
+# BUILD!
+$MAKE -j "$($NPROC)" V=1
+$MAKE install
+
+# Run tests
+$MAKE --keep-going check
+
+# Copy tap logs for the jenkins tap parser
+rsync -a --exclude 'test-suite.log' --include '*/' --include '*.log' --exclude='*' tests/ "$WORKSPACE/tap"
+
+# Clean the build directory
+$MAKE clean
+
+# Cleanup rpath in executables and shared libraries
+find "$PREFIX/lib" -name "*.so" -exec chrpath --delete {} \;
+
+# Remove libtool .la files
+find "$PREFIX/lib" -name "*.la" -exec rm -f {} \;