Skip to content

build: prepare for FHS, where GISBASE is not the absolute truth #5630

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

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from
Draft
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
50 changes: 32 additions & 18 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -176,19 +176,7 @@ set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
if(WITH_FHS)
file(CREATE_LINK ${OUTDIR}/${GRASS_INSTALL_DEMODIR}
${RUNTIME_GISBASE}/demolocation SYMBOLIC)
file(CREATE_LINK ${OUTDIR}/${GRASS_INSTALL_FONTSDIR} ${RUNTIME_GISBASE}/fonts
SYMBOLIC)
file(CREATE_LINK ${OUTDIR}/${GRASS_INSTALL_ETCDIR}/colors
${RUNTIME_GISBASE}/etc/colors SYMBOLIC)
file(CREATE_LINK ${OUTDIR}/${GRASS_INSTALL_ETCDIR}/colors.desc
${RUNTIME_GISBASE}/etc/colors.desc SYMBOLIC)
file(CREATE_LINK ${OUTDIR}/${GRASS_INSTALL_ETCDIR}/element_list
${RUNTIME_GISBASE}/etc/element_list SYMBOLIC)
file(CREATE_LINK ${OUTDIR}/${GRASS_INSTALL_ETCDIR}/renamed_options
${RUNTIME_GISBASE}/etc/renamed_options SYMBOLIC)
file(CREATE_LINK ${OUTDIR}/${GRASS_INSTALL_ETCDIR}/VERSIONNUMBER
${RUNTIME_GISBASE}/etc/VERSIONNUMBER SYMBOLIC)
file(MAKE_DIRECTORY "${GISBASE}/gui/wxpython")
file(MAKE_DIRECTORY "${RUNTIME_GISBASE}/gui/wxpython")
file(CREATE_LINK ${OUTDIR}/${GRASS_INSTALL_GUIDIR}/wxpython/xml
${RUNTIME_GISBASE}/gui/wxpython/xml SYMBOLIC)
endif()
Expand Down Expand Up @@ -228,6 +216,17 @@ if(WIN32)
${CMAKE_COMMAND} -E env "PATH=${BIN_DIR}${sep}${SCRIPTS_DIR}${sep}${env_path}${sep}${LIB_DIR}"
"PYTHONPATH=${ETC_PYTHON_DIR}${sep}${GUI_WXPYTHON_DIR}${sep}$ENV{PYTHONPATH}"
"GRASS_PYTHON=${PYTHON_EXECUTABLE}" "GISBASE=${RUN_GISBASE_NATIVE}" "GISRC=${GISRC}" "LC_ALL=C" "LANG=C"
"GRASS_COLORSDIR=${RUNTIME_GRASS_COLORSDIR}"
"GRASS_DOCDIR=${RUNTIME_GRASS_DOCDIR}"
"GRASS_ETCDIR=${RUNTIME_GRASS_ETCDIR}"
"GRASS_FONTSDIR=${RUNTIME_GRASS_FONTSDIR}"
"GRASS_GRAPHICSDIR=${RUNTIME_GRASS_GRAPHICSDIR}"
"GRASS_GUIRESDIR=${RUNTIME_GRASS_GUIRESDIR}"
"GRASS_GUISCRIPTDIR=${RUNTIME_GRASS_GUISCRIPTDIR}"
"GRASS_GUIWXDIR=${GUI_WXPYTHON_DIR}"
"GRASS_LOCALEDIR=${RUNTIME_GRASS_LOCALEDIR}"
"GRASS_MKDOCSDIR=${RUNTIME_GRASS_MKDOCSDIR}"
"GRASS_SHAREDIR=${RUNTIME_GRASS_SHAREDIR}"
"ARCH=${BUILD_ARCH}" "ARCH_DISTDIR=${RUN_GISBASE_NATIVE}"
"LANGUAGE=C" "MODULE_TOPDIR=${MODULE_TOPDIR}" "HTMLDIR=${DOC_DIR}"
"LC_ALL=C" "LANG=C"
Expand All @@ -244,6 +243,17 @@ else()
"PYTHONPATH=${ETC_PYTHON_DIR}${sep}${GUI_WXPYTHON_DIR}${sep}$ENV{PYTHONPATH}"
"LD_LIBRARY_PATH=${LIB_DIR}${sep}$ENV{LD_LIBRARY_PATH}"
"GISBASE=${RUN_GISBASE_NATIVE}" "GISRC=${GISRC}" "LC_ALL=C" "LANG=C"
"GRASS_COLORSDIR=${RUNTIME_GRASS_COLORSDIR}"
"GRASS_DOCDIR=${RUNTIME_GRASS_DOCDIR}"
"GRASS_ETCDIR=${RUNTIME_GRASS_ETCDIR}"
"GRASS_FONTSDIR=${RUNTIME_GRASS_FONTSDIR}"
"GRASS_GRAPHICSDIR=${RUNTIME_GRASS_GRAPHICSDIR}"
"GRASS_GUIRESDIR=${RUNTIME_GRASS_GUIRESDIR}"
"GRASS_GUISCRIPTDIR=${RUNTIME_GRASS_GUISCRIPTDIR}"
"GRASS_GUIWXDIR=${GUI_WXPYTHON_DIR}"
"GRASS_LOCALEDIR=${RUNTIME_GRASS_LOCALEDIR}"
"GRASS_MKDOCSDIR=${RUNTIME_GRASS_MKDOCSDIR}"
"GRASS_SHAREDIR=${RUNTIME_GRASS_SHAREDIR}"
"ARCH=${BUILD_ARCH}" "ARCH_DISTDIR=${RUN_GISBASE_NATIVE}"
"LANGUAGE=C" "MODULE_TOPDIR=${MODULE_TOPDIR}" "HTMLDIR=${DOC_DIR}"
"VERSION_NUMBER=\"${GRASS_VERSION_NUMBER}\""
Expand Down Expand Up @@ -299,14 +309,18 @@ endif()
add_custom_target(
r_colors_thumbnails ALL
COMMAND ${CMAKE_COMMAND} -E make_directory
${OUTDIR}/${GRASS_INSTALL_DOCDIR}/colortables
${OUTDIR}/${GRASS_INSTALL_GRAPHICSDIR}/colortables
COMMAND ${grass_env_command} ${PYTHON_EXECUTABLE} ${THUMBNAILS_PY}
${OUTDIR}/${GRASS_INSTALL_DOCDIR}/colortables
BYPRODUCTS ${OUTDIR}/${GRASS_INSTALL_DOCDIR}/colortables
${OUTDIR}/${GRASS_INSTALL_GRAPHICSDIR}/colortables
BYPRODUCTS ${OUTDIR}/${GRASS_INSTALL_GRAPHICSDIR}/colortables
COMMENT "Creating thumbnails"
DEPENDS ALL_MODULES)
install(DIRECTORY ${OUTDIR}/${GRASS_INSTALL_DOCDIR}/colortables
DESTINATION ${GRASS_INSTALL_DOCDIR})
install(DIRECTORY ${OUTDIR}/${GRASS_INSTALL_GRAPHICSDIR}/colortables
DESTINATION ${GRASS_INSTALL_GRAPHICSDIR})
if(WITH_FHS AND WITH_DOCS)
install(DIRECTORY ${OUTDIR}/${GRASS_INSTALL_GRAPHICSDIR}/colortables
DESTINATION ${GRASS_INSTALL_DOCDIR})
endif()

