Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

png: add libpng port #88

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ ports=(
"coremark"
"coreMQTT"
"lsb_vsx"
"libpng"
)


Expand Down
51 changes: 51 additions & 0 deletions libpng/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/usr/bin/env bash

set -e


# extract_sources(dest_dir_path)
extract_sources() {
local destdir="${1:?destdir missing}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indent?


if [ ! -d "${destdir}" ]; then
echo "Extracting sources from ${archive_filename}"
mkdir -p "${destdir}"
tar -axf "${PREFIX_PORT}/${archive_filename}" --strip-components 1 -C "${destdir}"
fi
}


# exec_configure([configure_opts])
exec_configure() {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [shellcheck] reported by reviewdog 🐶
exec_configure references arguments, but none are ever passed. SC2120

(cd "${PREFIX_PORT_SRC}" && autoreconf -vfi &&
"${PREFIX_PORT_SRC}/configure" CFLAGS="${CFLAGS}" LDFLAGS="${LDFLAGS}" \
--host="${HOST%phoenix}linux" --bindir="${PREFIX_PROG}" --sbindir="${PREFIX_PROG}" \
--libdir="${PREFIX_A}" --includedir="${PREFIX_H}" --datarootdir="${PREFIX_A}" "${@}" \
--disable-shared --enable-static --enable-silent-rules
)
}


build_libpng() {
local appname="libpng"
local version="1.6.44"
local archive_filename="${appname}-${version}.tar.gz"

PREFIX_PORT_SRC="${PREFIX_PORT_BUILD}/${appname}-${version}/"

b_port_download "http://prdownloads.sourceforge.net/libpng/" "${archive_filename}"

extract_sources "${PREFIX_PORT_SRC}"

b_port_apply_patches "${PREFIX_PORT_SRC}"

if [ ! -f "${PREFIX_PORT_SRC}/config.status" ]; then
exec_configure

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 [shellcheck] reported by reviewdog 🐶
Use exec_configure "$@" if function's $1 should mean script's $1. SC2119

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please either fix this or disable this warning using a comment

fi

make -C "${PREFIX_PORT_SRC}" PREFIX="${PREFIX_PORT_BUILD}"
make -C "${PREFIX_PORT_SRC}" PREFIX="${PREFIX_PORT_BUILD}" install
}


build_libpng
12 changes: 12 additions & 0 deletions libpng/patches/01-Makefile.am.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff -ruN a/Makefile.am b/Makefile.am
--- a/Makefile.am 2024-10-18 10:20:12.884467503 +0200
+++ b/Makefile.am 2024-10-18 10:19:21.813487165 +0200
@@ -301,7 +301,7 @@
rm -f $@ $*.tf[12]
test -d scripts || mkdir scripts || test -d scripts
$(DFNCPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES)\
- $(CPPFLAGS) $(SYMBOL_CFLAGS) $< > $*.tf1
+ $(CFLAGS) $(CPPFLAGS) $(SYMBOL_CFLAGS) $< > $*.tf1
$(AWK) -f "${srcdir}/scripts/dfn.awk" out="$*.tf2" $*.tf1 1>&2
rm -f $*.tf1
mv $*.tf2 $@
Loading