From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id CECC915810F for ; Fri, 9 Jun 2023 11:02:29 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 13183E07EC; Fri, 9 Jun 2023 11:02:29 +0000 (UTC) Received: from smtp.gentoo.org (dev.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 6BD75E07EC for ; Fri, 9 Jun 2023 11:02:28 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id A8A02340D3A for ; Fri, 9 Jun 2023 11:02:27 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 4627FA8E for ; Fri, 9 Jun 2023 11:02:26 +0000 (UTC) From: "Sam James" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Sam James" Message-ID: <1686293830.16f347ffdff4da72d9a262a82f32777229c413b2.sam@gentoo> Subject: [gentoo-commits] proj/gentoo-functions:master commit in: / X-VCS-Repository: proj/gentoo-functions X-VCS-Files: Makefile functions.sh functions.sh.in meson.build meson_options.txt X-VCS-Directories: / X-VCS-Committer: sam X-VCS-Committer-Name: Sam James X-VCS-Revision: 16f347ffdff4da72d9a262a82f32777229c413b2 X-VCS-Branch: master Date: Fri, 9 Jun 2023 11:02:26 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 158846a2-766a-4e20-91da-9ecfae3829be X-Archives-Hash: f407da36680ab1f7f56a2c17919f650c commit: 16f347ffdff4da72d9a262a82f32777229c413b2 Author: Sam James gentoo org> AuthorDate: Fri Jun 9 00:38:23 2023 +0000 Commit: Sam James gentoo org> CommitDate: Fri Jun 9 06:57:10 2023 +0000 URL: https://gitweb.gentoo.org/proj/gentoo-functions.git/commit/?id=16f347ff Port to Meson ... yielding ``` /tmp/destdir └── usr └── local ├── bin │   └── consoletype ├── lib │   └── gentoo │   └── functions.sh ├── libexec │   └── gentoo │   └── ecma48-cpr └── share └── man └── man1 └── consoletype.1 11 directories, 4 files ``` Signed-off-by: Sam James gentoo.org> Makefile | 39 --------------------------------- functions.sh => functions.sh.in | 7 +----- meson.build | 48 +++++++++++++++++++++++++++++++++++++++++ meson_options.txt | 3 +++ 4 files changed, 52 insertions(+), 45 deletions(-) diff --git a/Makefile b/Makefile deleted file mode 100644 index 3fa8d85..0000000 --- a/Makefile +++ /dev/null @@ -1,39 +0,0 @@ -# gentoo-functions Makefile -# Copyright 2014-2023 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -VERSION = 0.20 -GITREF ?= $(VERSION) -PKG ?= gentoo-functions-$(VERSION) - -ROOTPREFIX ?= -ROOTSBINDIR ?= $(ROOTPREFIX)/sbin -ROOTLIBEXECDIR ?= $(ROOTPREFIX)/lib/gentoo - -PREFIX ?= /usr -MANDIR ?= $(PREFIX)/share/man - -PROGRAMS = consoletype - -all: $(PROGRAMS) - -check: all - ./test-functions - -install: all - install -m 0755 -d $(DESTDIR)$(ROOTSBINDIR) - install -m 0755 consoletype $(DESTDIR)$(ROOTSBINDIR) - install -m 0755 -d $(DESTDIR)$(ROOTLIBEXECDIR) - install -m 0644 functions.sh $(DESTDIR)$(ROOTLIBEXECDIR) - install -m 0755 -d $(DESTDIR)$(MANDIR)/man1 - install -m 0644 consoletype.1 $(DESTDIR)$(MANDIR)/man1 - -clean: - rm -rf $(PROGRAMS) - -dist: - git archive --prefix=$(PKG)/ $(GITREF) | xz > $(PKG).tar.xz - -consoletype: consoletype.c - -# vim: set ts=4 : diff --git a/functions.sh b/functions.sh.in similarity index 98% rename from functions.sh rename to functions.sh.in index 154c8a4..3053162 100644 --- a/functions.sh +++ b/functions.sh.in @@ -9,11 +9,6 @@ # intended for internal use shall be prefixed with "genfun_" to indicate so, # and to reduce the probability of name space conflicts. -# FIXME. There is just one invocation of ./ecma48-cpr, which can be found in -# the _update_cursor_coords function. If you think it should be named sometime -# else, I'm open to suggestions. Its behaviour now resembles that of stty size, -# except that it reports the cursor coordinates (obviously). - # # Called by ebegin, eerrorn, einfon, and ewarnn. # @@ -632,7 +627,7 @@ _update_winsize() { _update_cursor_coords() { # shellcheck disable=2046 - set -- $(./ecma48-cpr) + set -- $(@GENTOO_LIBEXEC_DIR@/ecma48-cpr) if [ "$#" -eq 2 ] && is_int "$1" && is_int "$2"; then genfun_y=$1 genfun_x=$2 diff --git a/meson.build b/meson.build new file mode 100644 index 0000000..049812d --- /dev/null +++ b/meson.build @@ -0,0 +1,48 @@ +project( + 'gentoo-functions', 'c', + version: '0.20', + license: 'GPL-2.0-only', + default_options : [ + 'warning_level=2', + 'c_std=gnu11', + ] +) + +conf_data = configuration_data() +conf_data.set('version', meson.project_version()) +conf_data.set('GENTOO_LIBEXEC_DIR', get_option('prefix') / get_option('libexecdir') / 'gentoo') + +configure_file( + input: 'functions.sh.in', + output: 'functions.sh', + configuration: conf_data, + install: true, + install_dir: 'lib/gentoo' +) + +cc = meson.get_compiler('c') + +executable( + 'consoletype', + 'consoletype.c', + install: true +) + +install_man( + 'consoletype.1', +) + +executable( + 'ecma48-cpr', + 'ecma48-cpr.c', + install: true, + install_dir: get_option('prefix') / get_option('libexecdir') / 'gentoo' +) + +do_tests = get_option('tests') +if do_tests + test( + 'test-functions', files('test-functions'), + workdir : meson.current_source_dir(), + ) +endif diff --git a/meson_options.txt b/meson_options.txt new file mode 100644 index 0000000..7fbab2d --- /dev/null +++ b/meson_options.txt @@ -0,0 +1,3 @@ +option('tests', type : 'boolean', value : true, + description : 'Build tests' +)