# This is the recipe.sh script. It is executed by BPM in a temporary directory when compiling a source package # BPM Expects the source code to be extracted into the automatically created 'source' directory which can be accessed using $BPM_SOURCE # BPM Expects the output files to be present in the automatically created 'output' directory which can be accessed using $BPM_OUTPUT # The prepare function is executed in the root of the temp directory # This function is used for putting downloaded files to the correct location or applying patches prepare() { chmod +x "$BPM_WORKDIR"/bundle.sh chmod +x "$BPM_WORKDIR"/certdata2pem.py mkdir "$BPM_SOURCE"/certs ln -srft "$BPM_SOURCE"/certs "$BPM_SOURCE"/nss/lib/ckfw/builtins/{certdata.txt,nssckbi.h} } # The build function is executed in the source directory # This function is used to compile the source code build() { cd certs "$BPM_WORKDIR"/certdata2pem.py cd .. "$BPM_WORKDIR"/bundle.sh cd "$BPM_SOURCE"/nss ./build.sh --disable-tests --enable-libpkix --opt --system-nspr --system-sqlite } # The package function is executed in the source directory # This function is used to move the compiled files into the output directory package() { local nsprver="$(pkg-config --modversion nspr)" local libdir=/usr/lib includedir=/usr/include/nss sed nss/pkg/pkg-config/nss.pc.in \ -e "s,%prefix%,/usr,g" \ -e "s,%exec_prefix%,\${prefix},g" \ -e "s,%libdir%,$libdir,g" \ -e "s,%includedir%,$includedir,g" \ -e "s,%NSPR_VERSION%,$nsprver,g" \ -e "s,%NSS_VERSION%,$BPM_PKG_VERSION,g" | install -Dm644 /dev/stdin "$BPM_OUTPUT"/"$libdir"/pkgconfig/nss.pc install -Dt "$BPM_OUTPUT"/"$libdir" dist/Release/lib/*.so local vmajor vminor vpatch { read vmajor; read vminor; read vpatch; } \ < <(awk '/#define.*NSS_V(MAJOR|MINOR|PATCH)/ {print $3}' nss/lib/nss/nss.h) sed nss/pkg/pkg-config/nss-config.in \ -e "s,@prefix@,/usr,g" \ -e "s,@exec_prefix@,/usr,g" \ -e "s,@libdir@,$libdir,g" \ -e "s,@includedir@,$includedir,g" \ -e "s,@MOD_MAJOR_VERSION@,$vmajor,g" \ -e "s,@MOD_MINOR_VERSION@,$vminor,g" \ -e "s,@MOD_PATCH_VERSION@,$vpatch,g" | install -D /dev/stdin "$BPM_OUTPUT"/usr/bin/nss-config install -D dist/Release/bin/{*util,shlibsign,signtool,signver,ssltap} -t "$BPM_OUTPUT"/usr/bin install -Dm644 dist/public/nss/*.h -t "$BPM_OUTPUT"/"$includedir" install -Dm644 nss/doc/nroff/{*util,signtool,signver,ssltap}.1 -t "$BPM_OUTPUT"/usr/share/man/man1 # Replace built-in trust with p11-kit connection ln -sf pkcs11/p11-kit-trust.so "$BPM_OUTPUT"/"$libdir"/libnssckbi.so }