- Notifications
You must be signed in to change notification settings - Fork1
anoduck/Biber-OpenBSD
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Needed files for building Biber on OpenBSD
Some people do not like to clutter up their home directory (I am poking fun @madaalch), where some peopleare of the exact opposite affinity. This is more or less simply differences in philosophical perspectives ofUnix. This being said, the work directory for this installation can be where ever and whatever you want it tobe,~/Sandbox
is used to conserve the effort of the Author, as at the time of writing~/Sandbox/
was already referenced by the build files. In retrospect, a more traditional working directory would have been/opt
or/usr/src
.
If you decide to use another working directory other than~/Sandbox/
then you will need to edit the buildfiles to reflect this change. To make things painfully obvious, the "build files" are the files located indist/OpenBSD
of this repository.
In order for biber to work, it needs a compatible version of BibLaTeX.Once you have verified that biber is functioning and have copied it to the bin directory of your choice runbiber --version
and make note.
To find the compatible version, visit thebiber documentation page and in biber.pdf look at compatibility matrix.Download the corresponding version of BibLaTeX fromsourceforge
Runkpsewhich -var-value=TEXHOME
and make note of directory;(it should be~/texmf
; if this doesn't exist then create it).cd
to directory which contains the downloadedbiblatex-*.tgz
.tar -zxvf biblatex-*.tgz -C ~/texmf
where * is the version you have just downloaded.texhash ~/texmf
NOTE after running the above command,kpsewhich -var-value=TEXHOME
will no longer print anything.
Now go back to the~/Sandbox/biber/testfiles
directory andpdflatex test ; biber test ; pdflatex test
.Open the test.pdf; if you have no errors then your test.pdf will list a single successful reference.
Back up the document that you wish to run biber with.Runpdflatex yourdocumentname ; biber yourdocumentname
and check for errors.Note that if your .bib file's name contains 12 or more characters you will get an error,(example bibliography.bib will be truncated to bibliograph.bib, which biber will not be able to find.)if needs be rename it to biblio.bib or something similarly short.Now recompile your document and you should have all your beautiful references sorted.
You can spend time trying to get the perlbrew installation script working in an alternate shell(e.g., ksh, zsh), but it's easier to just install bash. Most of us already have bash installed on oursystem, but if you haven't done so yet, it's a good time to consider it and join the cool kid club.
doas pkg_add -U bash
Now your ready for the installation.
It's time to play everyone's favorite game, "Do as I say, not as I do."
As you perform this install, keep in mind, you do not want to usesudo
ordoas
for any of thefollowing commands, nor do you want to perform these steps as root. Doing sowill result in thecorruption of your system's perl distribution.
To install Biber on OpenBSD, Perlbrew is required. The installation script for perlbrew is below.
curl -L https://install.perlbrew.pl| bash
Once complete, open your shell's rc file and ensure the following lines are in it.
source~/perl5/perlbrew/etc/bashrc
This can be done with a quick grep,cat ~/.bashrc | grep perlbrew
, and if you do not see it you can useecho to add it,echo "source ~/perl5/perlbrew/etc/bashrc" >> ~/.bashrc
.
You will need to use perlbrew to build and install the latest stable perl release. This will takeseveral minutes to compile.
perlbrew install perl-stable> /dev/null2>&1| tail -f~/perl5/perlbrew/build.perl-*.log
Next install cpm, the perl package manager. If your not familiar with cpm, it is a little different from cpan,but it is much faster. Cpm by defaults install packages by creating a local folder for perllibraries, and places the installed packages there, this is not what we want. What we want is forcpm to install packages in perlbew’s path where perlbrew can find it. This is done with use of the-g
flag. Everytime you run cpm, you will need to use the-g
flag, which tells cpm the packagesare to be installed for global use, just like you would with npm.
perlbrew install-cpm
Now that perlbrew and cpm are setup, it is best to open up a new shell to prevent any of theenvironment variables we are about to setup from bleading over into other actions you might do lateron.
Once a new shell is open, inform perlbrew you want to use the perl release you just installed.
perlbrew use$(perlbrew list)
This will setup all of those environmental variables we talked about, and should complete the setupof perlbrew for the install.
For this build to work and have all the preconfigured paths worked properly, a work directory named"Sandbox" will need to be used to contain all the folders and files. If you do not already have asandbox, go ahead and create that directory.
mkdir -p$HOME/Sandbox&&cd$_
Go ahead and clone the repository with the source code for biber inside your sandbox.
git clone https://github.com/plk/biber
It is time to install the required perl dependencies for the build, which will be done withcpm. This will be done in two steps as to avoid cpm from returning an error message stating you aremissing a required perl library.
# First install the build module to avoid the error.cpm install -g Module::Build# Then install the remainder of the dependencies needed for the build.cpm install -g Readonly::XS Pod::Simple Pod::Simple::TranscodeSmart \Pod::Simple::TranscodeDumb Pod::Perldoc Text::BibTeX Text::CSV IO::Socket::SSL DateTime DateTime::Format::Builder DateTime::Calendar::Julian XML::LibXML::Simple XML::LibXSLT
OK, I admit it. I screwed up and forgot to mention this the first time I wrote this file.
Before going any further, take the time to installpp
the perl packer. Later on, the distribution buildscript will usepp
to package the biber binary you are diligently working to build.
cpm install -g pp
This is where the other files in this repository play an important role. Take a moment to examinethis repository’s tree structure. You will want to follow the same structure when you copy the filesfrom this repository into the root folder of the biber repository you just cloned.
.|-- README.md|-- dist|`-- openbsd_amd64||-- biber.files|`-- build.sh`--local`-- libcrypt.so.2
You should still be in the root of your sandbox; if not,cd ~/Sandbox
. Clone this repository. In other words,cd..
.
git clone https://github.com/anoduck/Biber-OpenBSD&&cd Biber-OpenBSD
Now copy the contents of this repository into your biber repository, ensuring to maintain the same folderstructure.
cp -r dist/openbsd_amd64 ../biber/dist/# ANDcp -rlocal ../biber/
This should setup the biber repository for a successful build.
Having to rarely compile perl binaries from source, the next few steps threw me for a loop the firsttime. This is because developers often provide, and sometimes are required to provide, users withdifferent means to install their software. With biber, this is not the case, and perl provides allthe flexibility for different platforms one might need.
Change Directory into the biber repository.
cd ../biber
Runningperl Build.PL
, will generate a script file confusingly labeled "Build". This script willbe used to ensure we have satisfied all the required dependencies, build all of biber’s libraries,and prepare the "dist" file for compilation.
# Generate the "Build" scriptperl Build.PL# Use "Build" to confirm the dependencies./Build installdeps# Then use "Build" to build biber's libraries./Build# Finally install those libraries locally./Build install
Btparse is "the C component of btOOL, a pair of libraries for parsing andprocessing BibTeX files."
In order to install the bparse package for perl, you will need to manually install ityourself. This involves downloading the library, compiling it, and installing it in your perlbrewlibrary path. Perlbrew makes doing all of this fairly straight forward.
At the time of writing, the current stable perl release is5.38.2
. This is important, because youneed to make sure the downloaded library is compatible with the version of perl you installed. Thesource code for this package can be found onlaunchpad. The url for thesource archive used to successfully build biber is included in the command below. So, let’s downloadit (usingftp
as it is native to OpenBSD).
ftp https://launchpad.net/ubuntu/+archive/primary/+sourcefiles/libtext-bibtex-perl/0.88-3build3/libtext-bibtex-perl_0.88.orig.tar.gz
Extract it, cd into it, and run the build script.
tar -zxvf libtext-bibtex-perl_0.88.orig.tar.gz&&cd Text-BibTeX-0.88&& perl Build.PL&& ./Build
Once successfully built, you will need to move/merge parts of this directory into the biber repo. Specifically, youwill need to merge theblib
folder from this directory with theblib
folder in the biberrepository.
# If you use the standard cpcp -R blib/* ../../blib/# If you use gnu cpcp -r blib/* ../../blib/
Now biber is ready to be built, and it’s about damn time. You will need to change directory intoOpenBSD’s distribution specific folder and run the build from there.
cd dist/openbsd_amd64./build.sh
You might need to update the version number of libraries inbuild.sh
. You may also need to install some (e.g.,doas pkg_add gdbm openssl-3.3.2p0v0
).
Being brutally honest, it took four tries before a functioning biber executable was built. Every oneof those four builds completed, but failed to run during testing. So testing your build isimportant.
To test your newly created binary, you will want to change directories to the "testfiles" directorylocated in the root of the biber repository. From there, test with the following command.
# Change Dircd ../../testfiles# Now run the test../dist/openbsd_amd64/biber-2.8.amd64-openbsd7 --validate-control --convert-controltest
If the test checks out, you now have a working biber binary.
Since the binary we just built is a self extracting archive, containing within itself all the neededlibraries to function, it can safely be placed in your path at/usr/local/bin/biber
. Which is where Emacswill look for it, in case you are wondering.
As for Perlbrew, you can purge it from your system if desired, but it is recommended to keep Perlbrewinstalled for future builds of biber. Instead just remove the currently installed perl build and disable perlbrew.This will reduce the overall consumption of disk space greatly.
# See what version of perl you installedperlbrew list# And then remove that version. Ex. 5.38.2perlbrew uninstall perl-5.38.2# Then disable perlbrew for this shellperlbrew off
And, with that your done!
- Just be aware the executable is built from perl libraries that may not be native to your system. Morethan likely, this never should be the cause of any issues, but is healthy to keep a mental note of it.
👤Anoduck
- Website:http://anoduck.github.io
- Github:@anoduck
Give a ⭐️ if this project helped you!
Copyright © 2024Anoduck.
This project isMIT licensed. Why this link does not include my username isunknown.
This README was generated with ❤️ byreadme-md-generator
About
A repository for needed files to build Biber on OpenBSD; Discovered out of desparation in the middle of the night.