Skip to content

Commit

Permalink
Fix reported version, add 'make distcheck', and add metainfo.xml file.
Browse files Browse the repository at this point in the history
Missed changing 3.0.2 to 3.0.3 in file fix-ca.c earlier. Now this is
updated automaticaly since info is fetched from fix-ca-config.h file.

Added 'Directional' to X and Y axis to help clarify controls.

Added ./configure --debugtime option. Run gimp in commamdline to see.

make distcheck ran into problems that adding into the plugin directory
is not possible as a user since the directory belongs to gimp, not to
this project. found a workaround by only writing to directory if user
is 'root' (example: sudo make install). Meanwhile, as a normal user
the bindir and file are not created/installed so that distcheck works.

Added metainfo.xml based on using template example for:
org.gimp.extension.goat-exercises.metainfo.xml.in.in
Tested and appears okay with:
appstream-util validate-relax org.gimp.extension.fix-ca.metainfo.xml
  • Loading branch information
JoesCat committed Sep 10, 2023
1 parent 67a4792 commit 2d81064
Show file tree
Hide file tree
Showing 5 changed files with 76 additions and 11 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
choiceL: [--disable-silent-rules, --enable-silent-rules]
choiceL: [--disable-silent-rules, --enable-silent-rules --enable-debugtime]
steps:
- uses: actions/checkout@v2
- name: Create configure
Expand All @@ -32,3 +32,6 @@ jobs:
run: |
sudo make install
sudo make uninstall
- name: Test make distcheck
if: matrix.choiceL == '--disable-silent-rules'
run: make distcheck
20 changes: 14 additions & 6 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,35 @@ AM_CFLAGS = ${CFLAGS} ${CPPFLAGS} ${GIMP_CFLAGS}
AM_CPPFLAGS = -I${builddir} -I${srcdir} @GIMP_CFLAGS@ -I${includedir}

bin_PROGRAMS = fix-ca
bindir = ${GIMP_LIBDIR}/plug-ins
# 'make distcheck' can't write to ${GIMP_LIBDIR}/plug-ins/fix-ca because of
# directory permissions, therefore don't install fix-ca unless it is root
@SNIPPET@

fix_ca_name = fix-ca
fix_ca_SOURCES = fix-ca.c
fix_ca.$(OBJEXT): fix-ca-config.h
fix_ca_LDADD = ${LIBS} ${GIMP_LIBS}

metainfodir = ${datarootdir}/metainfo
metainfo_DATA = ${srcdir}/org.gimp.extension.fix-ca.metainfo.xml

EXTRA_DIST = README.md fix-ca-config.h.in rpm/gimp-fix-ca.spec.in \
img-fix-ca/ex-fixed.jpg img-fix-ca/ex-orig.jpg img-fix-ca/ex-zoom.jpg \
img-fix-ca/fix-ca-dialog.png img-fix-ca/full-Wat_Pathum_Wanaram.jpg \
img-fix-ca/plug-in-browser.png img-fix-ca/Sea_turtle-dialog_before.png \
img-fix-ca/Sea_turtle-dialog.png img-fix-ca/Sea_turtle-fixed.jpg \
img-fix-ca/Sea_turtle-orig.jpg img-fix-ca/Sea_turtle-zoom.jpg
img-fix-ca/Sea_turtle-orig.jpg img-fix-ca/Sea_turtle-zoom.jpg \
org.gimp.extension.fix-ca.metainfo.xml
nodist_EXTRA_DATA = .git .github
DISTCHECK_CONFIGURE_FLAGS = --disable-silent-rules
DISTCHECK_CONFIGURE_FLAGS = --disable-silent-rules --enable-debugtime

strip:
${STRIP} ${builddir}/fix-ca
${STRIP} ${builddir}/${fix_ca_name}

# These use gimptool to install/uninstall fix-ca in user directory
# NOTE: gimptool installs fix-ca directly into the plugin directory
install-user:
${GIMPTOOL} --install-bin ${builddir}/fix-ca
${GIMPTOOL} --install-bin ${builddir}/${fix_ca_name}

uninstall-user:
${GIMPTOOL} --uninstall-bin fix-ca
${GIMPTOOL} --uninstall-bin ${fix_ca_name}
22 changes: 22 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,16 @@ AC_SUBST(GIMP_DATADIR)

AM_CONDITIONAL([HAVEGIMPTOOL],[test "${GIMPTOOL}"x != x])

#--------------------------------------------------------------------------
# Enable debug_time mode
AC_ARG_ENABLE([debugtime],
[AS_HELP_STRING([--enable-debugtime],
[Enable debugging time printf mode on commandline @<:@default=no@:>@])],
[],[enable_debugtime=no])
if test "x$enable_debugtime" = xyes || test "x$enable_debugtime" = xtrue ; then
AC_DEFINE([DEBUG_TIME],1,[Define if debugging time using printf.])
fi

