Building the Development Version of Emacs on FreeBSD

Today in our series “How To Build Emacs For Fun And No Profit Whatsoever“, we’ve reached FreeBSD.

Building Emacs here is very straightforward. First, as root, install the compilation dependencies like this:

pkg update -f
pkg install -y autoconf git gmake pkgconf texinfo
pkg install -y `pkg rquery %dn emacs-devel`

Then, as a non-root user, do:

git clone https://git.savannah.gnu.org/git/emacs.git
cd emacs
gmake -j4
./src/emacs

There! Almost as easy as on Debian!

You’re now ready to help fix Emacs bugs on FreeBSD I mean use Emacs:

7 thoughts on “Building the Development Version of Emacs on FreeBSD”

  1. Hi Lars,

    We maintain an emacs-devel package that gets updated twice a month, so if a build from a specific commit isn’t required then this is sufficient:

    pkg install emacs-devel

    Otherwise, in your recipe above when you do

    pkg install -y `pkg search -dx emacs-26.3 | egrep -v “[A-Z]|emacs-“`

    you could replace emacs-26.3 (now emacs-27.1) with emacs-devel. Also, I think you are missing a ‘^’ before ‘[A-Z]’.

    We can get lonely when no one notices us, so thanks for giving FreeBSD some needed attention. 🙂

    Joe

  2. Hi Lars,

    I’ve just followed your advice, thanks. There was one problem to solve:

    configure: error: The following required libraries were not found:
    gnutls

    So I did

    ./configure –with-gnutls=ifavailable

    gnutls seems to be installed already, so I have no clue why this error happened. /usr/local/lib/libgnutls.so exists (a symlink to libgnutls.so.30.28.1). Either the library path is missing, or the configure script does not test properly on FreeBSD. Note, that I’m a n00b on FreeBSD.

  3. Hi Lars and Michael,

    Michael, I believe the issue is that the pkgconf package is missing.

    Regards,

    Joe

    P.S.

    – As an aside, gcc is not necessary because a base compiler is available, which is the default compiler used when building our (FreeBSD) official packages.

    – I think the recipe could be slightly modified to this.

    pkg install -y autoconf git gmake pkgconf texinfo
    pkg install -y `pkg rquery %dn emacs-devel`

    git clone https://git.savannah.gnu.org/git/emacs.git
    cd emacs
    gmake -j4
    ./src/emacs

    1. I’ve applied this recipe on a virgin FreeBSD 12.1 VM. It runs smoothly.

      Maybe you can add the extra packages, like pkgconfig, also to the list which is returned by rquery on emacs-devel?

Leave a Reply