Merge pull request #240405 from pbsds/mya-init

mya: init at 1.0.0
This commit is contained in:
Pol Dellaiera 2023-08-04 22:37:10 +02:00 committed by GitHub
commit 904ac6b6c2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 95 additions and 0 deletions

View file

@ -0,0 +1,26 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 273968c..236e5fb 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -3,10 +3,6 @@ project(mya)
set(CMAKE_C_STANDARD 11 )
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -Wall")
-if(UNIX)
- set(LINUX TRUE)
-endif()
-
set(SRC_DIR src)
set(INC_DIR include)
@@ -17,7 +13,8 @@ set_target_properties(mya PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DI
target_include_directories(mya PRIVATE ${INC_DIR})
set(LIBS curl json-c bsd)
-if(LINUX)
- list(APPEND LIBS)
+find_library(ARGP argp)
+if(ARGP)
+ list(APPEND LIBS argp)
endif()
target_link_libraries(mya ${LIBS})

View file

@ -0,0 +1,67 @@
{ lib
, stdenv
, fetchFromGitHub
, cmake
, ninja
, curl
, json_c
, libbsd
, argp-standalone
}:
stdenv.mkDerivation (finalAttrs: {
pname = "mya";
version = "1.0.0";
src = fetchFromGitHub {
owner = "jmakhack";
repo = "myanimelist-cli";
rev = "refs/tags/v${finalAttrs.version}";
hash = "sha256-EmdkPpYEUIk9hr6rbnixjvznKSEnTCSMZz/17BfHGCk=";
};
nativeBuildInputs = [
cmake
ninja
];
buildInputs = [
curl
json_c
libbsd
] ++ lib.optionals (!stdenv.hostPlatform.isGnu) [
argp-standalone
];
patches = [
./argp.patch
];
installPhase = ''
runHook preInstall
# Based on the upstream PKGBUILD
mkdir -p $out/share/doc/${finalAttrs.pname}
cp -a bin $out
cp $cmakeDir/README.md $out/share/doc/${finalAttrs.pname}
runHook postInstall
'';
meta = with lib; {
description = "Minimalistic command line interface for fetching user anime data from MyAnimeList";
longDescription = ''
Minimalistic command line interface for fetching user anime data from MyAnimeList.
You have to run this with the MYANIMELIST_CLIENT_ID environ variable set.
Where to get one: <https://myanimelist.net/apiconfig>.
Select the type `other`.
'';
homepage = "https://github.com/jmakhack/myanimelist-cli";
changelog = "https://github.com/jmakhack/myanimelist-cli/releases/tag/v${finalAttrs.version}";
license = licenses.mit;
maintainers = with maintainers; [ pbsds ];
mainProgram = "mya";
platforms = platforms.all;
};
})

View file

@ -1040,6 +1040,8 @@ with pkgs;
mongosh = callPackage ../development/tools/mongosh { };
mya = callPackage ../applications/misc/mya { };
mysql-shell = callPackage ../development/tools/mysql-shell {
inherit (darwin) cctools developer_cmds DarwinTools;
inherit (darwin.apple_sdk.frameworks) CoreServices;