From acb37f7e458d8da1fc7bc0271831763a0141176a Mon Sep 17 00:00:00 2001 From: jiahuili Date: Wed, 20 Jul 2022 14:45:42 -0500 Subject: [PATCH] rebar3: Makefile `make release` `./dev/run` is using `reltoo.config` `rebar3 release` is using `relx` For `make release`, changed `couchdb` with `start` because it's hardcoded in relx. see https://github.com/erlware/relx/blob/main/src/rlx_assemble.erl#L828 `./dev/run` uses reltoo.config, while the rebar3 version uses `Relax`. Changed `couchdb` with `start` because it's hardcoded and relaxing. --- Makefile | 10 +++++----- rebar.config.script | 43 +++++++++++++++++++++++++++++++++++++++- rel/files/couchdb.cmd.in | 2 +- rel/files/couchdb.in | 2 +- 4 files changed, 49 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 1c7923e1338..30d732c0442 100644 --- a/Makefile +++ b/Makefile @@ -365,12 +365,12 @@ dist: all derived release: all @echo "Installing CouchDB into rel/couchdb/ ..." @rm -rf rel/couchdb - @$(REBAR) generate # make full erlang release - @cp bin/weatherreport rel/couchdb/bin/weatherreport + @$(REBAR3) release # make full erlang release + @cp -r _build/default/rel/couchdb rel/couchdb ifeq ($(with_fauxton), 1) @mkdir -p rel/couchdb/share/ - @cp -R share/www rel/couchdb/share/ + @cp -R _build/default/share/www rel/couchdb/share/ endif ifeq ($(with_docs), 1) @@ -382,8 +382,8 @@ ifeq ($(IN_RELEASE), true) else @mkdir -p rel/couchdb/share/www/docs/ @mkdir -p rel/couchdb/share/docs/ - @cp -R apps/docs/build/html/ rel/couchdb/share/www/docs - @cp apps/docs/build/man/apachecouchdb.1 rel/couchdb/share/docs/couchdb.1 + @cp -R _build/default/lib/docs/build/html/ rel/couchdb/share/www/docs + @cp _build/default/lib/docs/build/man/apachecouchdb.1 rel/couchdb/share/docs/couchdb.1 endif endif diff --git a/rebar.config.script b/rebar.config.script index 5abcd3a2c9d..7c626086e3c 100644 --- a/rebar.config.script +++ b/rebar.config.script @@ -159,7 +159,48 @@ AddConfig = [ {plt_extra_apps, [ asn1, compiler, crypto, inets, kernel, runtime_tools, sasl, setup, ssl, stdlib, syntax_tools, xmerl]}, - {warnings, [unmatched_returns, error_handling, race_conditions]}]}, + {warnings, [unmatched_returns, error_handling, race_conditions]} + ]}, + {relx, [ + {release, {couchdb, "3.2.2"}, [ + %% stdlib + asn1, compiler, crypto, inets, runtime_tools, + sasl, ssl, syntax_tools, xmerl, + + %% couchdb + b64url, bear, chttpd, config, couch, couch_epi, + couch_index, couch_log, couch_mrview, couch_plugins, + couch_replicator, couch_stats, couch_tests, couch_event, + couch_peruser, couch_dist, custodian, ddoc_cache, + dreyfus, ets_lru, fabric, folsom, global_changes, + hyper, ibrowse, ioq, jiffy, jwtf, ken, khash, mango, + mem3, mochiweb, rexi, setup, smoosh, snappy, + weatherreport, couch_prometheus, + + %% extra + recon, triq + ]}, + + {mode, prod}, + {overlay_vars, "rel/couchdb.config"}, + {sys_config, "rel/files/sys.config"}, + {vm_args, "rel/files/vm.args"}, + {check_for_undefined_functions, false}, + {overlay, [ + {copy, "LICENSE", "LICENSE"}, + {mkdir, "var/log"}, + {copy, "rel/overlay/bin", "bin"}, + {copy, "rel/overlay/etc", "etc"}, + {copy, "bin/couchjs", "bin/couchjs"}, + {copy, "share/server/main.js", "share/rserver/main.js"}, + {copy, "share/server/main-coffee.js", "share/server/main-coffee.js"}, + {copy, "bin/weatherreport", "bin/weatherreport"}, + {template, "rel/overlay/etc/default.ini", "etc/default.ini"}, + {template, "rel/overlay/etc/vm.args", "etc/vm.args"}, + {template, "rel/files/couchdb.in", "bin/couchdb"}, + {template, "rel/files/couchdb.cmd.in", "bin/couchdb.cmd"} + ]} + ]}, {post_hooks, [{compile, "escript support/build_js.escript"}]} ]. diff --git a/rel/files/couchdb.cmd.in b/rel/files/couchdb.cmd.in index 244803bc80f..0acc53bb51c 100644 --- a/rel/files/couchdb.cmd.in +++ b/rel/files/couchdb.cmd.in @@ -29,7 +29,7 @@ IF NOT DEFINED COUCHDB_QUERY_SERVER_JAVASCRIPT SET COUCHDB_QUERY_SERVER_JAVASCRI IF NOT DEFINED COUCHDB_QUERY_SERVER_COFFEESCRIPT SET COUCHDB_QUERY_SERVER_COFFEESCRIPT={{prefix}}/bin/couchjs {{prefix}}/share/server/main-coffee.js IF NOT DEFINED COUCHDB_FAUXTON_DOCROOT SET COUCHDB_FAUXTON_DOCROOT={{fauxton_root}} -"%BINDIR%\erl" -boot "%ROOTDIR%\releases\%APP_VSN%\couchdb" ^ +"%BINDIR%\erl" -boot "%ROOTDIR%\releases\%APP_VSN%\start" ^ -args_file "%ROOTDIR%\etc\vm.args" ^ -epmd "%BINDIR%\epmd.exe" ^ -config "%ROOTDIR%\releases\%APP_VSN%\sys.config" %* diff --git a/rel/files/couchdb.in b/rel/files/couchdb.in index 3ebb2e4eedb..de049b4036e 100755 --- a/rel/files/couchdb.in +++ b/rel/files/couchdb.in @@ -46,7 +46,7 @@ ARGS_FILE="${COUCHDB_ARGS_FILE:-$ROOTDIR/etc/vm.args}" [ -n "${COUCHDB_INI_FILES:-}" ] && INI_ARGS="-couch_ini $COUCHDB_INI_FILES" SYSCONFIG_FILE="${COUCHDB_SYSCONFIG_FILE:-$ROOTDIR/releases/$APP_VSN/sys.config}" -exec "$BINDIR/erlexec" -boot "$ROOTDIR/releases/$APP_VSN/couchdb" \ +exec "$BINDIR/erlexec" -boot "$ROOTDIR/releases/$APP_VSN/start" \ -args_file "${ARGS_FILE}" \ ${INI_ARGS:-} \ -config "${SYSCONFIG_FILE}" "$@"