Skip to content

Commit

Permalink
autotools -> meson
Browse files Browse the repository at this point in the history
Original commit message:

> 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_...

I have not experienced regressions with local testing.

(cherry picked from commit 4b886d9)
  • Loading branch information
delroth authored and Ericson2314 committed Nov 24, 2024
1 parent f974891 commit 182a48c
Show file tree
Hide file tree
Showing 30 changed files with 391 additions and 329 deletions.
42 changes: 1 addition & 41 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,48 +1,8 @@
/.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/hydra-eval-jobs/hydra-eval-jobs
/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.

91 changes: 0 additions & 91 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.

36 changes: 36 additions & 0 deletions doc/manual/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
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,
)
2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
pkgs.runCommand "hydra-manual-${hydra.version}" { }
''
mkdir -p $out/share
cp -prvd ${hydra}/share/doc $out/share/
cp -prvd ${hydra.doc}/share/doc $out/share/
mkdir $out/nix-support
echo "doc manual $out/share/doc/hydra" >> $out/nix-support/hydra-build-products
Expand Down
40 changes: 40 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
project('hydra', 'cpp',
version: files('version.txt'),
license: 'GPL-3.0',
default_options: [
'debug=true',
'optimization=2',
'cpp_std=c++20',
],
)

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

# Nix need extra flags not provided in its pkg-config files.
nix_dep = declare_dependency(
dependencies: [
nix_store_dep,
nix_main_dep,
nix_expr_dep,
nix_flake_dep,
nix_cmd_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'],
)
37 changes: 19 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 @@ -91,6 +92,7 @@ let
DigestSHA1
EmailMIME
EmailSender
FileCopyRecursive
FileLibMagic
FileSlurper
FileWhich
Expand Down Expand Up @@ -138,28 +140,24 @@ 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
]);
};

outputs = [ "out" "doc" ];

strictDeps = true;

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

OPENLDAP_ROOT = openldap;

mesonBuildType = "release";

postPatch = ''
patchShebangs .
'';

shellHook = ''
pushd $(git rev-parse --show-toplevel) >/dev/null
Expand All @@ -238,14 +242,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-eval-jobs/Makefile.am

This file was deleted.

8 changes: 8 additions & 0 deletions src/hydra-eval-jobs/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
hydra_eval_jobs = executable('hydra-eval-jobs',
'hydra-eval-jobs.cc',
dependencies: [
libhydra_dep,
nix_dep,
],
install: true,
)
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.

Loading

0 comments on commit 182a48c

Please sign in to comment.