rememberYou / emacs-ideas

šŸ§° Idea box for package development on GNU Emacs
12 stars 0 forks source link

A support library for building packages' native components #5

Open thblt opened 6 years ago

thblt commented 6 years ago

Description

Some Emacs package use native components, written in C, C++ or any other language, that require building on the user's computer. Such packages include irony-mode, mu4e, pdf-tools, intero and a lot more. The common approach is to use a shell script or ad-hoc elisp to install the dependencies using the adequate method for the running OS and try to produce a binary. This is horrible.

The envisioned library would provide a standard way for packages to expose their native component's dependencies and build system and would handle building and rebuilding

Things to Implement [0/5]

Interface for package writers

It could look like this:

(require 'whatever-name-you-want-to-give-the-lib)

(declare-native-component your-package-name
  :type 'program
  :build 'cmake
  :lang 'c++ ; must accept a symbol or a list, determines the binding language for deps.
  :src "server" ; a subdirectory or your-package-name's root dir
  :build-deps '(compiler poppler png zlib)) ;; May be either a list of an alist of (language . deps), so the correct bindings are installed for each language.

From that, the library would create the build environment for the current OS and build the components. Options for installing the components should probably be provided, with reasonable defaults (= just take this binary and put it in your-package-name/bin or /lib

Support for including a simple test could help automate validation of the configuration in all supported OSs and build systems.

Prior art

Packages with a native component:

Package managers with support for building:

thblt commented 6 years ago

I won't have time to do it myself, but I can be of some help with build systems and subshell-based dependency managers, like Nix. (where you don't just install the dependencies then build the program, but the package manager creates a shell into which the build sequence should run)

rememberYou commented 6 years ago

Thank you for the idea.