Skip to content

Remove config files generation from Makefiles #234

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Apr 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ default all: build

.PHONY: build
build:
${MAKE} -C src
dune build -p ocsigenserver
${MAKE} -C src/server build
doc:
$(MAKE) -C doc

Expand All @@ -28,13 +29,14 @@ top:
### Cleaning ###

clean: clean.local
${MAKE} -C src clean
${MAKE} -C src/server clean

clean.local:
dune clean
-rm -f ocsigenserver-*.tar.gz

distclean: clean.local
${MAKE} -C src distclean
${MAKE} -C src/server distclean
-make -C doc clean
-rm Makefile.config
-rm -f *~ \#* .\#*
Expand Down Expand Up @@ -76,9 +78,9 @@ install.files:
@echo INSTALL_CAN_PUT_PERMISSIONS: ${INSTALL_CAN_PUT_PERMISSIONS}
## Configuration files
$(INSTALL) -m ${INSTALL_MOD_755} -d $(TEMPROOT)$(CONFIGDIR)/conf.d
${INSTALL} -m ${INSTALL_MOD_644} ocsigenserver.conf.sample $(TEMPROOT)$(CONFIGDIR)/
${INSTALL} -m ${INSTALL_MOD_644} _build/install/default/etc/ocsigenserver/ocsigenserver.conf.sample $(TEMPROOT)$(CONFIGDIR)/
[ -f $(TEMPROOT)$(CONFIGDIR)/ocsigenserver.conf ] || \
{ $(INSTALL) -m ${INSTALL_MOD_644} ocsigenserver.conf.sample \
{ $(INSTALL) -m ${INSTALL_MOD_644} _build/install/default/etc/ocsigenserver/ocsigenserver.conf.sample \
$(TEMPROOT)$(CONFIGDIR)/ocsigenserver.conf; }
-mv $(TEMPROOT)$(CONFIGDIR)/mime.types $(TEMPROOT)$(CONFIGDIR)/mime.types.old
## Log directory
Expand Down
9 changes: 0 additions & 9 deletions Makefile.options
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,3 @@ INCS= -I ${BLD}/server/.ocsigenserver.objs/byte \
SERVER_PACKAGE := lwt_ssl,bytes,lwt.unix,lwt_log,ipaddr,findlib,cryptokit,re,str,xml-light,dynlink,cohttp-lwt-unix

LIBS := -package ${SERVER_PACKAGE} ${INCS}

INITPACKAGE := \"$(shell ${OCAMLFIND} query -p-format -recursive \
-separator '\";\"' ${SERVER_PACKAGE})\"; \
\"ocsigenserver.polytables\"; \
\"ocsigenserver.cookies\"; \
\"ocsigenserver.baselib.base\"; \
\"ocsigenserver.baselib\"; \
\"ocsigenserver.http\"; \
\"ocsigenserver\"; \
37 changes: 19 additions & 18 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ set_defaults () {
bindir=""
logdir=""
libdir=""
libdir_set=0
mandir=""
docdir=""
sysconfdir="/etc/ocsigenserver"
Expand Down Expand Up @@ -282,6 +283,7 @@ while [ "$#" -gt 0 ]; do
;;
--libdir)
libdir="$2"
libdir_set=1
shift
shift
;;
Expand Down Expand Up @@ -485,32 +487,14 @@ CC := gcc
# optional
RLWRAP := $rlwrap


### Options ###

# User who will run Ocsigen server (not root) (eg, for debian, www-data)
# (This user must exist on your system)
OCSIGENUSER := $ocsigen_user

# group who will run Ocsigen server (not root) (eg, for debian, www-data)
# (This group must exist)
OCSIGENGROUP := $ocsigen_group


### Paths ###

# Temporary root directory to install the package (usually always "" but for package makers)
TEMPROOT := $temproot

# The directory for ocsigen server (binary):
BINDIR := $root$bindir

# The directory for ocsigen manpage:
MANDIR := $root$mandir

# Where to install the libraries
LIBDIR := $libdir

# ocsigen's logs:
LOGDIR := $root$logdir

Expand Down Expand Up @@ -538,6 +522,23 @@ SRC := $full_pwd
include \$(SRC)/Makefile.options
_EOF_

echo "Writing config options"
cat <<_EOF_ > $my_pwd/src/files/ocsigenserver.conf/options.ml
let version = "$version"
let src = "$full_pwd"
let port = 80
let bindir = "$root$bindir"
let libdir = "$libdir"
let libdir_set = $libdir_set
let logdir = "$root$logdir"
let configdir = "$root$sysconfdir"
let staticpagesdir = "$root$staticpagesdir"
let datadir = "$root$datadir"
let uploaddir = "$root$uploaddir"
let commandpipe = "$root$commandpipe"
let mimefile = "$root$sysconfdir/mime.types"
_EOF_

######################################################################
# Finish

Expand Down
23 changes: 23 additions & 0 deletions dune
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,26 @@
(_
(flags
(:standard -w -69))))

(rule
(target ocsigenserver.conf.sample)
(action
(with-stdout-to
%{target}
(run src/files/ocsigenserver.conf/gen.exe sample))))

(install
(files ocsigenserver.conf.sample)
(section etc)
(package ocsigenserver))

(subdir
local/etc
(rule
(mode
(promote (until-clean)))
(target ocsigenserver.conf)
(action
(with-stdout-to
%{target}
(run ../../src/files/ocsigenserver.conf/gen.exe local)))))
1 change: 0 additions & 1 deletion ocsigenserver.opam
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ build: [
"--sysconfdir"
"%{lib}%/ocsigenserver/etc/ocsigenserver"
]
[make "-C" "src" "confs"]
["dune" "build" "-p" name "-j" jobs]
]
install:[make "install.files"]
1 change: 0 additions & 1 deletion ocsigenserver.opam.template
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ build: [
"--sysconfdir"
"%{lib}%/ocsigenserver/etc/ocsigenserver"
]
[make "-C" "src" "confs"]
["dune" "build" "-p" name "-j" jobs]
]
install:[make "install.files"]
65 changes: 0 additions & 65 deletions src/Makefile

This file was deleted.

39 changes: 0 additions & 39 deletions src/baselib/Makefile

This file was deleted.

5 changes: 5 additions & 0 deletions src/baselib/dune
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,8 @@
from
(dynlink -> dynlink_wrapper.natdynlink.ml)
(_ -> dynlink_wrapper.nonatdynlink.ml))))

(rule
(with-stdout-to
ocsigen_config_static.ml
(run ../files/ocsigenserver.conf/gen.exe static.ml)))
14 changes: 0 additions & 14 deletions src/extensions/Makefile

This file was deleted.

40 changes: 0 additions & 40 deletions src/files/ocsigenserver.conf.in

This file was deleted.

3 changes: 3 additions & 0 deletions src/files/ocsigenserver.conf/dune
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
(executable
(name gen)
(libraries str unix))
Loading