Skip to content

Commit

Permalink
autotools -> meson
Browse files Browse the repository at this point in the history
There are some known regressions regarding local testing setups - since
everything was kinda half written with the expectation that build dir =
source dir (which should not be true anymore). But everything builds and
the test suite runs fine, after several hours spent debugging random
crashes in libpqxx with MALLOC_PERTURB_...

(cherry picked from commit 4b886d9)
  • Loading branch information
delroth authored and Ericson2314 committed Nov 14, 2024
1 parent d0cfbed commit 078d782
Show file tree
Hide file tree
Showing 26 changed files with 207 additions and 322 deletions.
42 changes: 1 addition & 41 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,47 +1,7 @@
/.pls_cache
*.o
*~
Makefile
Makefile.in
.deps
.hydra-data
/config.guess
/config.log
/config.status
/config.sub
/configure
/depcomp
/libtool
/ltmain.sh
/autom4te.cache
/aclocal.m4
/missing
/install-sh
.test_info.*
/src/sql/hydra-postgresql.sql
/src/sql/hydra-sqlite.sql
/src/sql/tmp.sqlite
/src/root/static/bootstrap
/src/root/static/js/flot
/tests
/doc/manual/images
/doc/manual/manual.html
/doc/manual/manual.pdf
/t/.bzr*
/t/.git*
/t/.hg*
/t/nix
/t/data
/t/jobs/config.nix
t/jobs/declarative/project.json
/inst
hydra-config.h
hydra-config.h.in
result
result-*
outputs
config
stamp-h1
src/hydra-evaluator/hydra-evaluator
src/hydra-queue-runner/hydra-queue-runner
src/root/static/fontawesome/
src/root/static/bootstrap*/
2 changes: 0 additions & 2 deletions .yath.rc

This file was deleted.

12 changes: 0 additions & 12 deletions Makefile.am

This file was deleted.

90 changes: 0 additions & 90 deletions configure.ac

This file was deleted.

4 changes: 0 additions & 4 deletions doc/Makefile.am

This file was deleted.

6 changes: 0 additions & 6 deletions doc/manual/Makefile.am

This file was deleted.

33 changes: 33 additions & 0 deletions doc/manual/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
srcs = files(
'src/SUMMARY.md',
'src/about.md',
'src/api.md',
'src/configuration.md',
'src/hacking.md',
'src/installation.md',
'src/introduction.md',
'src/jobs.md',
'src/monitoring/README.md',
'src/notifications.md',
'src/plugins/README.md',
'src/plugins/RunCommand.md',
'src/plugins/declarative-projects.md',
'src/projects.md',
'src/webhooks.md',
)

manual = custom_target(
'manual',
command: [
mdbook, 'build', '@SOURCE_ROOT@/doc/manual', '-d', meson.current_build_dir() / 'html'
],
depend_files: srcs,
output: ['html'],
build_by_default: true,
)

install_subdir(
manual.full_path(),
install_dir: get_option('datadir') / 'doc/hydra',
strip_directory: true,
)
36 changes: 36 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
project('hydra', 'cpp',
version: files('version.txt'),
license: 'GPL-3.0',
default_options: [
'debug=true',
'optimization=2',
'cpp_std=c++20',
],
)

nix_expr_dep = dependency('nix-expr', required: true)
nix_main_dep = dependency('nix-main', required: true)
nix_store_dep = dependency('nix-store', required: true)

# Lix/Nix need extra flags not provided in its pkg-config files.
nix_dep = declare_dependency(
dependencies: [
nix_expr_dep,
nix_main_dep,
nix_store_dep,
],
compile_args: ['-include', 'nix/config.h'],
)

pqxx_dep = dependency('libpqxx', required: true)

prom_cpp_core_dep = dependency('prometheus-cpp-core', required: true)
prom_cpp_pull_dep = dependency('prometheus-cpp-pull', required: true)

mdbook = find_program('mdbook', native: true)
perl = find_program('perl', native: true)

subdir('doc/manual')
subdir('nixos-modules')
subdir('src')
subdir('t')
4 changes: 4 additions & 0 deletions nixos-modules/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
install_data('hydra.nix',
install_dir: get_option('datadir') / 'nix',
rename: ['hydra-module.nix'],
)
35 changes: 17 additions & 18 deletions package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
, git

, makeWrapper
, autoreconfHook
, meson
, ninja
, nukeReferences
, pkg-config
, mdbook
Expand Down Expand Up @@ -92,6 +93,7 @@ let
DigestSHA1
EmailMIME
EmailSender
FileCopyRecursive
FileLibMagic
FileSlurper
FileWhich
Expand Down Expand Up @@ -139,28 +141,22 @@ stdenv.mkDerivation (finalAttrs: {
src = fileset.toSource {
root = ./.;
fileset = fileset.unions ([
./version.txt
./configure.ac
./Makefile.am
./src
./doc
./nixos-modules/hydra.nix
# These are always needed to appease Automake
./t/Makefile.am
./t/jobs/config.nix.in
./t/jobs/declarative/project.json.in
] ++ lib.optionals finalAttrs.doCheck [
./meson.build
./nixos-modules
./src
./t
./version.txt
./.perlcriticrc
./.yath.rc
]);
};

strictDeps = true;

nativeBuildInputs = [
makeWrapper
autoreconfHook
meson
ninja
nukeReferences
pkg-config
mdbook
Expand Down Expand Up @@ -228,6 +224,12 @@ stdenv.mkDerivation (finalAttrs: {

OPENLDAP_ROOT = openldap;

mesonBuildType = "release";

postPatch = ''
patchShebangs .
'';

shellHook = ''
pushd $(git rev-parse --show-toplevel) >/dev/null
Expand All @@ -241,14 +243,11 @@ stdenv.mkDerivation (finalAttrs: {
popd >/dev/null
'';

NIX_LDFLAGS = [ "-lpthread" ];

enableParallelBuilding = true;

doCheck = true;

mesonCheckFlags = [ "--verbose" ];

preCheck = ''
patchShebangs .
export LOGNAME=''${LOGNAME:-foo}
# set $HOME for bzr so it can create its trace file
export HOME=$(mktemp -d)
Expand Down
3 changes: 0 additions & 3 deletions src/Makefile.am

This file was deleted.

5 changes: 0 additions & 5 deletions src/hydra-evaluator/Makefile.am

This file was deleted.

9 changes: 9 additions & 0 deletions src/hydra-evaluator/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
hydra_evaluator = executable('hydra-evaluator',
'hydra-evaluator.cc',
dependencies: [
libhydra_dep,
nix_dep,
pqxx_dep,
],
install: true,
)
8 changes: 0 additions & 8 deletions src/hydra-queue-runner/Makefile.am

This file was deleted.

22 changes: 22 additions & 0 deletions src/hydra-queue-runner/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
srcs = files(
'builder.cc',
'build-remote.cc',
'build-result.cc',
'dispatcher.cc',
'hydra-queue-runner.cc',
'nar-extractor.cc',
'queue-monitor.cc',
)

hydra_queue_runner = executable('hydra-queue-runner',
'hydra-queue-runner.cc',
srcs,
dependencies: [
libhydra_dep,
nix_dep,
pqxx_dep,
prom_cpp_core_dep,
prom_cpp_pull_dep,
],
install: true,
)
Loading

0 comments on commit 078d782

Please sign in to comment.