Unverified Commit 904ac6b6 authored by Pol Dellaiera's avatar Pol Dellaiera Committed by GitHub
Browse files

Merge pull request #240405 from pbsds/mya-init

mya: init at 1.0.0
parents b524df21 9672b13a
Loading
Loading
Loading
Loading
+26 −0
Original line number Diff line number Diff line
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})
+67 −0
Original line number Diff line number Diff line
{ 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;
  };
})
+2 −0
Original line number Diff line number Diff line
@@ -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;