set(misc_files
AUTHORS
Expand Down
37 changes: 35 additions & 2 deletions cmake/modules/GRASSInstallDirs.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,14 @@ if(WITH_FHS)
set(GRASS_INSTALL_DEVDOCDIR
"${CMAKE_INSTALL_DATAROOTDIR}/doc/${PROJECT_NAME_LOWER}-dev-doc")
set(GRASS_INSTALL_MANDIR "${CMAKE_INSTALL_MANDIR}")
set(GRASS_INSTALL_MKDOCSDIR
"${CMAKE_INSTALL_DATAROOTDIR}/doc/${PROJECT_NAME_LOWER}-mkdocs")
set(GRASS_INSTALL_MKDOCSDIR "${GRASS_INSTALL_SHAREDIR}/mkdocs")
set(GRASS_INSTALL_DEMODIR "${GRASS_INSTALL_SHAREDIR}/demolocation")
set(GRASS_INSTALL_MISCDIR "${GRASS_INSTALL_SHAREDIR}")
set(GRASS_INSTALL_MAKEFILEDIR "${GISBASE_DIR}/Make")
set(GRASS_INSTALL_LOCALEDIR "${CMAKE_INSTALL_LOCALEDIR}")
set(GRASS_INSTALL_COLORSDIR "${GRASS_INSTALL_ETCDIR}/colors")
set(GRASS_INSTALL_GRAPHICSDIR "${GRASS_INSTALL_ETCDIR}/graphics")
set(GRASS_INSTALL_GRASS_GUIWXDIR "${GRASS_INSTALL_GUIDIR}/wxpython")
else()
message("Legacy file structure")
set(GISBASE_DIR "${CMAKE_INSTALL_LIBDIR}/grass${GRASS_VERSION_MAJOR}${GRASS_VERSION_MINOR}")
Expand All @@ -52,6 +54,9 @@ else()
set(GRASS_INSTALL_MISCDIR "${GISBASE_DIR}")
set(GRASS_INSTALL_MAKEFILEDIR "${GISBASE_DIR}/Make")
set(GRASS_INSTALL_LOCALEDIR "${GISBASE_DIR}/locale")
set(GRASS_INSTALL_COLORSDIR "${GRASS_INSTALL_ETCDIR}/colors")
set(GRASS_INSTALL_GRAPHICSDIR "${GRASS_INSTALL_DOCDIR}")
set(GRASS_INSTALL_GRASS_GUIWXDIR "${GRASS_INSTALL_GUIDIR}/wxpython")
endif()

message(STATUS "GISBASE_DIR ${GISBASE_DIR}")
Expand All @@ -76,10 +81,38 @@ message(STATUS "GRASS_INSTALL_DEMODIR ${GRASS_INSTALL_DEMODIR}")
message(STATUS "GRASS_INSTALL_MISCDIR ${GRASS_INSTALL_MISCDIR}")
message(STATUS "GRASS_INSTALL_MAKEFILEDIR ${GRASS_INSTALL_MAKEFILEDIR}")
message(STATUS "GRASS_INSTALL_LOCALEDIR ${GRASS_INSTALL_LOCALEDIR}")
message(STATUS "GRASS_INSTALL_COLORSDIR ${GRASS_INSTALL_COLORSDIR}")
message(STATUS "GRASS_INSTALL_GRAPHICSDIR ${GRASS_INSTALL_GRAPHICSDIR}")
message(STATUS "GRASS_INSTALL_GRASS_GUIWXDIR ${GRASS_INSTALL_GRASS_GUIWXDIR}")

set(OUTDIR "${CMAKE_BINARY_DIR}/output")
set(GISBASE ${CMAKE_INSTALL_PREFIX}/${GISBASE_DIR})

set(GRASS_SHAREDIR "${GRASS_INSTALL_SHAREDIR}")
set(GRASS_LOCALEDIR "${GRASS_INSTALL_LOCALEDIR}")
set(GRASS_GUIRESDIR "${GRASS_INSTALL_GUIDIR}")
set(GRASS_GUISCRIPTDIR "${GRASS_INSTALL_GUISCRIPTDIR}")
set(GRASS_DOCDIR "${GRASS_INSTALL_DOCDIR}")
set(GRASS_MKDOCSDIR "${GRASS_INSTALL_MKDOCSDIR}")
set(GRASS_FONTSDIR "${GRASS_INSTALL_FONTSDIR}")
set(GRASS_COLORSDIR "${GRASS_INSTALL_COLORSDIR}")
set(GRASS_GRAPHICSDIR "${GRASS_INSTALL_GRAPHICSDIR}")
set(GRASS_ETCDIR "${GRASS_INSTALL_ETCDIR}")
set(GRASS_PYDIR "${GRASS_INSTALL_PYDIR}")
set(GRASS_GUIWXDIR "${GRASS_INSTALL_GRASS_GUIWXDIR}")

set(RUNTIME_GISBASE "${OUTDIR}/${GISBASE_DIR}")
set(RUNTIME_GRASS_SHAREDIR "${OUTDIR}/${GRASS_INSTALL_SHAREDIR}")
set(RUNTIME_GRASS_LOCALEDIR "${OUTDIR}/${GRASS_INSTALL_LOCALEDIR}")
set(RUNTIME_GRASS_GUIRESDIR "${OUTDIR}/${GRASS_INSTALL_GUIDIR}")
set(RUNTIME_GRASS_GUISCRIPTDIR "${OUTDIR}/${GRASS_INSTALL_GUISCRIPTDIR}")
set(RUNTIME_GRASS_DOCDIR "${OUTDIR}/${GRASS_INSTALL_DOCDIR}")
set(RUNTIME_GRASS_MKDOCSDIR "${OUTDIR}/${GRASS_INSTALL_MKDOCSDIR}")
set(RUNTIME_GRASS_FONTSDIR "${OUTDIR}/${GRASS_INSTALL_FONTSDIR}")
set(RUNTIME_GRASS_COLORSDIR "${OUTDIR}/${GRASS_INSTALL_COLORSDIR}")
set(RUNTIME_GRASS_GRAPHICSDIR "${OUTDIR}/${GRASS_INSTALL_GRAPHICSDIR}")
set(RUNTIME_GRASS_ETCDIR "${OUTDIR}/${GRASS_INSTALL_ETCDIR}")

set(GISRC_NAME ".grassrc${GRASS_VERSION_MAJOR}${GRASS_VERSION_MINOR}")

file(TO_NATIVE_PATH "${CMAKE_SOURCE_DIR}" MODULE_TOPDIR)
Expand Down
7 changes: 6 additions & 1 deletion cmake/modules/copy_python_files_in_subdir.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,15 @@ SPDX-License-Identifier: GPL-2.0-or-later
#]]

function(copy_python_files_in_subdir dir_name dst_prefix)
cmake_parse_arguments(G "PRE_BUILD;PRE_LINK;POST_BUILD" "TARGET" "" ${ARGN})
cmake_parse_arguments(G "PRE_BUILD;PRE_LINK;POST_BUILD" "TARGET" "EXCLUDE" ${ARGN})

file(GLOB PY_FILES "${CMAKE_CURRENT_SOURCE_DIR}/${dir_name}/*.py")

if(G_EXCLUDE)
list(TRANSFORM G_EXCLUDE APPEND "${CMAKE_CURRENT_SOURCE_DIR}/${dir_name}/")
list(REMOVE_ITEM PY_FILES ${G_EXCLUDE})
endif()

if(DEFINED G_TARGET)
if(${G_PRE_BUILD})
set(BUILD PRE_BUILD)
Expand Down
26 changes: 17 additions & 9 deletions display/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,16 @@ add_custom_command(
TARGET d.barscale
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E make_directory
${OUTDIR}/${GRASS_INSTALL_DOCDIR}/barscales
${OUTDIR}/${GRASS_INSTALL_GRAPHICSDIR}/barscales
COMMAND ${CMAKE_COMMAND} -E copy ${d_barscale_png}
${OUTDIR}/${GRASS_INSTALL_DOCDIR}/barscales
BYPRODUCTS ${OUTDIR}/${GRASS_INSTALL_DOCDIR}/barscales)
install(DIRECTORY ${OUTDIR}/${GRASS_INSTALL_DOCDIR}/barscales
DESTINATION ${GRASS_INSTALL_DOCDIR})
${OUTDIR}/${GRASS_INSTALL_GRAPHICSDIR}/barscales
BYPRODUCTS ${OUTDIR}/${GRASS_INSTALL_GRAPHICSDIR}/barscales)
install(DIRECTORY ${OUTDIR}/${GRASS_INSTALL_GRAPHICSDIR}/barscales
DESTINATION ${GRASS_INSTALL_GRAPHICSDIR})
if(WITH_FHS AND WITH_DOCS)
install(DIRECTORY ${OUTDIR}/${GRASS_INSTALL_GRAPHICSDIR}/barscales
DESTINATION ${GRASS_INSTALL_DOCDIR})
endif()

