Skip to content

Commit

Permalink
dev-util/conf2struct: Create C parsers for libconfig and command-line
Browse files Browse the repository at this point in the history
Package-Manager: Portage-2.3.68, Repoman-2.3.16
Signed-off-by: Craig Andrews <[email protected]>
  • Loading branch information
candrews committed Jul 6, 2019
1 parent ebfc578 commit 34e5638
Show file tree
Hide file tree
Showing 9 changed files with 233 additions and 0 deletions.
1 change: 1 addition & 0 deletions dev-util/conf2struct/Manifest
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DIST conf2struct-0_pre0.tar.gz 50851 BLAKE2B 21db6cca56ba18a48c65395fbf3def5de6190515be46ca2e7113c17c9b874cdcc7fb72b06b586c57a1803e98b56df5decd10ea1dd6dcc4144a78d6a0ff6bf9dd SHA512 e0eb1d43ec1375e65796197c16246a2cc38e0a4d078c4028e8675cc1ff6ef08c7802ec18f57232d91f2d4133573129f7a2b05a9f1d8b74bbddd072550f846b1d
38 changes: 38 additions & 0 deletions dev-util/conf2struct/conf2struct-0_pre0.ebuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Copyright 1999-2019 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI="7"

inherit flag-o-matic systemd toolchain-funcs

DESCRIPTION="Create C parsers for libconfig and command-line"
HOMEPAGE="https://github.com/yrutschle/conf2struct/"
if [[ ${PV} == "9999" ]] ; then
EGIT_REPO_URI="https://github.com/yrutschle/conf2struct.git"
inherit git-r3
else
KEYWORDS="~amd64"
GIT_COMMIT="10ea3356b65e712fb000f4d37f00e1dc09c1e722"
SRC_URI="https://github.com/yrutschle/conf2struct/archive/${GIT_COMMIT}.tar.gz -> ${P}.tar.gz"
S="${WORKDIR}/${PN}-${GIT_COMMIT}"
fi

PATCHES=(
"${FILESDIR}/${P}-install-and-uninstall.patch"
"${FILESDIR}/${P}-cc-and-cflags.patch"
"${FILESDIR}/${P}-destdir.patch"
"${FILESDIR}/${P}-install-not-run-all.patch"
"${FILESDIR}/${P}-dest-exists.patch"
)

LICENSE="GPL-2"
SLOT="0"
IUSE="caps pcre systemd tcpd"

RDEPEND="dev-libs/libconfig
dev-perl/Conf-Libconfig"
DEPEND="${RDEPEND}"

src_install(){
emake DESTDIR="${D}" prefix="${EPREFIX%/}/usr" install
}
28 changes: 28 additions & 0 deletions dev-util/conf2struct/conf2struct-9999.ebuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Copyright 1999-2019 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI="7"

inherit flag-o-matic systemd toolchain-funcs

DESCRIPTION="Create C parsers for libconfig and command-line"
HOMEPAGE="https://github.com/yrutschle/conf2struct/"
if [[ ${PV} == "9999" ]] ; then
EGIT_REPO_URI="https://github.com/yrutschle/conf2struct.git"
inherit git-r3
else
KEYWORDS="~amd64"
SRC_URI="https://github.com/yrutschle/conf2struct/archive/v${PV}.tar.gz -> ${P}.tar.gz"
fi

LICENSE="GPL-2"
SLOT="0"
IUSE="caps pcre systemd tcpd"

RDEPEND="dev-libs/libconfig
dev-perl/Conf-Libconfig"
DEPEND="${RDEPEND}"

src_install(){
emake DESTDIR="${D}" prefix="${EPREFIX%/}/usr" install
}
32 changes: 32 additions & 0 deletions dev-util/conf2struct/files/conf2struct-0_pre0-cc-and-cflags.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
From 8c68116a9c2e086e83075f46a1b21de218c2dd2e Mon Sep 17 00:00:00 2001
From: Craig Andrews <[email protected]>
Date: Fri, 5 Jul 2019 15:31:59 -0400
Subject: [PATCH] Add CC and use CFLAGS in Makefile

CC is necessary to specify the compiler to use (default to gcc) and use CFLAGS to specify compiler arguments
---
Makefile | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index bf9bae3..5b7212f 100644
--- a/Makefile
+++ b/Makefile
@@ -6,7 +6,7 @@ all: example checker
CFLAGS=-g

checker: confcheck.o
- gcc -o confcheck confcheck.o -lconfig
+ $(CC) $(CFLAGS) -o confcheck confcheck.o -lconfig


install: all
@@ -18,7 +18,7 @@ uninstall:

EG_OBJ=example.o parser.o argtable3.o
example: $(EG_OBJ)
- gcc -o example $(EG_OBJ) -lconfig
+ $(CC) $(CFLAGS) -o example $(EG_OBJ) -lconfig

