BPL 3.2 Released

For swipl? The normal installation process on Unix installs $prefix/share/pkgconfig/swipl.pc. For package installation though you do not need that. pack_install/1 passes a number of environment variables to the build process that allows for simple abstract Makefiles:

  • PACKSODIR contains the directory where you should put the shared object
  • SOEXT has the extension for shared objects for this platform
  • LDSOFLAGS provides the C flags to create a compatible shared object
  • SWISOLIB links to libswipl.so/dll/… if this is needed (notably ELF platforms do not
    need this).

Here is a simple example:

SOBJ=   $(PACKSODIR)/geoip4pl.$(SOEXT)

all:    $(SOBJ)

OBJ=    c/geoip4pl.o

$(SOBJ): $(OBJ)
        mkdir -p $(PACKSODIR)
        $(LD) $(LDSOFLAGS) -o $@ $(OBJ) $(SWISOLIB) -lGeoIP

check::
install::
clean:
        rm -f $(OBJ)
distclean: clean
        rm -f $(SOBJ)

For debugging purposes pack_install creates a shell script in the build location that sets the same variables, so you can run the compiler from any environment.