build_program_in_subdir(d.colorlist DEPENDS grass_gis grass_display
grass_raster)
Expand Down Expand Up @@ -108,13 +112,17 @@ build_program_in_subdir(d.linegraph DEPENDS grass_gis grass_display grass_symb
build_program_in_subdir(d.northarrow DEPENDS grass_gis grass_display grass_symb
${LIBM})
if(WITH_DOCS)
file(MAKE_DIRECTORY ${OUTDIR}/${GRASS_INSTALL_DOCDIR}/northarrows)
file(MAKE_DIRECTORY ${OUTDIR}/${GRASS_INSTALL_GRAPHICSDIR}/northarrows)
file(GLOB d_northarrow_png
${CMAKE_CURRENT_SOURCE_DIR}/d.northarrow/thumbnails/*.png)
file(COPY ${d_northarrow_png}
DESTINATION ${OUTDIR}/${GRASS_INSTALL_DOCDIR}/northarrows)
install(DIRECTORY ${OUTDIR}/${GRASS_INSTALL_DOCDIR}/northarrows
DESTINATION ${GRASS_INSTALL_DOCDIR})
DESTINATION ${OUTDIR}/${GRASS_INSTALL_GRAPHICSDIR}/northarrows)
install(DIRECTORY ${OUTDIR}/${GRASS_INSTALL_GRAPHICSDIR}/northarrows
DESTINATION ${GRASS_INSTALL_GRAPHICSDIR})
if(WITH_FHS)
install(DIRECTORY ${OUTDIR}/${GRASS_INSTALL_GRAPHICSDIR}/northarrows
DESTINATION ${GRASS_INSTALL_DOCDIR})
endif()
endif()
build_program_in_subdir(d.path DEPENDS grass_gis grass_display grass_vector)
build_program_in_subdir(d.profile DEPENDS grass_gis grass_display grass_raster
Expand Down
4 changes: 2 additions & 2 deletions display/d.linegraph/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ static char *icon_files(void)

list = NULL;
len = 0;
snprintf(path, sizeof(path), "%s/etc/symbol", G_gisbase());
snprintf(path, sizeof(path), "%s/etc/symbol", G_share_dir());

dir = opendir(path);
if (!dir)
Expand All @@ -102,7 +102,7 @@ static char *icon_files(void)
if (d->d_name[0] == '.')
continue;

snprintf(path_i, sizeof(path_i), "%s/etc/symbol/%s", G_gisbase(),
snprintf(path_i, sizeof(path_i), "%s/etc/symbol/%s", G_share_dir(),
d->d_name);
dir_i = opendir(path_i);

Expand Down
8 changes: 6 additions & 2 deletions display/d.mon/start.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,12 @@ char *start_wx(const char *name, const char *element, int width, int height,
mapfile = (char *)G_malloc(GPATH_MAX);
mapfile[0] = '\0';

snprintf(progname, sizeof(progname), "%s/gui/wxpython/mapdisp/main.py",
G_gisbase());
const char *wxdir = getenv("GRASS_GUIWXDIR");
if (!wxdir)
G_fatal_error(_("Incomplete GRASS session: Variable '%s' not set"),
"GRASS_GUIWXDIR");

snprintf(progname, sizeof(progname), "%s/mapdisp/main.py", wxdir);
snprintf(str_width, sizeof(str_width), "%d", width);
snprintf(str_height, sizeof(str_height), "%d", height);

Expand Down
4 changes: 2 additions & 2 deletions display/d.vect.thematic/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -645,7 +645,7 @@ static char *icon_files(void)

list = NULL;
len = 0;
snprintf(path, sizeof(path), "%s/etc/symbol", G_gisbase());
snprintf(path, sizeof(path), "%s/etc/symbol", G_share_dir());

dir = opendir(path);
if (!dir)
Expand All @@ -658,7 +658,7 @@ static char *icon_files(void)
if (d->d_name[0] == '.')
continue;

snprintf(path_i, sizeof(path_i), "%s/etc/symbol/%s", G_gisbase(),
snprintf(path_i, sizeof(path_i), "%s/etc/symbol/%s", G_share_dir(),
d->d_name);
dir_i = opendir(path_i);

Expand Down
4 changes: 2 additions & 2 deletions display/d.vect/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@ char *icon_files(void)

list = NULL;
len = 0;
snprintf(path, sizeof(path), "%s/etc/symbol", G_gisbase());
snprintf(path, sizeof(path), "%s/etc/symbol", G_share_dir());

dir = opendir(path);
if (!dir)
Expand All @@ -544,7 +544,7 @@ char *icon_files(void)
if (d->d_name[0] == '.')
continue;

snprintf(path_i, sizeof(path_i), "%s/etc/symbol/%s", G_gisbase(),
snprintf(path_i, sizeof(path_i), "%s/etc/symbol/%s", G_share_dir(),
d->d_name);
dir_i = opendir(path_i);

Expand Down
2 changes: 1 addition & 1 deletion doc/examples/gui/wxpython/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

# this enables to run application standalone (> python example/frame.py )
if __name__ == "__main__":
sys.path.append(os.path.join(os.environ["GISBASE"], "etc", "gui", "wxpython"))
sys.path.append(os.environ["GRASS_GUIWXDIR"])

# i18n is taken care of in the grass library code.
# So we need to import it before any of the GUI code.
Expand Down
2 changes: 1 addition & 1 deletion doc/examples/gui/wxpython/g.gui.example.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
import grass.script.core as gcore

if __name__ == "__main__":
wxbase = os.path.join(os.getenv("GISBASE"), "etc", "gui", "wxpython")
wxbase = os.environ["GRASS_GUIWXDIR"]
if wxbase not in sys.path:
sys.path.append(wxbase)

Expand Down
8 changes: 6 additions & 2 deletions general/g.gui/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,12 @@ int main(int argc, char *argv[])
exit(EXIT_SUCCESS);
}

snprintf(progname, sizeof(progname), "%s/gui/wxpython/wxgui.py",
G_gisbase());
const char *wxdir = getenv("GRASS_GUIWXDIR");
if (!wxdir)
G_fatal_error(_("Incomplete GRASS session: Variable '%s' not set"),
"GRASS_GUIWXDIR");

snprintf(progname, sizeof(progname), "%s/wxgui.py", wxdir);
if (access(progname, F_OK) == -1)
G_fatal_error(_("Your installation doesn't include GUI, exiting."));

Expand Down
4 changes: 2 additions & 2 deletions general/g.mapset/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ int main(int argc, char *argv[])
if (!gis_lock)
G_fatal_error(_("Unable to read GIS_LOCK environment variable"));

G_asprintf(&lock_prog, "%s/etc/lock", G_gisbase());
G_asprintf(&lock_prog, "%s/lock", G_etc_dir());

snprintf(path, sizeof(path), "%s/.gislock", mapset_new_path);
G_debug(2, "%s", path);
Expand All @@ -191,7 +191,7 @@ int main(int argc, char *argv[])
}

/* Clean temporary directory */
snprintf(path, sizeof(path), "%s/etc/clean_temp", G_gisbase());
snprintf(path, sizeof(path), "%s/etc/clean_temp", G_share_dir());
G_verbose_message(_("Cleaning up temporary files..."));
G_spawn(path, "clean_temp", NULL);

Expand Down
10 changes: 8 additions & 2 deletions general/g.mapsets/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,14 @@ int main(int argc, char *argv[])
if (opt.dialog->answer) {
if (opt.mapset->answer)
G_warning(_("Option <%s> ignored"), opt.mapset->key);
snprintf(path_buf, sizeof(path_buf),
"%s/gui/wxpython/modules/mapsets_picker.py", G_gisbase());

const char *wxdir = getenv("GRASS_GUIWXDIR");
if (!wxdir)
G_fatal_error(_("Incomplete GRASS session: Variable '%s' not set"),
"GRASS_GUIWXDIR");

snprintf(path_buf, sizeof(path_buf), "%s/modules/mapsets_picker.py",
wxdir);
G_spawn(getenv("GRASS_PYTHON"), "mapsets_picker.py", path_buf, NULL);
exit(EXIT_SUCCESS);
}
Expand Down
3 changes: 2 additions & 1 deletion general/g.mkfontcap/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ default: cmd $(CAPFILE)
endif

$(CAPFILE): $(BIN)/$(PGM)$(EXE)
GISRC=junk GISBASE=$(RUN_GISBASE) \
GISRC=junk GISBASE=$(RUN_GISBASE) GRASS_SHAREDIR=$(RUN_GISBASE) \
GRASS_LOCALEDIR=$(RUN_GISBASE)/locale GRASS_FONTSDIR=$(RUN_GISBASE)/fonts \
$(LD_LIBRARY_PATH_VAR)="$(ARCH_LIBDIR):$(BASE_LIBDIR):$($(LD_LIBRARY_PATH_VAR))" \
$< -s > $@
4 changes: 2 additions & 2 deletions general/g.mkfontcap/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,13 @@ int main(int argc, char *argv[])
exit(EXIT_FAILURE);

if (!tostdout->answer) {
const char *gisbase = G_gisbase();
const char *share_dir = G_share_dir();
const char *alt_file = getenv("GRASS_FONT_CAP");

if (alt_file)
fontcapfile = G_store(alt_file);
else
G_asprintf(&fontcapfile, "%s/etc/fontcap", gisbase);
G_asprintf(&fontcapfile, "%s/etc/fontcap", share_dir);

if (!access(fontcapfile, F_OK)) { /* File exists? */
if (!G_get_overwrite())
Expand Down
5 changes: 2 additions & 3 deletions general/g.mkfontcap/stroke_fonts.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,11 @@ static const char *get_desc(const char *);

void find_stroke_fonts(void)
{
char *dirpath, *fonttable;
char *fonttable;
char **dirlisting;
int numfiles, i;

G_asprintf(&dirpath, "%s/fonts", G_gisbase());

const char *dirpath = G_fonts_dir();
dirlisting = G_ls2(dirpath, &numfiles);

G_asprintf(&fonttable, "%s/fonts.table", dirpath);
Expand Down
Loading
Loading