aboutsummaryrefslogtreecommitdiff
path: root/vcpkg/ports/alac-decoder
diff options
context:
space:
mode:
authorEthan Morgan <ethan@gweithio.com>2026-02-14 16:44:06 +0000
committerEthan Morgan <ethan@gweithio.com>2026-02-14 16:44:06 +0000
commit54409423f767d8b1cf30cb7d0efca6b4ca138823 (patch)
treed915ac7828703ce4b963efdd9728a1777ba18c1e /vcpkg/ports/alac-decoder
move to own git serverHEADmaster
Diffstat (limited to 'vcpkg/ports/alac-decoder')
-rw-r--r--vcpkg/ports/alac-decoder/CMakeLists.txt48
-rw-r--r--vcpkg/ports/alac-decoder/decomp.c11
-rw-r--r--vcpkg/ports/alac-decoder/no-pragma-warning.patch14
-rw-r--r--vcpkg/ports/alac-decoder/portfile.cmake31
-rw-r--r--vcpkg/ports/alac-decoder/remove_stdint_headers.patch193
-rw-r--r--vcpkg/ports/alac-decoder/vcpkg.json17
6 files changed, 314 insertions, 0 deletions
diff --git a/vcpkg/ports/alac-decoder/CMakeLists.txt b/vcpkg/ports/alac-decoder/CMakeLists.txt
new file mode 100644
index 0000000..a7c62f6
--- /dev/null
+++ b/vcpkg/ports/alac-decoder/CMakeLists.txt
@@ -0,0 +1,48 @@
+cmake_minimum_required (VERSION 3.9)
+project (alac_decoder)
+
+set(HEADERS
+ decomp.h
+ demux.h
+ stream.h
+ wavwriter.h
+)
+
+set (SRCS
+ decomp.c
+ alac.c
+ demux.c
+ stream.c
+ wavwriter.c
+)
+
+if(MSVC)
+ add_compile_options(/W4 -D_CRT_SECURE_NO_WARNINGS -DTARGET_OS_WIN32)
+else()
+ add_compile_options(-Wno-error=implicit-function-declaration)
+endif()
+
+include_directories(.)
+
+add_library(libalac_decoder ${SRCS})
+
+add_executable(alac_decoder main.c)
+target_link_libraries(alac_decoder libalac_decoder)
+
+install(
+ TARGETS libalac_decoder
+ RUNTIME DESTINATION bin
+ LIBRARY DESTINATION lib
+ ARCHIVE DESTINATION lib
+)
+
+if(NOT DISABLE_INSTALL_TOOLS)
+ install (
+ TARGETS alac_decoder
+ RUNTIME DESTINATION tools/alac-decoder
+ )
+endif()
+
+if(NOT DISABLE_INSTALL_HEADERS)
+ install(FILES ${HEADERS} DESTINATION include/alac_decoder)
+endif()
diff --git a/vcpkg/ports/alac-decoder/decomp.c b/vcpkg/ports/alac-decoder/decomp.c
new file mode 100644
index 0000000..a769533
--- /dev/null
+++ b/vcpkg/ports/alac-decoder/decomp.c
@@ -0,0 +1,11 @@
+#include "decomp.h"
+#include <stdint.h>
+
+int set_endian()
+{
+ uint32_t integer = 0x000000aa;
+ unsigned char *p = (unsigned char*)&integer;
+
+ if (p[0] == 0xaa) return 0;
+ else return 1;
+}
diff --git a/vcpkg/ports/alac-decoder/no-pragma-warning.patch b/vcpkg/ports/alac-decoder/no-pragma-warning.patch
new file mode 100644
index 0000000..1dc7c06
--- /dev/null
+++ b/vcpkg/ports/alac-decoder/no-pragma-warning.patch
@@ -0,0 +1,14 @@
+diff --git a/alac.c b/alac.c
+index b829e29..8e8805f 100644
+--- a/alac.c
++++ b/alac.c
+@@ -284,7 +284,9 @@ static int count_leading_zeros(int input)
+ return output;
+ }
+ #else
++#if !defined(_MSC_VER)
+ #warning using generic count leading zeroes. You may wish to write one for your CPU / compiler
++#endif
+ static int count_leading_zeros(int input)
+ {
+ int output = 0;
diff --git a/vcpkg/ports/alac-decoder/portfile.cmake b/vcpkg/ports/alac-decoder/portfile.cmake
new file mode 100644
index 0000000..877385e
--- /dev/null
+++ b/vcpkg/ports/alac-decoder/portfile.cmake
@@ -0,0 +1,31 @@
+vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
+
+vcpkg_download_distfile(ARCHIVE
+ URLS "https://distfiles.macports.org/alac_decoder/alac_decoder-0.2.0.tgz"
+ FILENAME "alac_decoder-0.2.0.tgz"
+ SHA512 4b37d4fe37681bfccaa4a27fbaf11eb2a1fba5f14e77d219a6d9814ff44d1168534d05eb19443dd2fd11e6fcdf4da3a22e3f3c79314cb7a6767c152351b13e29
+)
+
+vcpkg_extract_source_archive(
+ SOURCE_PATH
+ ARCHIVE "${ARCHIVE}"
+ PATCHES
+ remove_stdint_headers.patch
+ no-pragma-warning.patch
+)
+
+file(COPY "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt" DESTINATION "${SOURCE_PATH}")
+file(COPY "${CMAKE_CURRENT_LIST_DIR}/decomp.c" DESTINATION "${SOURCE_PATH}")
+
+vcpkg_cmake_configure(
+ SOURCE_PATH "${SOURCE_PATH}"
+ OPTIONS_DEBUG
+ -DDISABLE_INSTALL_HEADERS=ON
+ -DDISABLE_INSTALL_TOOLS=ON
+)
+
+vcpkg_cmake_install()
+vcpkg_copy_pdbs()
+vcpkg_copy_tool_dependencies("${CURRENT_PACKAGES_DIR}/tools/${PORT}")
+
+file(INSTALL "${SOURCE_PATH}/README" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
diff --git a/vcpkg/ports/alac-decoder/remove_stdint_headers.patch b/vcpkg/ports/alac-decoder/remove_stdint_headers.patch
new file mode 100644
index 0000000..834b808
--- /dev/null
+++ b/vcpkg/ports/alac-decoder/remove_stdint_headers.patch
@@ -0,0 +1,193 @@
+diff --git a/alac.c b/alac.c
+index 469000d..c6fe479 100644
+--- a/alac.c
++++ b/alac.c
+@@ -33,11 +33,7 @@
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
+-#ifdef _WIN32
+- #include "stdint_win.h"
+-#else
+- #include <stdint.h>
+-#endif
++#include <stdint.h>
+
+ #include "decomp.h"
+
+@@ -54,7 +50,7 @@
+ struct {signed int x:24;} se_struct_24;
+ #define SignExtend24(val) (se_struct_24.x = val)
+
+-extern int host_bigendian;
++#define host_bigendian set_endian()
+
+ struct alac_file
+ {
+diff --git a/decomp.h b/decomp.h
+index 23dbc52..679a320 100644
+--- a/decomp.h
++++ b/decomp.h
+@@ -8,6 +8,7 @@ void decode_frame(alac_file *alac,
+ unsigned char *inbuffer,
+ void *outbuffer, int *outputsize);
+ void alac_set_info(alac_file *alac, char *inputbuffer);
++int set_endian();
+
+ #endif /* __ALAC__DECOMP_H */
+
+diff --git a/demux.c b/demux.c
+index ae77a9d..9e858a9 100644
+--- a/demux.c
++++ b/demux.c
+@@ -33,11 +33,7 @@
+ #include <string.h>
+ #include <stdio.h>
+ #include <stdlib.h>
+-#ifdef _WIN32
+- #include "stdint_win.h"
+-#else
+- #include <stdint.h>
+-#endif
++#include <stdint.h>
+
+ #include "stream.h"
+ #include "demux.h"
+diff --git a/demux.h b/demux.h
+index 8447bf8..8874ba4 100644
+--- a/demux.h
++++ b/demux.h
+@@ -1,11 +1,8 @@
+ #ifndef DEMUX_H
+ #define DEMUX_H
+
+-#ifdef _WIN32
+- #include "stdint_win.h"
+-#else
+- #include <stdint.h>
+-#endif
++
++#include <stdint.h>
+
+ #include "stream.h"
+
+diff --git a/main.c b/main.c
+index 7449ca1..dd58699 100644
+--- a/main.c
++++ b/main.c
+@@ -37,11 +37,7 @@
+ #include <stdlib.h>
+ #include <errno.h>
+ #include <string.h>
+-#ifdef _WIN32
+- #include "stdint_win.h"
+-#else
+- #include <stdint.h>
+-#endif
++#include <stdint.h>
+
+ #include "demux.h"
+ #include "decomp.h"
+@@ -267,19 +263,7 @@ static void setup_environment(int argc, char **argv)
+ }
+ }
+
+-/* this could quite easily be done at compile time,
+- * however I don't want to have to bother with all the
+- * various possible #define's for endianness, worrying about
+- * different compilers etc. and I'm too lazy to use autoconf.
+- */
+-void set_endian()
+-{
+- uint32_t integer = 0x000000aa;
+- unsigned char *p = (unsigned char*)&integer;
+
+- if (p[0] == 0xaa) host_bigendian = 0;
+- else host_bigendian = 1;
+-}
+
+ int main(int argc, char **argv)
+ {
+@@ -288,7 +272,7 @@ int main(int argc, char **argv)
+
+ memset(&demux_res, 0, sizeof(demux_res));
+
+- set_endian();
++ host_bigendian = set_endian();
+
+ setup_environment(argc, argv);
+
+diff --git a/stream.c b/stream.c
+index 565db54..56727a0 100644
+--- a/stream.c
++++ b/stream.c
+@@ -33,13 +33,10 @@
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <errno.h>
+-#ifdef _WIN32
+- #include "stdint_win.h"
+-#else
+- #include <stdint.h>
+-#endif
++#include <stdint.h>
+
+ #include "stream.h"
++#include "decomp.h"
+
+ #define _Swap32(v) do { \
+ v = (((v) & 0x000000FF) << 0x18) | \
+@@ -51,7 +48,7 @@
+ v = (((v) & 0x00FF) << 0x08) | \
+ (((v) & 0xFF00) >> 0x08); } while (0)
+
+-extern int host_bigendian;
++#define host_bigendian set_endian()
+
+ struct stream_tTAG {
+ FILE *f;
+diff --git a/stream.h b/stream.h
+index 18d6aa0..ff6325e 100644
+--- a/stream.h
++++ b/stream.h
+@@ -3,11 +3,8 @@
+
+ /* stream.h */
+
+-#ifdef _WIN32
+- #include "stdint_win.h"
+-#else
+- #include <stdint.h>
+-#endif
++#include <stdint.h>
++
+
+ typedef struct stream_tTAG stream_t;
+
+diff --git a/wavwriter.c b/wavwriter.c
+index fd19502..ce941c7 100644
+--- a/wavwriter.c
++++ b/wavwriter.c
+@@ -32,11 +32,8 @@
+
+ #include <stdio.h>
+ #include <stdlib.h>
+-#ifdef _WIN32
+- #include "stdint_win.h"
+-#else
+- #include <stdint.h>
+-#endif
++#include <stdint.h>
++
+
+ #ifndef MAKEFOURCC
+ #define MAKEFOURCC(ch0, ch1, ch2, ch3) ( \
+@@ -56,7 +53,7 @@
+ v = (((v) & 0x00FF) << 0x08) | \
+ (((v) & 0xFF00) >> 0x08); } while (0)
+
+-extern int host_bigendian;
++#define host_bigendian set_endian()
+
+ static void write_uint32(FILE *f, uint32_t v, int bigendian)
+ {
diff --git a/vcpkg/ports/alac-decoder/vcpkg.json b/vcpkg/ports/alac-decoder/vcpkg.json
new file mode 100644
index 0000000..9792d5a
--- /dev/null
+++ b/vcpkg/ports/alac-decoder/vcpkg.json
@@ -0,0 +1,17 @@
+{
+ "name": "alac-decoder",
+ "version": "0.2",
+ "port-version": 7,
+ "description": "ALAC C implementation of a decoder, written from reverse engineering the file format",
+ "homepage": "https://distfiles.macports.org/alac_decoder",
+ "dependencies": [
+ {
+ "name": "vcpkg-cmake",
+ "host": true
+ },
+ {
+ "name": "vcpkg-cmake-config",
+ "host": true
+ }
+ ]
+}