On Mon, 13 Feb 2023 12:03:02 -0700
Brian Inglis wrote:
> On 2023-02-13 11:30, Jon Turney via Cygwin-apps wrote:
> > On 10/02/2023 05:25, Takashi Yano via Cygwin-apps wrote:
> >>>
> >>> Ah, I see. Fedora's ffmpeg source package includes
> >>> https://src.fedoraproject.org/repo/pkgs/ffmpeg/ffmpeg-dlopen-headers.tar.xz
> >>> wihch has wels/*.h. You meant this can be used.
> >>
> >> Jon, should we include these headers as a part of ffmpeg
> >> source package? Or distribute as another package like
> >> https://tyan0.yr32.net/cygwin/noarch/release/openh264/ ?
> 
> > I don't know.
> > 
> > How do other distros approach this problem?
> > What's least effort for you?
> 
> Debian downloads binaries directly from Cisco during pkg install.

This seems great if acceptable. I have tried that in
cygport file.

The new cygport file does:
- The header files are placed in libopenh264-headers.
  I think this makes the license of the header files
  clearer than fedora's approach.
- The libopenh264 package includes only /etc/postinstall
  and /etc/preremove, which downloads/removes Cisco's dll
  (binary) as well as license file.

Jon, could you please have a look?

-- 
Takashi Yano <takashi.y...@nifty.ne.jp>
NAME="openh264"
VERSION=2.3.1
RELEASE=1
CATEGORY="Video"
SUMMARY="H.264 codec library by Cisco"
DESCRIPTION="OpenH264 is a codec library which supports H.264 encoding and 
decoding. It is suitable for use in real time applications such as WebRTC. The 
binary library (runtime) itself will be downloaded from 
http://ciscobinary.openh264.org/";
HOMEPAGE="https://www.openh264.org/";
LICENSE="BSD-2-Clause"
ARCH="noarch" # This is noarch because it's just header files and shell scrpits.

SRC_URI="${NAME}-headers-${VERSION}.tar.xz"

# Make dummy source file for prep if the cleaned one is not exist.
if [ ! -f ${SRC_URI} ]
then
        mkdir ${NAME}-${VERSION}
        touch ${NAME}-${VERSION}/dummy
        tar acf ${SRC_URI} ${NAME}-${VERSION}
        rm -rf ${NAME}-${VERSION}
fi

CYGPORT_USE_UNSTABLE_API=1
src_unpack_hook() {
        if [ $(tar tvf ../../../${SRC_URI} | wc -l)  -eq 2 ] # Source file is 
dummy
        then
                NV=${NAME}-${VERSION}
                pushd ..
                rm -rf ${NV} # Remove dummy source file.
                # Download original source file.
                wget 
https://github.com/cisco/openh264/archive/refs/tags/v${VERSION}.tar.gz
                tar xf v${VERSION}.tar.gz
                rm -f v${VERSION}.tar.gz
                # Make source file which has only necessary header files.
                tar acf ../../${NAME}-headers-${VERSION}.tar.xz 
${NV}/codec/api/wels/*.h
                # Update source directory.
                rm -rf ${NV}
                tar xf ../../${NAME}-headers-${VERSION}.tar.xz
                popd
        fi
}
        
PKG_NAMES="libopenh264 libopenh264-headers"
libopenh264_CATEGORY="Video Libs"
libopenh264_CONTENTS="etc/"
libopenh264_REQUIRES="wget bzip2"
libopenh264_SUMMARY="H.264 codec library runtime by Cisco"
libopenh264_headers_CATEGORY="Video Devel"
libopenh264_headers_CONTENTS="usr/include"
libopenh264_headers_SUMMARY="H.264 codec library headers"

src_compile() {
        :
}

src_install() {
        mkdir -p ${D}/usr/include
        ln -fs ${S}/codec/api/wels ${D}/usr/include/.
        mkdir -p ${D}/etc/postinstall
        if [ $(uname -m) = "x86_64" ]
        then
                POSTFIX="win64"
        else
                POSTFIX="win32"
        fi
        cat << _EOF_ > ${D}/etc/postinstall/lib${NAME}.sh
#!/bin/sh
wget -q http://ciscobinary.openh264.org/${NAME}-${VERSION}-${POSTFIX}.dll.bz2 
-O - | bunzip2 > /usr/bin/libopenh264.dll
chmod a+x /usr/bin/libopenh264.dll
mkdir -p /usr/share/doc/lib${NAME}
wget -q http://www.openh264.org/BINARY_LICENSE.txt -O - > 
/usr/share/doc/lib${NAME}/BINARY_LICENSE.txt
_EOF_
        chmod a+x ${D}/etc/postinstall/lib${NAME}.sh
        mkdir -p ${D}/etc/preremove
        cat << _EOF_ > ${D}/etc/preremove/lib${NAME}.sh
#!/bin/sh
rm -rf /usr/bin/libopenh264.dll /usr/share/doc/lib${NAME}
_EOF_
        chmod a+x ${D}/etc/preremove/lib${NAME}.sh
}

Reply via email to