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

gourou: init at 0.7.2 #179678

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 13 additions & 0 deletions pkgs/development/libraries/gourou/base64.patch
@@ -0,0 +1,13 @@
diff --git a/src/bytearray.cpp b/src/bytearray.cpp
index 0bfbbabff45e..427f3d275bdd 100644
--- a/src/bytearray.cpp
+++ b/src/bytearray.cpp
@@ -18,7 +18,7 @@
*/
#include <string.h>

-#include <base64/Base64.h>
Copy link
Contributor

Choose a reason for hiding this comment

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

Couldn't you just copy the base64 file in $sourceRoot/include/base64/Base64.h instead?

If this works, this would allow us to drop a patch.

+#include <base64.h>

#include <bytearray.h>

47 changes: 47 additions & 0 deletions pkgs/development/libraries/gourou/default.nix
@@ -0,0 +1,47 @@
{ lib, stdenv, fetchgit, fetchurl
, pugixml, updfparser, curl, openssl, libzip }:

let
base64 = fetchurl {
url = "https://gist.githubusercontent.com/tomykaira/f0fd86b6c73063283afe550bc5d77594/raw/7d5a89229a525452e37504976a73c35fbaf2fe4d/Base64.h";
sha256 = "sha256-BKK+6mPEEEd4Y8c6GU2X6UB5fQ+3nPbUbEF8zQ6nGM4=";
};
in stdenv.mkDerivation rec {
name = "gourou";
version = "0.7.2";

src = fetchgit {
url = "git://soutade.fr/libgourou";
rev = "v${version}";
sha256 = "sha256-jvvfrCuRggSPk7p/WtEaKRV7kILuZjUB1KEgaE4LStc=";
};

postUnpack = ''
Copy link
Contributor

Choose a reason for hiding this comment

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

I know I said post unpack, but I meant post unpack phase for any phase post unpack, not necessary the postUnpack phase.

Actually this looks more like to be a postPatch or preBuild phases, instead of postUnpack (since this isn't unpacking anything).

cp ${base64} $sourceRoot/include/base64.h
'';

patches = [
./base64.patch # vendor base64 header file
./devendor.patch # devendor pugixml and updfparser
];

buildInputs = [ pugixml updfparser curl openssl libzip ];

installPhase = ''
runHook preInstall
install -Dt $out/include include/libgourou*.h
install -Dt $out/lib libgourou.so
install -Dt $out/bin utils/acsmdownloader
install -Dt $out/bin utils/adept_{activate,loan_mgt,remove}
runHook postInstall
'';

meta = with lib; {
description = "Implementation of Adobe's ADEPT protocol for ePub/PDF DRM";
homepage = "https://indefero.soutade.fr/p/libgourou";
license = licenses.lgpl3Plus;
maintainers = with maintainers; [ McSinyx ];
platforms = platforms.all;
broken = stdenv.isDarwin;
};
}
44 changes: 44 additions & 0 deletions pkgs/development/libraries/gourou/devendor.patch
@@ -0,0 +1,44 @@
diff --git a/Makefile b/Makefile
index fac27c2da1db..35439fefd8e1 100644
--- a/Makefile
+++ b/Makefile
@@ -2,10 +2,8 @@
AR ?= $(CROSS)ar
CXX ?= $(CROSS)g++

-UPDFPARSERLIB = ./lib/updfparser/libupdfparser.a
-
-CXXFLAGS=-Wall -fPIC -I./include -I./lib -I./lib/pugixml/src/ -I./lib/updfparser/include
-LDFLAGS = $(UPDFPARSERLIB)
+CXXFLAGS=-Wall -fPIC -I./include
+LDFLAGS = -lpugixml -lupdfparser

BUILD_STATIC ?= 0
BUILD_SHARED ?= 1
@@ -36,10 +34,10 @@ TARGETDIR := bin
SRCEXT := cpp
OBJEXT := o

-SOURCES = src/libgourou.cpp src/user.cpp src/device.cpp src/fulfillment_item.cpp src/loan_token.cpp src/bytearray.cpp src/pugixml.cpp
+SOURCES = src/libgourou.cpp src/user.cpp src/device.cpp src/fulfillment_item.cpp src/loan_token.cpp src/bytearray.cpp
OBJECTS := $(patsubst $(SRCDIR)/%,$(BUILDDIR)/%,$(SOURCES:.$(SRCEXT)=.$(OBJEXT)))

-all: lib obj $(TARGETS)
+all: obj $(TARGETS)

lib:
mkdir lib
@@ -56,10 +54,10 @@ $(BUILDDIR)/%.$(OBJEXT): $(SRCDIR)/%.$(SRCEXT)

libgourou: libgourou.a libgourou.so

-libgourou.a: $(OBJECTS) $(UPDFPARSERLIB)
- $(AR) crs $@ obj/*.o $(UPDFPARSERLIB)
+libgourou.a: $(OBJECTS)
+ $(AR) crs $@ obj/*.o

-libgourou.so: $(OBJECTS) $(UPDFPARSERLIB)
+libgourou.so: $(OBJECTS)
$(CXX) obj/*.o $(LDFLAGS) -o $@ -shared

build_utils:
27 changes: 27 additions & 0 deletions pkgs/development/libraries/updfparser/default.nix
@@ -0,0 +1,27 @@
{ lib, stdenv, fetchgit }:

stdenv.mkDerivation {
name = "updfparser";
version = "unstable-2022-03-16";

src = fetchgit {
url = "git://soutade.fr/updfparser";
rev = "9d56c1d0b1ce81aae4c8db9d99a8b5d1f7967bcf";
sha256 = "sha256-9dvibKiUbbI4CrmuAaJzlpntT0XdLvdGeC2/WzjlA5U=";
};

installPhase = ''
runHook preInstall
install -Dt $out/include include/*.h
install -Dt $out/lib libupdfparser.so
runHook postInstall
'';

meta = with lib; {
description = "A very simple PDF parser";
homepage = "https://indefero.soutade.fr/p/updfparser";
license = licenses.lgpl3Plus;
maintainers = with maintainers; [ McSinyx ];
platforms = platforms.all;
};
}
4 changes: 4 additions & 0 deletions pkgs/top-level/all-packages.nix
Expand Up @@ -17889,6 +17889,8 @@ with pkgs;

elementary-cmake-modules = callPackage ../development/libraries/elementary-cmake-modules { };

gourou = callPackage ../development/libraries/gourou { };

gtk2 = callPackage ../development/libraries/gtk/2.x.nix {
inherit (darwin.apple_sdk.frameworks) AppKit Cocoa;
};
Expand Down Expand Up @@ -21117,6 +21119,8 @@ with pkgs;

unicon-lang = callPackage ../development/interpreters/unicon-lang {};

updfparser = callPackage ../development/libraries/updfparser { };

tsocks = callPackage ../development/libraries/tsocks { };

unixODBC = callPackage ../development/libraries/unixODBC { };
Expand Down