biber for OpenBSD — Build Process ================================= Perlbrew -------- Once installed, [perlbrew](https://perlbrew.pl) can be started as follows on OpenBSD: 1. Add a file named `kshrc` in `$HOME/perl5/perlbrew/etc/` with the following contents: ```sh export PERLBREW_SHELLRC_VERSION=0.98 export PERLBREW_ROOT=/home/robert/perl5/perlbrew __perlbrew_reinit() { if [[ ! -d "$PERLBREW_HOME" ]]; then mkdir -p "$PERLBREW_HOME" fi [ -f "$PERLBREW_HOME/init" ] && rm "$PERLBREW_HOME/init" echo '# DO NOT EDIT THIS FILE' > "$PERLBREW_HOME/init" command perlbrew env $1 | \grep PERLBREW_ >> "$PERLBREW_HOME/init" . "$PERLBREW_HOME/init" __perlbrew_set_path } __perlbrew_set_path () { export PATH=${PERLBREW_PATH:-$PERLBREW_ROOT/bin}:$PATH hash -r } __perlbrew_set_env() { code= code="$($perlbrew_command env $@)" || return $? eval "$code" } __perlbrew_activate() { [[ -n $(alias perl 2>/dev/null) ]] && unalias perl 2>/dev/null if [[ -n "${PERLBREW_PERL:-}" ]]; then __perlbrew_set_env "${PERLBREW_PERL:-}${PERLBREW_LIB:+@}$PERLBREW_LIB" fi __perlbrew_set_path } __perlbrew_deactivate() { __perlbrew_set_env unset PERLBREW_PERL unset PERLBREW_LIB __perlbrew_set_path } perlbrew () { exit_status= short_option= export SHELL if [[ $1 == -* ]]; then short_option=$1 shift else short_option="" fi case $1 in (use) if [[ -z "$2" ]] ; then echo -n "Currently using ${PERLBREW_PERL:-system perl}" [ -n "$PERLBREW_LIB" ] && echo -n "@$PERLBREW_LIB" echo else __perlbrew_set_env "$2" && { __perlbrew_set_path ; true ; } exit_status="$?" fi ;; (switch) if [[ -z "$2" ]] ; then command perlbrew switch else perlbrew use $2 && { __perlbrew_reinit $2 ; true ; } exit_status=$? fi ;; (off) __perlbrew_deactivate echo "perlbrew is turned off." ;; (switch-off) __perlbrew_deactivate __perlbrew_reinit echo "perlbrew is switched off." ;; (*) command perlbrew $short_option "$@" exit_status=$? ;; esac hash -r return ${exit_status:-0} } [[ -z "${PERLBREW_ROOT:-}" ]] && export PERLBREW_ROOT="$HOME/perl5/perlbrew" [[ -z "${PERLBREW_HOME:-}" ]] && export PERLBREW_HOME="$HOME/.perlbrew" if [[ ! -n "${PERLBREW_SKIP_INIT:-}" ]]; then if [[ -f "${PERLBREW_HOME:-}/init" ]]; then . "$PERLBREW_HOME/init" fi fi if [[ -f "${PERLBREW_ROOT:-}/bin/perlbrew" ]]; then perlbrew_command="${PERLBREW_ROOT:-}/bin/perlbrew" else perlbrew_command="perlbrew" fi __perlbrew_activate ``` 2. Put somewhere in your `$PATH` a file named `useperlbrew` with the following contents: ```sh #!/bin/sh # perlbrew . $HOME/perl5/perlbrew/etc/kshrc perlbrew use perl-5.36.3 export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HOME/perl5/perlbrew/perls/perl-5.36.3/lib ``` As can be seen, the files above assume `perlbrew` v0.98 and `perl-5.36.3`. Adapt. These two files allow to initialize a perlbrew session as follows: ```sh . useperlbrew ``` Remember to intall `cpanm`: ```sh perlbrew install-cpanm ``` biber ----- 0. Prerequisite: `XSLT C Library`. Do as root: ```sh pkg_add libxslt ``` 1. Clone the git repository of `biber`: ```sh git clone https://github.com/plk/biber.git ``` 2. Proceed with the installation of `biber` as described in the [documentation available on CTAN](http://mirrors.ctan.org/biblio/biber/base/documentation/biber.pdf#subsection.4.4): ```sh cd biber git checkout vX.YY # eg. v2.20 for biber 2.20 cpanm Module::Build perl Build.PL ./Build installdeps ./Build install ``` 3. Now build and install `PAR::Packer`: ```sh cpanm PAR::Packer ``` 4. Finally, build `biber` executable for OpenBSD as follows: ```sh mkdir dist/openbsd_amd64 && cd dist/openbsd_amd64 ``` Add in this directory a new file named `build.sh` with the following contents: ```sh #!/bin/sh PERLB_VERSION=$(perlbrew info | grep Name: | sed 's/Name://') PAR_VERBATIM=1 pp \ --module=deprecate \ --module=BibTeX::Parser \ --module=Text::BibTeX \ --module=Biber::Input::file::bibtex \ --module=Biber::Input::file::biblatexml \ --module=Biber::Output::dot \ --module=Biber::Output::bbl \ --module=Biber::Output::bibtex \ --module=Biber::Output::biblatexml \ --module=Pod::Simple::TranscodeSmart \ --module=Pod::Simple::TranscodeDumb \ --module=List::MoreUtils::XS \ --module=List::SomeUtils::XS \ --module=List::MoreUtils::PP \ --module=HTTP::Status \ --module=HTTP::Date \ --module=Encode:: \ --module=File::Find::Rule \ --module=IO::Socket::SSL \ --module=IO::String \ --module=PerlIO::utf8_strict \ --module=Text::CSV_XS \ --module=DateTime \ --addfile="../../data/biber-tool.conf;lib/Biber/biber-tool.conf" \ --addfile="../../data/schemata/config.rnc;lib/Biber/config.rnc" \ --addfile="../../data/schemata/config.rng;lib/Biber/config.rng"\ --addfile="../../data/schemata/bcf.rnc;lib/Biber/bcf.rnc" \ --addfile="../../data/schemata/bcf.rng;lib/Biber/bcf.rng" \ --addfile="../../lib/Biber/LaTeX/recode_data.xml;lib/Biber/LaTeX/recode_data.xml" \ --addfile="../../data/bcf.xsl;lib/Biber/bcf.xsl" \ --addfile="$HOME/perl5/perlbrew/perls/${PERLB_VERSION}/lib/libbtparse.so;../libbtparse.so" \ --cachedeps=scancache \ --output=biber-openbsd \ ../../bin/biber ``` 5. Finally, to produce `biber-openbsd`, make `build.sh` executable and run it: ```sh chmod +x build.sh ./build.sh ```