if is_version_less 3.14 "$NSS_BRANCH"; then
  cd $SOURCE_DIRECTORY/dist
else
  cd $SOURCE_DIRECTORY/mozilla/dist
fi &&

# don't overwrite OpenSSL's libssl.a static library
pushd */lib &&
mv -v libssl.a libssl3.a &&
popd &&

install -v -d -m755 $INSTALL_ROOT/usr/lib &&
install -v -m755 */lib/*.so $INSTALL_ROOT/usr/lib &&
install -v -m755 */lib/*.chk $INSTALL_ROOT/usr/lib &&
install -v -m755 */lib/*.a $INSTALL_ROOT/usr/lib &&

install -v -d -m755 $INSTALL_ROOT/usr/lib/pkgconfig &&

if is_version_less 3.14 "$NSS_BRANCH"; then
  install -v -m755 ../nss/config/nss-config $INSTALL_ROOT/usr/bin &&
  install -v -m644 */lib/pkgconfig/nss.pc $INSTALL_ROOT/usr/lib/pkgconfig
else
  install -v -m644 ../security/nss/cmd/disttools/nss.pc $INSTALL_ROOT/usr/lib/pkgconfig
fi &&

install -v -d -m755 $INSTALL_ROOT/usr/bin &&
install -v -m755 */bin/* $INSTALL_ROOT/usr/bin &&

install -v -d -m755 $INSTALL_ROOT/usr/include/nss &&
install -v -m644 private/nss/*.h $INSTALL_ROOT/usr/include/nss &&
install -v -m644 public/nss/*.h $INSTALL_ROOT/usr/include/nss &&
install -v -m644 public/dbm/*.h $INSTALL_ROOT/usr/include/nss
