Index | Thread | Search

From:
Nam Nguyen <namn@messagemode2.com>
Subject:
Re: update emulators/libchdr-1.0pl20250608
To:
Stuart Henderson <stu@spacehopper.org>
Cc:
ports@openbsd.org
Date:
Wed, 17 Sep 2025 16:48:16 -0700

Download raw body.

Thread
Stuart Henderson writes:

> On 2025/09/16 18:01, Nam Nguyen wrote:
>> Nam Nguyen writes:
>> 
>> ping. The diff is attached.
>> 
>> > Here is a diff for emulators/libchdr to update to a newer commit on
>> > 20250608. It is needed for a emulators/flycast I am sending after.

With sthen's feedback, please find attached a revised diff.

This diff does the following:
- links against archivers/zstd. some chd files use zstd to compress
  audio data.
- major bump because of new function return value in public header
  huffman.h
- cmakelists.txt patch:
  garbage collect -Wl-no-undefined because upstream already does this on
  OpenBSD.

  use pkg-config inside cmake. pkg-config is needed because cmake does
  not provide a way to find zstd.
  
  NEW CHANGE: reorder include directories to prioritize project
  directories over system headers. See below for details.

>> > -void huffman_build_lookup_table(struct huffman_decoder* decoder);
>> > +enum huffman_error huffman_build_lookup_table(struct huffman_decoder* decoder);
>
> honestly I would major bump for that, we don't generally evaluate
> whether anything in ports is using an interface which has changed.
> and somebody might have compiled something out of ports.
>
> also, except for -stable backports, library bumps are pretty cheap.

This exposed an error with my handrolled solution of using pkg-config
inside cmake to find zstd. When the old libchdr is installed, it errors
when building libchdr with system zstd.

CMakeCache.txt has:
ZSTD_INCLUDE_DIRS:INTERNAL=/usr/local/include

To resolve this I reordered the directories so that the project include
directories are listed first before CHDR_INCLUDES. CHDR_INCLUDES
contains ZSTD_INCLUDE_DIRS.

-target_include_directories(chdr-static PRIVATE ${CHDR_INCLUDES} PUBLIC include)
+target_include_directories(chdr-static PUBLIC include PRIVATE ${CHDR_INCLUDES})

-  target_include_directories(chdr PRIVATE ${CHDR_INCLUDES} PUBLIC include)
+  target_include_directories(chdr PUBLIC include PRIVATE ${CHDR_INCLUDES})


> btw those "External reference changes" are not new symbols exported by
> the library, they are functions from other libraries which are used.
> the check_sym script is originally meant for evaluating changes to
> libraries in base so it reports things which aren't relevant to ports.

Thanks for the hint. So I used nm -g to compare this time, too, after
checking the faqs. I see that they are alternatives and nm -g also
reveals the new functions.

--8<---------------cut here---------------start------------->8---
$ /usr/src/lib/check_sym /usr/local/lib/libchdr.so.1.0 /usr/obj/pobj/libchdr-1.0pl20250608/fake-amd64/usr/local/lib/libchdr.so.2.0 
/usr/local/lib/libchdr.so.1.0 --> /usr/obj/pobj/libchdr-1.0pl20250608/fake-amd64/usr/local/lib/libchdr.so.2.0
Dynamic export changes:
added:
        chd_read_header_core_file
        chd_read_header_file

External reference changes:
added:
        ZSTD_createDStream
        ZSTD_decompressStream
        ZSTD_freeDStream
        ZSTD_initDStream
        ZSTD_isError
        puts

$ nm -g /usr/local/lib/libchdr.so.1.0 | cut -c10- | grep -e^T                                                                     
T chd_close
T chd_codec_config
T chd_core_file
T chd_error_string
T chd_get_codec_name
T chd_get_header
T chd_get_metadata
T chd_open
T chd_open_core_file
T chd_open_file
T chd_precache
T chd_read
T chd_read_header

$ nm -g /usr/obj/pobj/libchdr-1.0pl20250608/fake-amd64/usr/local/lib/libchdr.so.2.0 | cut -c10- | grep -e^T                        
T chd_close
T chd_codec_config
T chd_core_file
T chd_error_string
T chd_get_codec_name
T chd_get_header
T chd_get_metadata
T chd_open
T chd_open_core_file
T chd_open_file
T chd_precache
T chd_read
T chd_read_header
T chd_read_header_core_file
T chd_read_header_file
--8<---------------cut here---------------end--------------->8---

OK?