Skip to content

Instantly share code, notes, and snippets.

@pluiedev
Created November 20, 2024 18:18
Show Gist options
  • Save pluiedev/acc12c97260c72b6f2c8b619e1fd7742 to your computer and use it in GitHub Desktop.
Save pluiedev/acc12c97260c72b6f2c8b619e1fd7742 to your computer and use it in GitHub Desktop.
diff --git a/configure.ac b/configure.ac
index 42a2641..b0059a7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -99,9 +99,7 @@ AC_ARG_ENABLE([nimf-anthy],
AS_IF([test "x$enable_nimf_anthy" != "xno"],
[PKG_CHECK_MODULES(NIMF_ANTHY_DEPS, [anthy $LIBNIMF_REQUIRES])])
AS_IF([test "x$enable_nimf_anthy" != "xno"],
- [AC_CHECK_FILE([/var/lib/anthy/anthy.dic], [HAVE_ANTHY_DIC="yes"])])
-AS_IF([test "x$enable_nimf_anthy" != "xno"],
- [AC_CHECK_FILE([/usr/share/anthy/anthy.dic], [HAVE_ANTHY_DIC="yes"])])
+ [AC_CHECK_FILE([@anthy@/share/anthy/anthy.dic], [HAVE_ANTHY_DIC="yes"])])
AS_IF([test "x$enable_nimf_anthy" != "xno" -a "x$HAVE_ANTHY_DIC" != "xyes"],
[AC_MSG_ERROR([anthy.dic is not found.])])
@@ -134,18 +132,7 @@ if test "x$QT5_MOC" = "xno"; then
fi
QT5_LIB_DIR=`pkg-config --variable=libdir Qt5Core`
-
-case `pkg-config --variable=includedir Qt5Core` in
- */qt5)
- QT5_IM_MODULE_DIR=$QT5_LIB_DIR/qt5/plugins/platforminputcontexts
- ;;
- */qt)
- QT5_IM_MODULE_DIR=$QT5_LIB_DIR/qt/plugins/platforminputcontexts
- ;;
- *)
- AC_MSG_ERROR(Can not determine Qt5 plugins/platforminputcontexts directory)
- ;;
-esac
+QT5_IM_MODULE_DIR=@qtbase@/lib/qt-*/plugins/platforminputcontexts
AC_SUBST(QT5_IM_MODULE_DIR)
])
@@ -249,9 +236,7 @@ AC_SUBST(GTK3_LIBDIR)
AC_SUBST(GTK3_BINARY_VERSION)
AC_PATH_PROGS([GTK_QUERY_IMMODULES3],
[gtk-query-immodules-3.0 gtk-query-immodules-3.0-$BITS], [no],
- [/usr/bin:/snap/gnome-42-2204/176/usr/lib/x86_64-linux-gnu/libgtk-3-0:\
-/usr/lib/x86_64-linux-gnu/libgtk-3-0t64:/usr/lib/x86_64-linux-gnu/libgtk-3-0:\
-/usr/lib/aarch64-linux-gnu/libgtk-3-0t64:/usr/lib/aarch64-linux-gnu/libgtk-3-0])
+ [@gtk3-dev@/bin])
if test "x$GTK_QUERY_IMMODULES3" = "xno"; then
AC_MSG_ERROR([gtk-query-immodules-3.0 or gtk-query-immodules-3.0-$BITS not found])
fi
@@ -262,9 +247,7 @@ AC_SUBST(GTK2_LIBDIR)
AC_SUBST(GTK2_BINARY_VERSION)
AC_PATH_PROGS([GTK_QUERY_IMMODULES2],
[gtk-query-immodules-2.0 gtk-query-immodules-2.0-$BITS], [no],
- [/usr/bin:/snap/gnome-42-2204/176/usr/lib/x86_64-linux-gnu/libgtk2.0-0:\
-/usr/lib/x86_64-linux-gnu/libgtk2.0-0t64:/usr/lib/x86_64-linux-gnu/libgtk2.0-0:\
-/usr/lib/aarch64-linux-gnu/libgtk2.0-0t64:/usr/lib/aarch64-linux-gnu/libgtk2.0-0])
+ [@gtk2-dev@/bin])
if test "x$GTK_QUERY_IMMODULES2" = "xno"; then
AC_MSG_ERROR([gtk-query-immodules-2.0 or gtk-query-immodules-2.0-$BITS not found])
fi
@@ -275,7 +258,7 @@ dnl ***************************************************************************
AC_PATH_PROGS([GTK_UPDATE_ICON_CACHE],
[gtk-update-icon-cache-3.0 gtk-update-icon-cache], [no],
- [/usr/bin:$GTK3_LIBDIR/libgtk-3-0:$GTK2_LIBDIR/libgtk2.0-0])
+ [@gtk3@/bin:@gtk2@/bin])
if test "x$GTK_UPDATE_ICON_CACHE" = "xno"; then
AC_MSG_ERROR([gtk-update-icon-cache-3.0 or gtk-update-icon-cache not found])
fi
{
lib,
stdenv,
fetchFromGitHub,
cmake,
ninja,
gettext,
expat,
pkg-config,
}:
stdenv.mkDerivation {
pname = "libhangul";
version = "0.1.0-unstable-2023-04-15";
src = fetchFromGitHub {
owner = "libhangul";
repo = "libhangul";
rev = "154a5e0f13aebc80a465336642a406d6ddfc06cf";
hash = "sha256-MNuw/5/+W40sV34qAjDhKXcbFwHFW5Dm6X46FHWlc4M=";
};
nativeBuildInputs = [
cmake
ninja
gettext
expat
pkg-config
];
}
{
lib,
stdenv,
fetchFromGitHub,
replaceVars,
which,
pkg-config,
libtool,
gtk-doc,
intltool,
autoconf,
automake,
glib,
gtk2,
gtk3,
qt5,
qt6,
libayatana-appindicator,
libhangul-unstable,
libxkbcommon,
librsvg,
libxklavier,
withAnthy ? true,
anthy,
withM17n ? true,
m17n_lib,
m17n_db,
withRime ? true,
librime,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "nimf";
version = "1.3.8";
src = fetchFromGitHub {
owner = "hamonikr";
repo = "nimf";
rev = "refs/tags/v${finalAttrs.version}";
hash = "sha256-qXrG7FHa+kY5mLIk/lDpbQwERpb6AGIDQFMGrmGiz2s=";
};
patches = [
(replaceVars ./fix-paths.patch {
inherit anthy gtk2 gtk3;
gtk2-dev = gtk2.dev;
gtk3-dev = gtk3.dev;
qtbase = qt5.qtbase.bin;
})
];
nativeBuildInputs = [
which
pkg-config
libtool
gtk-doc
intltool
autoconf
automake
# qt5.wrapQtAppsHook
];
buildInputs =
[
glib
libhangul-unstable
libxkbcommon
librsvg
libayatana-appindicator
libxklavier
qt5.qtbase
qt6.qtbase
gtk2
gtk3
]
++ lib.optionals withAnthy [ anthy ]
++ lib.optionals withM17n [
m17n_db
m17n_lib
]
++ lib.optionals withRime [ librime ];
preConfigure = "./autogen.sh";
configureFlags =
lib.optional (!withAnthy) "--disable-anthy"
++ lib.optional (!withM17n) "--disable-m17n"
++ lib.optional (!withRime) "--disable-rime";
enableParallelBuilding = true;
env = {
# libhangul-unstable does not offer a pkgconfig file
NIMF_LIBHANGUL_DEPS_CFLAGS = "-I${libhangul-unstable}/include/hangul-1.0";
NIMF_LIBHANGUL_DEPS_LIBS = "-L${libhangul-unstable}/lib -lhangul";
NIX_CFLAGS_COMPILE = "-I${glib.out}/lib/glib-2.0/include";
};
meta = {
platforms = [
"x86_64-linux"
"aarch64-linux"
];
};
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment