diff --git a/Makefile b/Makefile index 80a1586..5e1c36f 100644 --- a/Makefile +++ b/Makefile @@ -12,48 +12,52 @@ MAN_DST_DIR = $(TARGET_DIR)/man FEATURES = openssl_dyn -all: update acmed tacd man +all: update acmed tacd update: cargo update -acmed: +acmed: man_dir if test -n "$(TARGET)"; then \ cargo build --release --manifest-path "acmed/Cargo.toml" --no-default-features --features "$(FEATURES)" --target "$(TARGET)"; \ else \ cargo build --release --manifest-path "acmed/Cargo.toml" --no-default-features --features "$(FEATURES)"; \ fi strip "$(TARGET_DIR)/acmed" + gzip <"$(MAN_SRC_DIR)/acmed.8" >"$(MAN_DST_DIR)/acmed.8.gz" + gzip <"$(MAN_SRC_DIR)/acmed.toml.5" >"$(MAN_DST_DIR)/acmed.toml.5.gz" -tacd: +tacd: man_dir if test -n "$(TARGET)"; then \ cargo build --release --manifest-path "tacd/Cargo.toml" --no-default-features --features "$(FEATURES)" --target "$(TARGET)"; \ else \ cargo build --release --manifest-path "tacd/Cargo.toml" --no-default-features --features "$(FEATURES)"; \ fi strip "$(TARGET_DIR)/tacd" + gzip <"$(MAN_SRC_DIR)/tacd.8" >"$(MAN_DST_DIR)/tacd.8.gz" -man: +man_dir: @mkdir -p $(MAN_DST_DIR) - gzip <"$(MAN_SRC_DIR)/acmed.8" >"$(MAN_DST_DIR)/acmed.8.gz" - gzip <"$(MAN_SRC_DIR)/acmed.toml.5" >"$(MAN_DST_DIR)/acmed.toml.5.gz" - gzip <"$(MAN_SRC_DIR)/tacd.8" >"$(MAN_DST_DIR)/tacd.8.gz" install: install -d -m 0755 $(DESTDIR)$(BINDIR) - install -d -m 0755 $(DESTDIR)$(MAN5DIR) install -d -m 0755 $(DESTDIR)$(MAN8DIR) - install -d -m 0755 $(DESTDIR)$(SYSCONFDIR)/acmed/certs - install -d -m 0700 $(DESTDIR)$(SYSCONFDIR)/acmed/accounts - install -m 0755 $(TARGET_DIR)/acmed $(DESTDIR)$(BINDIR)/acmed - install -m 0755 $(TARGET_DIR)/tacd $(DESTDIR)$(BINDIR)/tacd - install -m 0644 $(TARGET_DIR)/man/acmed.8.gz $(DESTDIR)$(MAN8DIR)/acmed.8.gz - install -m 0644 $(TARGET_DIR)/man/acmed.toml.5.gz $(DESTDIR)$(MAN5DIR)/acmed.toml.5.gz - install -m 0644 $(TARGET_DIR)/man/tacd.8.gz $(DESTDIR)$(MAN8DIR)/tacd.8.gz - install -m 0644 acmed/config/acmed.toml $(DESTDIR)$(SYSCONFDIR)/acmed/acmed.toml - install -m 0644 acmed/config/default_hooks.toml $(DESTDIR)$(SYSCONFDIR)/acmed/default_hooks.toml + if test -f "$(TARGET_DIR)/acmed"; then \ + install -d -m 0755 $(DESTDIR)$(MAN5DIR); \ + install -d -m 0755 $(DESTDIR)$(SYSCONFDIR)/acmed/certs; \ + install -d -m 0700 $(DESTDIR)$(SYSCONFDIR)/acmed/accounts; \ + install -m 0755 $(TARGET_DIR)/acmed $(DESTDIR)$(BINDIR)/acmed; \ + install -m 0644 $(TARGET_DIR)/man/acmed.8.gz $(DESTDIR)$(MAN8DIR)/acmed.8.gz; \ + install -m 0644 $(TARGET_DIR)/man/acmed.toml.5.gz $(DESTDIR)$(MAN5DIR)/acmed.toml.5.gz; \ + install -m 0644 acmed/config/acmed.toml $(DESTDIR)$(SYSCONFDIR)/acmed/acmed.toml; \ + install -m 0644 acmed/config/default_hooks.toml $(DESTDIR)$(SYSCONFDIR)/acmed/default_hooks.toml; \ + fi + if test -f "$(TARGET_DIR)/tacd"; then \ + install -m 0755 $(TARGET_DIR)/tacd $(DESTDIR)$(BINDIR)/tacd; \ + install -m 0644 $(TARGET_DIR)/man/tacd.8.gz $(DESTDIR)$(MAN8DIR)/tacd.8.gz; \ + fi clean: cargo clean -.PHONY: all update acmed tacd man install clean +.PHONY: all update acmed tacd man_dir install clean diff --git a/README.md b/README.md index 42a324d..a885d68 100644 --- a/README.md +++ b/README.md @@ -77,6 +77,29 @@ $ make install To build ACMEd and tacd inside a temporary Docker container, use the `contrib/build-docker.sh` helper script. It currently supports Debian Buster / Stretch. +### Advanced options + +You can specify a space or comma separated list of features to activate in the `FEATURE` variable. The possible features are: + +- `openssl_dyn` (default): use OpenSSL as the cryptographic library, dynamically linked (mutually exclusive with `openssl_vendored`). +- `openssl_vendored`: use OpenSSL as the cryptographic library, statically linked (mutually exclusive with `openssl_dyn`). + +You can also specify the target triple to build for in the `TARGET` variable. Please note that, if used, this variable must be specified for both `make` and `make install`. + +For example, you can build statically linked binaries using the `openssl_vendored` feature and the `x86_64-unknown-linux-musl` target. + +``` +make FEATURES="openssl_vendored" TARGET="x86_64-unknown-linux-musl" +``` + +### Packaging + +Most of the time, when packaging, you want to install the program in a dedicated directory. This is possible using the `DESTDIR` variable. + +``` +make DESTDIR="/path/to/my/package/directory" install +``` + ## Frequently Asked Questions