From 773ba36886d6e86407e268d07534a7cd034f88ca Mon Sep 17 00:00:00 2001 From: Tiago Gasiba <tiago.gasiba@gmail.com> Date: Tue, 6 Aug 2024 14:03:19 +0200 Subject: [PATCH] [NEW PORT]: devel/pycdc --- devel/pycdc/Makefile | 25 +++++++++++++++++++ devel/pycdc/distinfo | 3 +++ devel/pycdc/files/patch-CMakeLists.txt | 25 +++++++++++++++++++ devel/pycdc/files/patch-tests_all__tests.sh | 8 ++++++ .../files/patch-tests_decompyle__test.sh | 8 ++++++ devel/pycdc/pkg-descr | 7 ++++++ 6 files changed, 76 insertions(+) create mode 100644 devel/pycdc/Makefile create mode 100644 devel/pycdc/distinfo create mode 100644 devel/pycdc/files/patch-CMakeLists.txt create mode 100644 devel/pycdc/files/patch-tests_all__tests.sh create mode 100644 devel/pycdc/files/patch-tests_decompyle__test.sh create mode 100644 devel/pycdc/pkg-descr diff --git a/devel/pycdc/Makefile b/devel/pycdc/Makefile new file mode 100644 index 000000000000..8ae6f33df5b2 --- /dev/null +++ b/devel/pycdc/Makefile @@ -0,0 +1,25 @@ +PORTNAME= pycdc +PORTVERSION= 0.20240805 +CATEGORIES= devel + +MAINTAINER= tiago.gasiba@gmail.com +COMMENT= Python bytecode disassembler and decompiler + +LICENSE= GPLv3 +LICENSE_FILE= ${WRKSRC}/LICENSE + +BUILD_DEPENDS= bash:shells/bash + +USES= cmake + +USE_GITHUB= yes +GH_ACCOUNT= zrax +GH_TAGNAME= cb32b58 + +PLIST_FILES= bin/pycdas \ + bin/pycdc + +do-test: + cd ${BUILD_WRKSRC} && ninja check + +.include <bsd.port.mk> diff --git a/devel/pycdc/distinfo b/devel/pycdc/distinfo new file mode 100644 index 000000000000..bf4aee067551 --- /dev/null +++ b/devel/pycdc/distinfo @@ -0,0 +1,3 @@ +TIMESTAMP = 1722945270 +SHA256 (zrax-pycdc-0.20240805-cb32b58_GH0.tar.gz) = dd58b4f7c1c3e15c4b443cb88fdbce31256dec17cba064c3b074a897367427f2 +SIZE (zrax-pycdc-0.20240805-cb32b58_GH0.tar.gz) = 365799 diff --git a/devel/pycdc/files/patch-CMakeLists.txt b/devel/pycdc/files/patch-CMakeLists.txt new file mode 100644 index 000000000000..66c8c9c1561b --- /dev/null +++ b/devel/pycdc/files/patch-CMakeLists.txt @@ -0,0 +1,25 @@ +--- CMakeLists.txt.orig 2024-08-05 19:35:10 UTC ++++ CMakeLists.txt +@@ -1,4 +1,22 @@ cmake_minimum_required(VERSION 3.12) + cmake_minimum_required(VERSION 3.12) ++ ++function(remove_optimization_flags flag_var) ++ set(flags "${${flag_var}}") ++ separate_arguments(flags) ++ set(filtered_flags) ++ foreach(flag ${flags}) ++ if(NOT flag STREQUAL "-O1" AND NOT flag STREQUAL "-O2" AND NOT flag STREQUAL "-O3") ++ list(APPEND filtered_flags ${flag}) ++ endif() ++ endforeach() ++ string(REPLACE ";" " " filtered_flags "${filtered_flags}") ++ set(${flag_var} "${filtered_flags}" PARENT_SCOPE) ++endfunction() ++ ++remove_optimization_flags(CMAKE_CXX_FLAGS) ++remove_optimization_flags(CMAKE_CXX_FLAGS_RELEASE) ++remove_optimization_flags(CMAKE_CXX_FLAGS_DEBUG) ++ + project(pycdc) + + set(CMAKE_CXX_STANDARD 11) diff --git a/devel/pycdc/files/patch-tests_all__tests.sh b/devel/pycdc/files/patch-tests_all__tests.sh new file mode 100644 index 000000000000..0dc6171671ea --- /dev/null +++ b/devel/pycdc/files/patch-tests_all__tests.sh @@ -0,0 +1,8 @@ +--- tests/all_tests.sh.orig 2024-08-05 22:19:18 UTC ++++ tests/all_tests.sh +@@ -1,4 +1,4 @@ +-#!/bin/bash ++#!/usr/local/bin/bash + set -e + + srcdir="$(cd "$(dirname "${BASH_SOURCE[0]}")"/.. && pwd)" diff --git a/devel/pycdc/files/patch-tests_decompyle__test.sh b/devel/pycdc/files/patch-tests_decompyle__test.sh new file mode 100644 index 000000000000..1e3f619bc310 --- /dev/null +++ b/devel/pycdc/files/patch-tests_decompyle__test.sh @@ -0,0 +1,8 @@ +--- tests/decompyle_test.sh.orig 2024-08-05 22:23:10 UTC ++++ tests/decompyle_test.sh +@@ -1,4 +1,4 @@ +-#!/bin/bash ++#!/usr/local/bin/bash + + srcdir="$(cd "$(dirname "${BASH_SOURCE[0]}")"/.. && pwd)" + testdir="$srcdir/tests" diff --git a/devel/pycdc/pkg-descr b/devel/pycdc/pkg-descr new file mode 100644 index 000000000000..b2c1f9b78897 --- /dev/null +++ b/devel/pycdc/pkg-descr @@ -0,0 +1,7 @@ +Decompyle++ aims to translate compiled Python byte-code back into valid +and human-readable Python source code. While other projects have achieved +this with varied success, Decompyle++ is unique in that it seeks to +support byte-code from any version of Python. + +Decompyle++ includes both a byte-code disassembler (pycdas) and a +decompiler (pycdc). -- 2.45.2