0

I have a Common Lisp project that has a dependency on a C/C++ library that's hosted on GitHub. I need to clone, configure, and make this dependency in order for my project to work and I'd prefer to do this from within Common Lisp rather than providing a shell script.

What's the best way to automate this for a Common Lisp project? I tried replicating my shell commands with INFERIOR-SHELL, but it crashes on git clone.

user1569339
  • 683
  • 8
  • 20

2 Answers2

1

Some possibilities:

  • If your project is, itself, a Git repo (GitHub or otherwise), make the C library a submodule.

    git submodule add --name clib git@github.com:someone/clib ./src/clib

  • Alternatively, perhaps use drakma or your favored HTTP client (even, perhaps, shelling out to curl or wget) to pull a tarball of the sources down from GitHub instead of cloning. (Assuming you're only interested in building, and not editing, the package.)

  • Run the entire checkout-and-build process from a Makefile. inferior-shell may be doable; I typically use uiop:run-program since ASDF provides it, and just call out to make.

```

   all: src/clib/lib/libclib.so

   src/clib/lib/libclib.so: src/clib/Makefile
             $(MAKE) -C src/clib all

   src/clib/Makefile: src/clib/configure
             cd src/clib; ./configure

   src/clib/configure: src/clib/configure.in
             cd src/clib; autoconf

   src/clib/configure.in:
             git clone https://github.com/someone/clib ./src/clib     

```

You didn't mention what error you're getting from git clone, but I'm going to guess that it's expecting user input (eg, perhaps to unlock your SSH keychain). Assuming it's a public-visible project, you might do better to use the https: URI rather than SSH (git@github.com:) version.

BRPocock
  • 13,638
  • 3
  • 31
  • 50
  • 1
    I switched to using an HTTP client to download a zip of the source and then unzipping it, which worked. Once unzipped I need to call out to a python configuration script, then calling make. – user1569339 Dec 23 '15 at 20:12
0

There isn't something like this working well on common lisp. From this article , the actual state of common lisp ecosystem, in the section Build system:

Future Work:

More ASDF components, e.g. for building C/C++ files. A platform-independent package manager for downloading the external C libraries required by a Lisp library would be amazingly useful.

you shoul look from depencies inside projects.

Community
  • 1
  • 1
anquegi
  • 11,125
  • 4
  • 51
  • 67