Merge branch 'master' of github.com:libgd/libgd

master
Pierre Joye 2021-08-26 21:48:43 +07:00
commit 63070b49e2
10 changed files with 71 additions and 36 deletions

18
.github/scripts/removemono.sh vendored Executable file
View File

@ -0,0 +1,18 @@
#!/bin/sh -x
[ "${SUDO_USER}" -a `id -u` -eq 0 ] || {
\sudo ${0}
\rm -f ${0}
exit $?
}
\rm -r /Library/Frameworks/Mono.framework
\rm -r /Library/Receipts/MonoFramework-*
for dir in /usr/bin /usr/share/man/man1 /usr/share/man/man3 /usr/share/man/man5; do
(
for i in $(\find ${dir} -type l -maxdepth 1 | \grep /Mono.framework/ | \awk '{print $NF}'); do
echo \rm ${i}
done
)
done
\rm -f ${0}
exit 0

View File

@ -70,7 +70,7 @@ jobs:
- name: Install macOS dependencies
if: contains(matrix.os, 'macos')
run: |
brew install libheif libjpeg-turbo freetype libtiff libimagequant libde265 x265 webp
brew install libheif libjpeg-turbo libimagequant libde265 x265
- name: Prepare macOS environment
if: contains(matrix.os, 'macos')
@ -78,11 +78,18 @@ jobs:
sudo xcode-select --switch /Library/Developer/CommandLineTools/
echo "JOBS=$(sysctl -n hw.logicalcpu)" >> $GITHUB_ENV
echo "PKG_CONFIG_PATH=/usr/local/opt/jpeg-turbo/lib/pkgconfig" >> $GITHUB_ENV
echo "CFLAGS=-I/opt/X11/include" >> $GITHUB_ENV
echo "CPATH=/usr/local/include:/usr/local/lib:/usr/local/include/libpng16:/usr/local/opt/openssl/include" >> $GITHUB_ENV
echo "C_INCLUDE_PATH=/usr/local/lib:/usr/local/include/libpng16:/usr/local/opt/openssl/include" >> $GITHUB_ENV
echo "LIBRARY_PATH=/usr/local/lib:/usr/local/include/libpng:/usr/local/opt/openssl/include" >> $GITHUB_ENV
echo "LD_PATH"
echo "CFLAGS=-I/opt/X11/include -I/usr/local/Cellar/libpng/1.6.37/include/libpng16" >> $GITHUB_ENV
echo "LDFLAGS=-L/usr/local/Cellar/libpng/1.6.37/lib" >> $GITHUB_ENV
echo "CPATH=/usr/local/include:/usr/local/Cellar/libpng/1.6.37/include/libpng16" >> $GITHUB_ENV
echo "C_INCLUDE_PATH=/usr/local/lib:/usr/local/Cellar/libpng/1.6.37/include/libpng16:/usr/local/opt/openssl/include" >> $GITHUB_ENV
echo "LIBRARY_PATH=/usr/local/Cellar/libpng/1.6.37/lib:/usr/local/lib" >> $GITHUB_ENV
pkg-config --libs --cflags libpng
pkg-config --libs libpng
pkg-config --libs --cflags libpng16
pkg-config --libs libpng16
ls /usr/local/Cellar/libpng/1.6.37/
ls /usr/local/Cellar/libpng/1.6.37/lib/
${{github.workspace}}/.github/scripts/removemono.sh
- name: Configure CMake MacOS
if: contains(matrix.os, 'macos')
@ -90,7 +97,7 @@ jobs:
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: cmake -DENABLE_PNG=1 -DENABLE_FREETYPE=1 -DENABLE_JPEG=1 -DENABLE_WEBP=1
-DENABLE_TIFF=1 -DENABLE_GD_FORMATS=1 -DENABLE_CPP=0 -DENABLE_HEIF=1 -D CMAKE_PREFIX_PATH=/usr/local
-DBUILD_TEST=1 -DVERBOSE_MAKEFILE=1 -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
-DBUILD_TEST=1 -DVERBOSE_MAKEFILE=1 -DPNG_PNG_INCLUDE_DIR=/usr/local/Cellar/libpng/1.6.37/include -DPNG_PNG_LIBRARY_DIR=/usr/local/Cellar/libpng/1.6.37/lib -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
- name: Install Dependencies Windows
if: contains(matrix.os, 'Windows')
@ -120,7 +127,7 @@ jobs:
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --parallel 4
- name: Test Ubuntu
if: contains(matrix.os, 'ubuntu')
if: contains(matrix.os, 'ubuntu') || contains(matrix.os, 'macos')
working-directory: ${{github.workspace}}/build
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail

View File

@ -1,7 +1,7 @@
## Process this file with automake to produce Makefile.in -*-Makefile-*-
bin_PROGRAMS = gdcmpgif
check_PROGRAMS = gifanimtest gd_color_map_test
check_PROGRAMS = gifanimtest
if HAVE_LIBPNG
bin_PROGRAMS += gdtopng pngtogd webpng

View File

@ -1,27 +0,0 @@
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdio.h>
#include "gd.h"
#include "gd_color_map.h"
int
main(void)
{
int r, g, b;
int i;
for (i=0; i<GD_COLOR_MAP_X11.num_entries; i++) {
char *color_name = GD_COLOR_MAP_X11.entries[i].color_name;
if (gdColorMapLookup(GD_COLOR_MAP_X11, color_name, &r, &g, &b)) {
printf("%s found: #%02x%02x%02x\n", color_name, r, g, b);
} else {
fprintf(stderr, "%s not found\n", color_name);
return 1;
}
}
if (gdColorMapLookup(GD_COLOR_MAP_X11, "no such name", &r, &g, &b)) {
return 2;
}
return 0;
}

View File

@ -23,6 +23,7 @@ if (BUILD_TEST)
freetype
gd
gd2
gdcolormaplookup
gdimagearc
gdimagebrightness
gdimageclone

View File

@ -19,6 +19,7 @@ include fontconfig/Makemodule.am
include freetype/Makemodule.am
include gd/Makemodule.am
include gd2/Makemodule.am
include gdcolormaplookup/Makemodule.am
include gdimagearc/Makemodule.am
include gdimagebrightness/Makemodule.am
include gdimageclone/Makemodule.am

1
tests/gdcolormaplookup/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/gdcolormaplookup

View File

@ -0,0 +1,5 @@
LIST(APPEND TESTS_FILES
gdcolormaplookup
)
ADD_GD_TESTS()

View File

@ -0,0 +1,5 @@
libgd_test_programs += \
gdcolormaplookup/gdcolormaplookup
EXTRA_DIST += \
gdcolormaplookup/CMakeLists.txt

View File

@ -0,0 +1,24 @@
/**
* Test API gdColorMapLookup defined in gd_color_map.h
* Move from src/gd_color_map_test.c
*/
#include "gd_color_map.h"
#include "gdtest.h"
int
main(void)
{
int r, g, b;
int i;
int ret;
for (i=0; i<GD_COLOR_MAP_X11.num_entries; i++) {
char *color_name = GD_COLOR_MAP_X11.entries[i].color_name;
ret = gdColorMapLookup(GD_COLOR_MAP_X11, color_name, &r, &g, &b);
gdTestAssert(ret == 1);
}
ret = gdColorMapLookup(GD_COLOR_MAP_X11, "no such name", &r, &g, &b);
gdTestAssert(ret == 0);
return gdNumFailures();
}