From 27c41806d20fef44e19d6559760f260f197d1132 Mon Sep 17 00:00:00 2001 From: ng0 Date: Tue, 16 Aug 2016 00:59:33 +0000 Subject: [PATCH 2/2] gnu: Add pbpst. * gnu/packages/pastebin.scm: New file. * gnu/local.mk (GNU_SYSTEM_MODULES): Add it. --- gnu/local.mk | 1 + gnu/packages/pastebin.scm | 108 ++++++++++++++++++++++++++ gnu/packages/patches/pbpst-makefile-fix.patch | 17 ++++ 3 files changed, 126 insertions(+) create mode 100644 gnu/packages/pastebin.scm create mode 100644 gnu/packages/patches/pbpst-makefile-fix.patch diff --git a/gnu/local.mk b/gnu/local.mk index 66d1e43..845ccf2 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -272,6 +272,7 @@ GNU_SYSTEM_MODULES = \ %D%/packages/package-management.scm \ %D%/packages/parallel.scm \ %D%/packages/password-utils.scm \ + %D%/packages/pastebin.scm \ %D%/packages/patchutils.scm \ %D%/packages/pciutils.scm \ %D%/packages/pcre.scm \ diff --git a/gnu/packages/pastebin.scm b/gnu/packages/pastebin.scm new file mode 100644 index 0000000..31c7b42 --- /dev/null +++ b/gnu/packages/pastebin.scm @@ -0,0 +1,108 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2016 ng0 +;;; +;;; This file is part of GNU Guix. +;;; +;;; GNU Guix is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or (at +;;; your option) any later version. +;;; +;;; GNU Guix is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with GNU Guix. If not, see . + +(define-module (gnu packages pastebin) + #:use-module (gnu packages) + #:use-module (gnu packages certs) + #:use-module (gnu packages curl) + #:use-module (gnu packages gawk) + #:use-module (gnu packages llvm) + #:use-module (gnu packages tls) + #:use-module (gnu packages tup) + #:use-module (gnu packages pkg-config) + #:use-module (gnu packages python) + #:use-module (gnu packages version-control) + #:use-module (gnu packages web) + #:use-module (guix build-system gnu) + #:use-module (guix download) + #:use-module ((guix licenses) #:prefix license:) + #:use-module (guix packages)) + +(define-public pbpst + (package + (name "pbpst") + (version "1.2.0") + (source (origin + (method url-fetch) + (uri (string-append "https://github.com/HalosGhost/" + name "/archive/v" version ".tar.gz")) + (file-name (string-append name "-" version ".tar.gz")) + (sha256 + (base32 + "0vnj7dm76djlzhg0zqiv2mww11knx3vd7bl5wsgd9bd5lvxdlcqw")) + (patches (search-patches "pbpst-makefile-fix.patch")))) + (build-system gnu-build-system) + (arguments + `(#:make-flags (list + (string-append "PREFIX=" (assoc-ref %outputs "out"))) + ;; (string-append "--cflags=" (getenv "CFLAGS"))) + #:tests? #f + #:phases + (modify-phases %standard-phases + ;; We can not use the tup build system. This is the result of `tup generate'. + (replace 'build + (lambda _ + (zero? (system* "make" "simple")) + (patch-shebang "make.sh") + (substitute* "make.sh" + (("`git describe --tags`") ,version)) + (zero? (system* "bash" "make.sh")))) + ;; ;; (mkdir-p (string-append out "/dist")) + ;; (mkdir-p "dist") + ;; (chdir "src") + ;; (zero? (system* "clang" "-g" "-O3" "-fPIE" "-pie" "-Weverything" + ;; "-Werror" "-std=c11" "-ggdb" "-D_FORTIFY_SOURCE=2" + ;; "-fstack-protector-strong" "-march=native" + ;; "--param=ssp-buffer-size=1" "-Wl,-z,relro,-z,now" + ;; "-fsanitize=undefined" "-fsanitize-trap=undefined" + ;; "pkg-config" "--libs-only-l" "libcurl" "jansson" + ;; "callback.c" "main.c" "pb.c" "pbpst_db.c" + ;; "-o ../dist/pbpst")) + ;; (chdir "../cmp") + ;; (copy-file "zsh" "../dist/zsh") + ;; (copy-file "bash" "../dist/bash") + ;; (chdir "../doc") + ;; (system* "sphinx-build" "-b man" "-Dversion=`git describe --tags`" + ;; "-d doctree" "-E . ../dist pbpst.rst pbpst_db.rst") + ;; (delete-file-recursively "doctree")))) + (delete 'configure)))) + ;; now run make install as usual. + (inputs + `(("curl" ,curl) + ("jansson" ,jansson) + ;;("gnutls" ,gnutls) + ("openssl" ,openssl) + ("nss-certs" ,nss-certs))) + (native-inputs + `(("clang" ,clang) + ("gawk" ,gawk) + ("git" ,git) + ("tup" ,tup) + ("pkg-config" ,pkg-config) + ("python" ,python) + ("python-sphinx" ,python-sphinx))) + (synopsis "Command-line libcurl C client for pb deployments") + (description + "pbpst is a small tool to make interacting with pb instances as simple as +possible. pb is a versatile, free and open source pastebin which has more + features, is more robust, and is faster than any other pastebin with which I + am familiar. You can find the reference instance (which tracks pb's master + branch) at ptpb. Ideally, pbpst will support as many features of pb as + possible (hopefully, nearly all) in a simple, unassuming CLI.") + (home-page "https://github.com/HalosGhost/pbpst/") + (license license:gpl2))) diff --git a/gnu/packages/patches/pbpst-makefile-fix.patch b/gnu/packages/patches/pbpst-makefile-fix.patch new file mode 100644 index 0000000..6d817f3 --- /dev/null +++ b/gnu/packages/patches/pbpst-makefile-fix.patch @@ -0,0 +1,17 @@ +diff --git a/Makefile b/Makefile +index 28b484f..29006e0 100644 +--- a/Makefile ++++ b/Makefile +@@ -21,6 +21,12 @@ cov-build: clean + @cov-build --dir cov-int ./make.sh + @tar czvf $(PROGNM).tgz cov-int + ++simple: clean ++ @tup generate make1.sh ++ @awk 'NR == 1 { print $$0, "\nmkdir -p dist\ncd src"; next }; NR > 2 { print $$0; }' make1.sh > make.sh ++ @chmod +x make.sh ++ @rm make1.sh ++ + clang-analyze: + @(pushd ./src; clang-check -analyze ./*.c) + -- 2.9.2