example.c: eg_conf.cfg
./conf2struct eg_conf.cfg
21 changes: 21 additions & 0 deletions dev-util/conf2struct/files/conf2struct-0_pre0-dest-exists.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
From f4bc59c6cad87f6a237f92ea4c54e38705beeaac Mon Sep 17 00:00:00 2001
From: Craig Andrews <[email protected]>
Date: Fri, 5 Jul 2019 16:24:14 -0400
Subject: [PATCH] In install, ensure destination exists

---
Makefile | 1 +
1 file changed, 1 insertion(+)

diff --git a/Makefile b/Makefile
index bf9bae3..8bebca4 100644
--- a/Makefile
+++ b/Makefile
@@ -10,6 +10,7 @@ checker: confcheck.o


install:
+ mkdir -p $(DESTDIR)/$(bindir)
install -c conf2struct $(DESTDIR)$(bindir)/conf2struct
install -c confcheck $(DESTDIR)$(bindir)/confcheck

47 changes: 47 additions & 0 deletions dev-util/conf2struct/files/conf2struct-0_pre0-destdir.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
From f3724170ae5b5e750ec5482241add97217047eb4 Mon Sep 17 00:00:00 2001
From: Craig Andrews <[email protected]>
Date: Fri, 5 Jul 2019 15:33:49 -0400
Subject: [PATCH 1/2] Use DESTDIR in install target

---
Makefile | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index bf9bae3..fd2f21b 100644
--- a/Makefile
+++ b/Makefile
@@ -10,8 +10,8 @@ checker: confcheck.o


install: all
- install -c conf2struct $(bindir)/conf2struct
- install -c confcheck $(bindir)/confcheck
+ install -c conf2struct $(DESTDIR)$(bindir)/conf2struct
+ install -c confcheck $(DESTDIR)$(bindir)/confcheck

uninstall:
rm -rf $(bindir)/conf2struct $(bindir)/confcheck

From fa13135f93435de520480be9c1a578b20d538f55 Mon Sep 17 00:00:00 2001
From: Craig Andrews <[email protected]>
Date: Fri, 5 Jul 2019 15:36:24 -0400
Subject: [PATCH 2/2] Use DESTDIR in uninstall target

---
Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index fd2f21b..ca1e673 100644
--- a/Makefile
+++ b/Makefile
@@ -14,7 +14,7 @@ install: all
install -c confcheck $(DESTDIR)$(bindir)/confcheck

uninstall:
- rm -rf $(bindir)/conf2struct $(bindir)/confcheck
+ rm -rf $(DESTDIR)$(bindir)/conf2struct $(DESTDIR)$(bindir)/confcheck

EG_OBJ=example.o parser.o argtable3.o
example: $(EG_OBJ)
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
From 9c0e889e29944428106c12ee28ce0074a29eae50 Mon Sep 17 00:00:00 2001
From: Yves Rutschle <[email protected]>
Date: Sat, 29 Jun 2019 18:41:20 +0200
Subject: [PATCH] added install and uninstall targets to Makefile

---
Makefile | 9 +++++++++
1 file changed, 9 insertions(+)

diff --git a/Makefile b/Makefile
index b03aab3..bf9bae3 100644
--- a/Makefile
+++ b/Makefile
@@ -1,3 +1,5 @@
+prefix=/usr/local
+bindir=$(prefix)/bin

all: example checker

@@ -6,6 +8,13 @@ CFLAGS=-g
checker: confcheck.o
gcc -o confcheck confcheck.o -lconfig

+
+install: all
+ install -c conf2struct $(bindir)/conf2struct
+ install -c confcheck $(bindir)/confcheck
+
+uninstall:
+ rm -rf $(bindir)/conf2struct $(bindir)/confcheck

EG_OBJ=example.o parser.o argtable3.o
example: $(EG_OBJ)
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
From b43351d0fdd687ed39b38531f673ba634aca5fee Mon Sep 17 00:00:00 2001
From: Craig Andrews <[email protected]>
Date: Fri, 5 Jul 2019 16:22:49 -0400
Subject: [PATCH] Install target should not run all

---
Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index bf9bae3..8943248 100644
--- a/Makefile
+++ b/Makefile
@@ -9,7 +9,7 @@ checker: confcheck.o
$(CC) $(CFLAGS) -o confcheck confcheck.o -lconfig


-install: all
+install:
install -c conf2struct $(DESTDIR)$(bindir)/conf2struct
install -c confcheck $(DESTDIR)$(bindir)/confcheck

11 changes: 11 additions & 0 deletions dev-util/conf2struct/metadata.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer type="person">
<email>[email protected]</email>
<name>Craig Andrews</name>
</maintainer>
<upstream>
<remote-id type="github">yrutschle/conf2struct</remote-id>
</upstream>
</pkgmetadata>

0 comments on commit 34e5638

Please sign in to comment.