[M] Change in osmo-dev[master]: Support building open5gs
osmith has submitted this change. ( https://gerrit.osmocom.org/c/osmo-dev/+/35114?usp=email ) Change subject: Support building open5gs .. Support building open5gs Change-Id: Id145443ff53f13740167e9dde6417b7e915b8399 --- A all.buildsystems M all.deps M all.urls M gen_makefile.py 4 files changed, 82 insertions(+), 11 deletions(-) Approvals: osmith: Looks good to me, approved; Verified diff --git a/all.buildsystems b/all.buildsystems new file mode 100644 index 000..fc1784b --- /dev/null +++ b/all.buildsystems @@ -0,0 +1,3 @@ +# Projects with buildsystems other than autotools +# project buildsystem +open5gsmeson diff --git a/all.deps b/all.deps index 4769d02..7857f16 100644 --- a/all.deps +++ b/all.deps @@ -36,6 +36,8 @@ osmo-e1d libosmocore osmo-remsimsimtrace2_host libosmo-netif +open5gs + # can only clone these docker-playground osmo-ttcn3-hacks diff --git a/all.urls b/all.urls index 27aaf6e..dfc8ae7 100644 --- a/all.urls +++ b/all.urls @@ -2,3 +2,4 @@ # project url libnftnl https://git.netfilter.org/libnftnl/ nftables https://git.netfilter.org/nftables/ +open5gshttps://github.com/open5gs/open5gs diff --git a/gen_makefile.py b/gen_makefile.py index 82ebef0..d306364 100755 --- a/gen_makefile.py +++ b/gen_makefile.py @@ -54,6 +54,7 @@ topdir = os.path.dirname(os.path.realpath(__file__)) all_deps_file = os.path.join(topdir, "all.deps") all_urls_file = os.path.join(topdir, "all.urls") +all_buildsystems_file = os.path.join(topdir, "all.buildsystems") parser = argparse.ArgumentParser(epilog=__doc__, formatter_class=argparse.RawTextHelpFormatter) parser.add_argument('configure_opts_files', @@ -152,8 +153,8 @@ l.append((tokens[0], tokens[1:])) return l -def read_projects_urls(path): - 'Read urls config and return dict {project_name: url, …}.' +def read_projects_dict(path): + 'Read urls/buildsystems config and return dict {project_name: url, …}.' ret = {} for line in open(path): line = line.strip() @@ -215,7 +216,9 @@ ''' def gen_makefile_autoconf(proj, src_proj, distclean_cond): - return f''' + buildsystem = projects_buildsystems.get(proj, "autotools") + if buildsystem == "autotools": +return f''' .make.{proj}.autoconf: .make.{proj}.clone {src_proj}/configure.ac if {distclean_cond}; then $(MAKE) {proj}-distclean; fi @echo -e "\\n\\n\\n= $@\\n" @@ -223,11 +226,18 @@ cd {src_proj}; autoreconf -fi sync touch $@ - ''' +''' + elif buildsystem == "meson": +return "" + else: +assert False, f"unknown buildsystem: {buildsystem}" + def gen_makefile_configure(proj, deps_installed, distclean_cond, build_proj, cflags, docker_cmd, build_to_src, configure_opts): - return f''' + buildsystem = projects_buildsystems.get(proj, "autotools") + if buildsystem == "autotools": +return f''' .make.{proj}.configure: .make.{proj}.autoconf {deps_installed} $({proj}_configure_files) if {distclean_cond}; then $(MAKE) {proj}-distclean .make.{proj}.autoconf; fi @echo -e "\\n\\n\\n= $@\\n" @@ -237,29 +247,74 @@ cd {build_proj}; {cflags}{docker_cmd}{build_to_src}/configure {configure_opts} sync touch $@ - ''' +''' + elif buildsystem == "meson": +return f''' +.make.{proj}.configure: .make.{proj}.clone {deps_installed} $({proj}_configure_files) + @echo -e "\\n\\n\\n= $@\\n" + -chmod -R ug+w {build_proj} + -rm -rf {build_proj} + mkdir -p {build_proj} + cd {build_proj}; {cflags}{docker_cmd}meson {build_to_src} . + sync + touch $@ +''' + else: +assert False, f"unknown buildsystem: {buildsystem}" def gen_makefile_build(proj, distclean_cond, build_proj, docker_cmd, jobs, check): - return f''' + buildsystem = projects_buildsystems.get(proj, "autotools") + + if buildsystem == "autotools": +return f''' .make.{proj}.build: .make.{proj}.configure $({proj}_files) if {distclean_cond}; then $(MAKE) {proj}-distclean .make.{proj}.configure; fi @echo -e "\\n\\n\\n= $@\\n" {docker_cmd}$(MAKE) -C {build_proj} -j {jobs} {check} sync touch $@ - ''' +''' + elif buildsystem == "meson": +target = "test" if check else "compile" +test_line = "" +# TODO: currently tests don't pass in this env +# if check: +# test_line = f"{docker_cmd}meson test -C {build_proj} -v" +return f''' +.make.{proj}.build: .make.{proj}.configure $({proj}_files) + @echo -e "\\n\\n\\n= $@\\n" + {docker_cmd}meson compile -C {build_proj} -j {jobs} + {test_line} + sync + touch $@ +''' + else: +assert False, f"unknown buildsystem: {buildsystem}" def gen_makefile_install(proj, docker_cmd, sudo_make_install, build_proj,
[M] Change in osmo-dev[master]: Support building open5gs
osmith has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-dev/+/35114?usp=email ) Change subject: Support building open5gs .. Patch Set 1: Verified+1 -- To view, visit https://gerrit.osmocom.org/c/osmo-dev/+/35114?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-dev Gerrit-Branch: master Gerrit-Change-Id: Id145443ff53f13740167e9dde6417b7e915b8399 Gerrit-Change-Number: 35114 Gerrit-PatchSet: 1 Gerrit-Owner: osmith Gerrit-Reviewer: osmith Gerrit-Comment-Date: Thu, 23 Nov 2023 15:56:32 + Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
[M] Change in osmo-dev[master]: Support building open5gs
osmith has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-dev/+/35114?usp=email ) Change subject: Support building open5gs .. Patch Set 1: Code-Review+2 (1 comment) Patchset: PS1: as discussed with neels, pushing these without code review -- To view, visit https://gerrit.osmocom.org/c/osmo-dev/+/35114?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-dev Gerrit-Branch: master Gerrit-Change-Id: Id145443ff53f13740167e9dde6417b7e915b8399 Gerrit-Change-Number: 35114 Gerrit-PatchSet: 1 Gerrit-Owner: osmith Gerrit-Reviewer: osmith Gerrit-Comment-Date: Thu, 23 Nov 2023 15:55:34 + Gerrit-HasComments: Yes Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
[M] Change in osmo-dev[master]: Support building open5gs
osmith has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-dev/+/35114?usp=email ) Change subject: Support building open5gs .. Support building open5gs Change-Id: Id145443ff53f13740167e9dde6417b7e915b8399 --- A all.buildsystems M all.deps M all.urls M gen_makefile.py 4 files changed, 82 insertions(+), 11 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-dev refs/changes/14/35114/1 diff --git a/all.buildsystems b/all.buildsystems new file mode 100644 index 000..fc1784b --- /dev/null +++ b/all.buildsystems @@ -0,0 +1,3 @@ +# Projects with buildsystems other than autotools +# project buildsystem +open5gsmeson diff --git a/all.deps b/all.deps index 4769d02..7857f16 100644 --- a/all.deps +++ b/all.deps @@ -36,6 +36,8 @@ osmo-e1d libosmocore osmo-remsimsimtrace2_host libosmo-netif +open5gs + # can only clone these docker-playground osmo-ttcn3-hacks diff --git a/all.urls b/all.urls index 27aaf6e..dfc8ae7 100644 --- a/all.urls +++ b/all.urls @@ -2,3 +2,4 @@ # project url libnftnl https://git.netfilter.org/libnftnl/ nftables https://git.netfilter.org/nftables/ +open5gshttps://github.com/open5gs/open5gs diff --git a/gen_makefile.py b/gen_makefile.py index 82ebef0..d306364 100755 --- a/gen_makefile.py +++ b/gen_makefile.py @@ -54,6 +54,7 @@ topdir = os.path.dirname(os.path.realpath(__file__)) all_deps_file = os.path.join(topdir, "all.deps") all_urls_file = os.path.join(topdir, "all.urls") +all_buildsystems_file = os.path.join(topdir, "all.buildsystems") parser = argparse.ArgumentParser(epilog=__doc__, formatter_class=argparse.RawTextHelpFormatter) parser.add_argument('configure_opts_files', @@ -152,8 +153,8 @@ l.append((tokens[0], tokens[1:])) return l -def read_projects_urls(path): - 'Read urls config and return dict {project_name: url, …}.' +def read_projects_dict(path): + 'Read urls/buildsystems config and return dict {project_name: url, …}.' ret = {} for line in open(path): line = line.strip() @@ -215,7 +216,9 @@ ''' def gen_makefile_autoconf(proj, src_proj, distclean_cond): - return f''' + buildsystem = projects_buildsystems.get(proj, "autotools") + if buildsystem == "autotools": +return f''' .make.{proj}.autoconf: .make.{proj}.clone {src_proj}/configure.ac if {distclean_cond}; then $(MAKE) {proj}-distclean; fi @echo -e "\\n\\n\\n= $@\\n" @@ -223,11 +226,18 @@ cd {src_proj}; autoreconf -fi sync touch $@ - ''' +''' + elif buildsystem == "meson": +return "" + else: +assert False, f"unknown buildsystem: {buildsystem}" + def gen_makefile_configure(proj, deps_installed, distclean_cond, build_proj, cflags, docker_cmd, build_to_src, configure_opts): - return f''' + buildsystem = projects_buildsystems.get(proj, "autotools") + if buildsystem == "autotools": +return f''' .make.{proj}.configure: .make.{proj}.autoconf {deps_installed} $({proj}_configure_files) if {distclean_cond}; then $(MAKE) {proj}-distclean .make.{proj}.autoconf; fi @echo -e "\\n\\n\\n= $@\\n" @@ -237,29 +247,74 @@ cd {build_proj}; {cflags}{docker_cmd}{build_to_src}/configure {configure_opts} sync touch $@ - ''' +''' + elif buildsystem == "meson": +return f''' +.make.{proj}.configure: .make.{proj}.clone {deps_installed} $({proj}_configure_files) + @echo -e "\\n\\n\\n= $@\\n" + -chmod -R ug+w {build_proj} + -rm -rf {build_proj} + mkdir -p {build_proj} + cd {build_proj}; {cflags}{docker_cmd}meson {build_to_src} . + sync + touch $@ +''' + else: +assert False, f"unknown buildsystem: {buildsystem}" def gen_makefile_build(proj, distclean_cond, build_proj, docker_cmd, jobs, check): - return f''' + buildsystem = projects_buildsystems.get(proj, "autotools") + + if buildsystem == "autotools": +return f''' .make.{proj}.build: .make.{proj}.configure $({proj}_files) if {distclean_cond}; then $(MAKE) {proj}-distclean .make.{proj}.configure; fi @echo -e "\\n\\n\\n= $@\\n" {docker_cmd}$(MAKE) -C {build_proj} -j {jobs} {check} sync touch $@ - ''' +''' + elif buildsystem == "meson": +target = "test" if check else "compile" +test_line = "" +# TODO: currently tests don't pass in this env +# if check: +# test_line = f"{docker_cmd}meson test -C {build_proj} -v" +return f''' +.make.{proj}.build: .make.{proj}.configure $({proj}_files) + @echo -e "\\n\\n\\n= $@\\n" + {docker_cmd}meson compile -C {build_proj} -j {jobs} + {test_line} + sync + touch $@ +''' + else: +assert False, f"unknown buildsystem: {buildsystem}" def gen_makefile_install(proj, docker_cmd, sudo_make_install, build_proj,