#--------------------------------------------------------------------------
# Pass variables to fix-ca-config.h
AC_DEFINE([FIX_CA_MAJOR_VERSION],["fix_ca_major_version"],[gimp-fix-ca-plugin major version])
Expand All @@ -104,6 +114,18 @@ AC_SUBST([FIX_CA_VERSION],[fix_ca_version])
AC_SUBST([FIX_CA_PACKAGE_NAME],[fix_ca_package_name])
AC_SUBST([HOST],["$host"])

dnl Do this here since automake can't process 'if/else/endif in Makefile.am
SNIPPET='
noinst_PROGRAMS =
ifeq ($(shell id -u),0)
bindir = $(GIMP_LIBDIR)/plug-ins/fix-ca
else
noinst_PROGRAMS += fix-ca
endif
'
AC_SUBST([SNIPPET])
AM_SUBST_NOTMAKE([SNIPPET])

#--------------------------------------------------------------------------
# Put ifndef wrapper on fix-ca-config.h so we don't call it repeatedly.
AH_TOP([#ifndef FIX_CA_CONFIG_H
Expand Down
10 changes: 6 additions & 4 deletions fix-ca.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
*/

#define _ISOC99_SOURCE
#include "fix-ca-config.h"
#include <string.h>
#include <math.h>

Expand Down Expand Up @@ -123,8 +124,9 @@ void query (void)
{ GIMP_PDB_FLOAT, "y_red", "Red amount (y axis)" }
};

#define FIX_CA_VERSION "Fix-CA Version " FIX_CA_MAJOR_VERSION "." FIX_CA_MINOR_VERSION
gimp_install_procedure (PROCEDURE_NAME,
"Fix-CA Version 3.0.2",
FIX_CA_VERSION,
"Fix chromatic aberration caused by imperfect "
"lens. It works by shifting red and blue "
"components of image pixels in the specified "
Expand Down Expand Up @@ -376,7 +378,7 @@ gboolean fix_ca_dialog (GimpDrawable *drawable, FixCaParams *params)
G_CALLBACK (gimp_preview_invalidate),
preview);

frame = gimp_frame_new ("X axis");
frame = gimp_frame_new ("Directional, X axis");
gtk_box_pack_start (GTK_BOX (main_vbox), frame, FALSE, FALSE, 0);
gtk_widget_show (frame);

Expand Down Expand Up @@ -412,7 +414,7 @@ gboolean fix_ca_dialog (GimpDrawable *drawable, FixCaParams *params)
G_CALLBACK (gimp_preview_invalidate),
preview);

frame = gimp_frame_new ("Y axis");
frame = gimp_frame_new ("Directional, Y axis");
gtk_box_pack_start (GTK_BOX (main_vbox), frame, FALSE, FALSE, 0);
gtk_widget_show (frame);

Expand Down Expand Up @@ -995,7 +997,7 @@ void fix_ca_region (GimpDrawable *drawable,
gettimeofday (&tv2, NULL);

sec = tv2.tv_sec - tv1.tv_sec + (tv2.tv_usec - tv1.tv_usec)/1000000.0;
printf ("Elapsed time: %.2f\n", sec);
printf ("fix-ca Elapsed time: %.2f\n", sec);
#endif
}

Expand Down
30 changes: 30 additions & 0 deletions org.gimp.extension.fix-ca.metainfo.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright 2023 Joe Da Silva <digital@joescat.com> -->
<component type="addon">
<id>org.gimp.extension.fix-ca</id>
<extends>org.gimp.GIMP</extends>
<name>Fix Chromatic Aberration</name>
<summary>[plug-in to correct Lateral or Directional Chromatic Aberration (CA)]</summary>
<description>
<p>
This extension helps the user correct Lateral Chromatic Aberration (CA) due
to different color wavelengths travelling through a lens, or Directional CA,
where the amount of CA is assumed to be the same throughout the image due to
light travelling through dense material such as glass or water.
</p>
</description>
<url type="homepage">https://github.com/JoesCat/gimp-fix-ca</url>
<url type="help">https://github.com/JoesCat/gimp-fix-ca#readme</url>
<url type="bugtracker">https://github.com/JoesCat/gimp-fix-ca/issues</url>
<metadata_license>CC0-1.0</metadata_license>
<project_license>GPL-2.0+</project_license>
<releases>
<release version="3.0.3" date="2022-10-09" />
</releases>
<requires>
<id version="2.4" compare="ge">org.gimp.GIMP</id>
</requires>
<metadata>
<value key="GIMP::plug-in-path">fix-ca</value>
</metadata>
</component>

0 comments on commit 2d81064

Please sign in to comment.