Skip to content

Commit 006f20d

Browse files
authored
Unwrap libfswatch source (#37)
* Unzip source * Update configure for build process * Configure
1 parent 63d5e58 commit 006f20d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+8868
-37
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22
.Rhistory
33
.RData
44
.Ruserdata
5-
install
5+
/build/
6+
/install/
67
/docs/
78
/revdep/
89
/.claude/
910
.vscode
1011
air.toml
12+
.DS_Store

cleanup

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
#!/bin/sh
2-
rm -rf src/Makevars install
2+
rm -rf src/Makevars build install

cleanup.win

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
rm -rf src/Makevars install
1+
rm -rf src/Makevars build install

configure

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
#!/bin/sh
22

3-
# Upstream SHA of emcrisostomo/fswatch
4-
LIB_VER="5c443d2p"
5-
63
# Initialise
74
PKG_CFLAGS=""
85
PKG_LIBL="-lfswatch"
@@ -81,15 +78,13 @@ then
8178
exit 1
8279
fi
8380
fi
84-
gzip -dc src/fswatch-$LIB_VER.tar.gz | tar -xf -
85-
cd fswatch-$LIB_VER
86-
cmake -DCMAKE_INSTALL_PREFIX=../install -DCMAKE_INSTALL_LIBDIR=lib \
81+
cmake -S src/fswatch -B build \
82+
-DCMAKE_INSTALL_PREFIX=install -DCMAKE_INSTALL_LIBDIR=lib \
8783
-DBUILD_LIBS_ONLY=1 -DUSE_NLS=0 -DCMAKE_POSITION_INDEPENDENT_CODE=1 \
8884
-DCMAKE_COLOR_MAKEFILE=0 -DCMAKE_INSTALL_MESSAGE=NEVER \
89-
-DCMAKE_BUILD_TYPE=Release .
90-
cmake --build . --target install
91-
cd ..
92-
rm -rf fswatch-$LIB_VER
85+
-DCMAKE_BUILD_TYPE=Release
86+
cmake --build build --target install
87+
rm -rf build
9388

9489
if [ -d "install/lib" ]
9590
then

configure.ucrt

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
# Upstream SHA of emcrisostomo/fswatch
2-
LIB_VER="5c443d2p"
3-
41
# Find compiler and export flags
52
CC=`"${R_HOME}/bin/R" CMD config CC`
63
CFLAGS=`"${R_HOME}/bin/R" CMD config CFLAGS`
@@ -9,15 +6,13 @@ LDFLAGS=`"${R_HOME}/bin/R" CMD config LDFLAGS`
96
export CC CFLAGS CPPFLAGS LDFLAGS
107

118
echo "Compiling 'libfswatch' from source..."
12-
gzip -dc src/fswatch-$LIB_VER.tar.gz | tar -xf -
13-
cd fswatch-$LIB_VER
14-
cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX=../install \
9+
cmake -S src/fswatch -B build -G "Unix Makefiles" \
10+
-DCMAKE_INSTALL_PREFIX=install \
1511
-DBUILD_LIBS_ONLY=1 -DUSE_NLS=0 -DCMAKE_POSITION_INDEPENDENT_CODE=1 \
1612
-DCMAKE_COLOR_MAKEFILE=0 -DCMAKE_INSTALL_MESSAGE=NEVER \
17-
-DCMAKE_BUILD_TYPE=Release .
18-
cmake --build . --target install
19-
cd ..
20-
rm -rf fswatch-$LIB_VER
13+
-DCMAKE_BUILD_TYPE=Release
14+
cmake --build build --target install
15+
rm -rf build
2116

2217
# Success
2318
exit 0

configure.win

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
# Upstream SHA of emcrisostomo/fswatch
2-
LIB_VER="5c443d2p"
3-
4-
gzip -dc src/fswatch-$LIB_VER.tar.gz | tar -xf -
5-
61
for ARCH in x64 i386; do
72

83
if [ -e "${R_HOME}/bin/${ARCH}/R" ]; then
@@ -14,23 +9,19 @@ for ARCH in x64 i386; do
149

1510
echo "Compiling 'libfswatch' from source for ${ARCH} ..."
1611

17-
cd fswatch-$LIB_VER
18-
mkdir ${ARCH}
19-
cd ${ARCH}
20-
cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX=../../install/${ARCH} \
12+
cmake -S src/fswatch -B build -G "Unix Makefiles" \
13+
-DCMAKE_INSTALL_PREFIX=install/${ARCH} \
2114
-DBUILD_LIBS_ONLY=1 -DUSE_NLS=0 -DCMAKE_POSITION_INDEPENDENT_CODE=1 \
2215
-DCMAKE_COLOR_MAKEFILE=0 -DCMAKE_INSTALL_MESSAGE=NEVER \
23-
-DCMAKE_BUILD_TYPE=Release ..
24-
cmake --build . --target install
25-
cd ../..
16+
-DCMAKE_BUILD_TYPE=Release
17+
cmake --build build --target install
18+
rm -rf build
2619

2720
else
2821
echo "Note: ${ARCH} not installed, skipping ..."
2922
fi
3023

3124
done
3225

33-
rm -rf fswatch-$LIB_VER
34-
3526
# Success
3627
exit 0

src/fswatch-5c443d2p.tar.gz

-61.1 KB
Binary file not shown.

src/fswatch/AUTHORS

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
AUTHORS
2+
=======
3+
4+
Authors of libfswatch:
5+
6+
- Alan Dipert <[email protected]> (v. < 1.0.0).
7+
8+
- Enrico M. Crisostomo <[email protected]>

src/fswatch/AUTHORS.libfswatch

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
AUTHORS
2+
=======
3+
4+
Authors of libfswatch:
5+
6+
- Enrico M. Crisostomo <[email protected]>

src/fswatch/CMakeLists.txt

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
#
2+
# Copyright (c) 2014-2025 Enrico M. Crisostomo
3+
#
4+
# This program is free software; you can redistribute it and/or modify it under
5+
# the terms of the GNU General Public License as published by the Free Software
6+
# Foundation; either version 3, or (at your option) any later version.
7+
#
8+
# This program is distributed in the hope that it will be useful, but WITHOUT
9+
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
10+
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
11+
# details.
12+
#
13+
# You should have received a copy of the GNU General Public License along with
14+
# this program. If not, see <http://www.gnu.org/licenses/>.
15+
#
16+
cmake_minimum_required(VERSION 3.14)
17+
project(fswatch VERSION 1.19.0 LANGUAGES C CXX)
18+
19+
set(VERSION_MODIFIER "-develop")
20+
set(FULL_VERSION "${PROJECT_VERSION}${VERSION_MODIFIER}")
21+
22+
#@formatter:off
23+
set(PACKAGE "${PROJECT_NAME}")
24+
set(PACKAGE_NAME "${PACKAGE}")
25+
set(PACKAGE_VERSION "${FULL_VERSION}")
26+
set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
27+
set(PACKAGE_AUTHOR "[email protected]")
28+
set(PACKAGE_BUGREPORT "${PACKAGE_AUTHOR}")
29+
set(PACKAGE_TARNAME "${PACKAGE}")
30+
set(PACKAGE_URL "https://github.com/emcrisostomo/${PACKAGE}")
31+
set(LOCALEDIR "${CMAKE_INSTALL_PREFIX}/share/locale" CACHE FILEPATH "locale dir")
32+
#@formatter:on
33+
34+
if (NOT CMAKE_CXX_STANDARD)
35+
set(CMAKE_CXX_STANDARD 17)
36+
endif ()
37+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
38+
set(CMAKE_CXX_EXTENSIONS OFF)
39+
40+
set(CMAKE_STATIC_LIBRARY_SUFFIX ".b")
41+
42+
# Add option to choose between shared and static libraries
43+
option(BUILD_SHARED_LIBS "Build shared libraries" OFF)
44+
# Add option to build libfswatch only (without fswatch or tests)
45+
option(BUILD_LIBS_ONLY "Build libfswatch only" OFF)
46+
47+
# include modules
48+
include(FindGettext)
49+
include(FindIntl)
50+
include(CheckIncludeFileCXX)
51+
include(CheckStructHasMember)
52+
include(CheckCXXSymbolExists)
53+
54+
# check for gettext and libintl
55+
check_include_file_cxx(getopt.h HAVE_GETOPT_H)
56+
57+
if (HAVE_GETOPT_H)
58+
check_cxx_symbol_exists(getopt_long getopt.h HAVE_GETOPT_LONG)
59+
endif (HAVE_GETOPT_H)
60+
61+
# If both gettext and libintl are found, define the USE_NLS variable to
62+
# optionally disable them
63+
if (Intl_FOUND AND GETTEXT_FOUND)
64+
option(USE_NLS "Use NLS" ON)
65+
endif ()
66+
67+
if (USE_NLS)
68+
set(ENABLE_NLS 1)
69+
70+
# gettext configuration
71+
set(LINGUAS en en@quot en@boldquot it es)
72+
73+
foreach (language ${LINGUAS})
74+
configure_file(${PROJECT_SOURCE_DIR}/po/${language}.po ${PROJECT_BINARY_DIR}/${language}.po COPYONLY)
75+
endforeach ()
76+
77+
gettext_process_pot_file(po/${PACKAGE}.pot ALL INSTALL_DESTINATION share/locale LANGUAGES ${LINGUAS})
78+
endif ()
79+
80+
add_subdirectory(libfswatch)
81+
if (NOT BUILD_LIBS_ONLY)
82+
add_subdirectory(fswatch/src)
83+
add_subdirectory(test/src)
84+
endif ()

0 commit comments

Comments
 (0)