Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

{flexcpp, bisoncpp}: adopt and update #347109

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
15 changes: 15 additions & 0 deletions pkgs/by-name/bi/bisoncpp/0000-parameterize-license-file.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
diff -Naur bisoncpp-sources-6.09.00-old/bisonc++/documentation/manual/conditions/gpl.yo bisoncpp-sources-6.09.00-new/bisonc++/documentation/manual/conditions/gpl.yo
--- bisoncpp-sources-6.09.00-old/bisonc++/documentation/manual/conditions/gpl.yo 1969-12-31 21:00:01.000000000 -0300
+++ bisoncpp-sources-6.09.00-new/bisonc++/documentation/manual/conditions/gpl.yo 2024-10-07 17:19:52.344796158 -0300
@@ -1,9 +1,9 @@
The text of the em(GNU General Public License) (GPL) is frequently found in
files named tt(COPYING). On em(Debian) systems the GPL may be found in the
-file tt(/usr/share/common-licenses/GPL). Alternatively, visit
+file tt(@license_file@). Alternatively, visit
lurl(https://www.gnu.org/licenses/gpl-3.0.en.html).

The GPL is shown below:

-verbinclude(../../../LICENSE)
+verbinclude(@license_file@)

92 changes: 92 additions & 0 deletions pkgs/by-name/bi/bisoncpp/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
{
lib,
bobcat,
fetchFromGitLab,
fetchurl,
flexcpp,
icmake,
stdenv,
yodl,
}:

let
gpl3PlusText = fetchurl {
url = "https://www.gnu.org/licenses/gpl-3.0.txt";
hash = "sha256-OXLcl0T2SZ8Pmy2/dmlvKuetivmyPd5m1q+Gyd+zaYY=";
};
in
stdenv.mkDerivation (finalAttrs: {
pname = "bisoncpp";
version = "6.09.00";

src = fetchFromGitLab {
name = "bisoncpp-sources-${finalAttrs.version}";
domain = "gitlab.com";
owner = "fbb-git";
repo = "bisoncpp";
rev = finalAttrs.version;
hash = "sha256-N3MiS4li1wQFDFr01fpXs3yH/Njjtd/OUHQsekiNjks=";
};

patches = [
# Self-explaining, I think
./0000-parameterize-license-file.patch
];

patchFlags = [
# Because I changed the sourceRoot and the patch was written for the
# original root
"-p2"
];

buildInputs = [ bobcat ];

nativeBuildInputs = [
flexcpp
icmake
yodl
];

sourceRoot = "${finalAttrs.src.name}/bisonc++";

strictDeps = true;

postPatch = ''
substituteInPlace INSTALL.im --replace-fail /usr $out
patchShebangs .
license_file=${gpl3PlusText} substituteAllInPlace documentation/manual/conditions/gpl.yo
for file in $(find documentation -type f); do
substituteInPlace "$file" --replace-warn /usr $out
done
'';

buildPhase = ''
runHook preBuild

./build program
./build man
./build manual

runHook postBuild
'';

installPhase = ''
runHook preInstall

./build install x

runHook postInstall
'';

meta = {
homepage = "https://fbb-git.gitlab.io/bisoncpp/";
description = "Parser generator like bison, but it generates C++ code";
license = lib.licenses.gpl3Plus;
mainProgram = "bisonc++";
maintainers = with lib.maintainers; [
raskin
AndersonTorres
];
platforms = lib.platforms.all;
};
})
57 changes: 30 additions & 27 deletions pkgs/by-name/bo/bobcat/package.nix
Original file line number Diff line number Diff line change
@@ -1,37 +1,30 @@
{ lib
, stdenv
, fetchFromGitLab
, icmake
, yodl
, libmilter
, libX11
, openssl
, readline
, util-linux
{
lib,
fetchFromGitLab,
icmake,
libX11,
libmilter,
openssl,
readline,
stdenv,
util-linux,
yodl,
}:

stdenv.mkDerivation rec {
stdenv.mkDerivation (finalAttrs: {
pname = "bobcat";
version = "5.11.01";

src = fetchFromGitLab {
name = "bobcat-source-${finalAttrs.version}";
domain = "gitlab.com";
owner = "fbb-git";
repo = "bobcat";
rev = version;
rev = finalAttrs.version;
hash = "sha256-JLJKaJmztputIon9JkKzpm3Ch60iwm4Imh9p42crYzA=";
};

sourceRoot = "${src.name}/bobcat";

postPatch = ''
substituteInPlace INSTALL.im \
--replace "/usr" "$out"
sed -i "6i #include <cstdint>" logbuf/logbuf
patchShebangs .
'';

strictDeps = true;
sourceRoot = "${finalAttrs.src.name}/bobcat";

nativeBuildInputs = [
icmake
Expand All @@ -46,6 +39,15 @@ stdenv.mkDerivation rec {
util-linux
];

strictDeps = true;

postPatch = ''
substituteInPlace INSTALL.im \
--replace "/usr" "$out"
sed -i "6i #include <cstdint>" logbuf/logbuf
patchShebangs .
'';

buildPhase = ''
runHook preBuild

Expand All @@ -63,10 +65,11 @@ stdenv.mkDerivation rec {
runHook postBuild
'';

meta = with lib; {
description = "Brokken's Own Base Classes And Templates";
meta = {
homepage = "https://fbb-git.gitlab.io/bobcat/";
license = licenses.gpl3Only;
platforms = platforms.linux;
description = "Brokken's Own Base Classes And Templates";
license = lib.licenses.gpl3Only;
maintainers = with lib.maintainers; [ AndersonTorres ];
platforms = lib.platforms.linux;
};
}
})
99 changes: 99 additions & 0 deletions pkgs/by-name/fl/flexcpp/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
{
lib,
bisoncpp,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a little confused about this "recursive dependency" 🤔

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I figured out, thanks.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line 61.
This is a more or less typical design pattern: we tests reverse dependencies so that we can guarrantee that e.g. updating flexcpp does not break existing bisoncpp.

You can see a similar thing at live555.

bobcat,
fetchFromGitLab,
icmake,
stdenv,
yodl,
}:

stdenv.mkDerivation (finalAttrs: {
pname = "flexcpp";
version = "2.16.00";

src = fetchFromGitLab {
name = "flexcpp-source-${finalAttrs.version}";
owner = "fbb-git";
repo = "flexcpp";
rev = finalAttrs.version;
hash = "sha256-hnsWJATdA24kxuOmH7x8HMH9nPFXAAThofXvshuWk0s=";
};

buildInputs = [
bobcat
];

nativeBuildInputs = [
icmake
yodl
];

sourceRoot = "${finalAttrs.src.name}/flexc++";

strictDeps = true;

postPatch = ''
substituteInPlace INSTALL.im --replace-fail /usr $out
patchShebangs .
'';

buildPhase = ''
runHook preBuild

./build man
./build manual
./build program

runHook postBuild
'';

installPhase = ''
runHook preInstall

./build install x

runHook postInstall
'';

passthru = {
tests = {
inherit bisoncpp; # reverse dependency
};
};

meta = {
homepage = "https://fbb-git.gitlab.io/flexcpp/";
description = "Tool for generating lexical scanners in C++";
longDescription = ''
Flexc++ was designed after `flex'. Flexc++ offers as compared to flex's
C++ option a cleaner class-design.

Flexc++ generates a scanner class that is ready for use, as well as a
member function producing the lexical scanner tokens (lex()). The class
can easily be provided with additional members without the need for
polymorphic functions. Consequently, classes generated by flexc++ have no
virtual members and actually have but one public member: lex(), replacing
the old-style flex and flex++ yylex() function.

Flexc++ offers many options, among which an option to define classes
generated by flexc++ in a separate namespace. This allows developers to
define additional symbols, even outside of the class generated by flexc++,
without encountering name-collision problems. With flexc++, artificial
means to prevent name-collisions, like the yy-conventions used by flex and
flex++ are no longer required. Flexc++ generates C++ code. If C code is
required, flex should be used. Flexc++'s grammar requirements are highly
compatible with flex's requirements, so converting a flex grammar into a
flexc++ grammar should be fairly simple.

In addition to the flexc++ scanner generator itself and several skeleton
files, the package contains an extensive man-page, as well as a full
manual rewritten after the original flex manual, and several examples.
'';
changelog = "https://gitlab.com/fbb-git/flexcpp/-/blob/master/flexc++/changelog";
license = lib.licenses.gpl3Plus;
maintainers = with lib.maintainers; [ AndersonTorres ];
mainProgram = "flexc++";
platforms = lib.platforms.all;
};
})
79 changes: 79 additions & 0 deletions pkgs/by-name/ic/icmake/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
{
lib,
fetchFromGitLab,
makeWrapper,
ncurses,
stdenv,
}:

stdenv.mkDerivation (finalAttrs: {
pname = "icmake";
version = "9.03.01";

src = fetchFromGitLab {
owner = "fbb-git";
repo = "icmake";
rev = finalAttrs.version;
hash = "sha256-XqIwIqgqVuKpee9F0kQue4tbKWh9iXUlxGJDwJNRIBc=";
};

nativeBuildInputs = [ makeWrapper ];

sourceRoot = "${finalAttrs.src.name}/icmake";

strictDeps = true;

postPatch = ''
patchShebangs ./
substituteInPlace INSTALL.im \
--replace-fail "usr/" ""
'';

buildPhase = ''
runHook preBuild

./icm_prepare $out
./icm_bootstrap x

runHook postBuild
'';

installPhase = ''
runHook preInstall

./icm_install all /

wrapProgram $out/bin/icmbuild \
--prefix PATH : ${lib.getBin ncurses}/bin

runHook postInstall
'';

meta = {
homepage = "https://fbb-git.gitlab.io/icmake/";
description = "Program maintenance utility using a C-like grammar";
longDescription = ''
Icmake can be used as an alternative to make(1).

Icmake allows the programmer to use a program language (closely resembling
the well-known C-programming language) to define the actions involved in
(complex) program maintenance. For this, icmake offers various special
operators as well as a set of support functions that have proven to be
useful in program maintenance.

Traditional make-utilities recompile sources once header files are
modified. In the context of C++ program development this is often a bad
idea, as adding a new member to a class does not normally require you to
recompile the class's sources. To handle class dependencies in a more
sensible way, icmake's CLASSES file may define dependencies among
classes. By default, class-dependencies are not interpreted.
'';
license = lib.licenses.gpl3;
mainProgram = "icmake";
maintainers = with lib.maintainers; [
pSub
AndersonTorres
];
platforms = lib.platforms.all;
};
})
Loading