aboutsummaryrefslogtreecommitdiff
path: root/README.biber.md
blob: 9d11898b670016de70413f497317411fa839cfc3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
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
```

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

	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/perl-5.36.3/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
   ```