Skip to content
Open
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
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Makefile.cmake linguist-language=makefile
8 changes: 4 additions & 4 deletions Makefile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ all:
@echo "Run 'make install' for installation."
@echo "Run 'make uninstall' for uninstallation."
mkdir -p build
cd build && cmake -G "CodeBlocks - Unix Makefiles" ../src
cd build && cmake -DCMAKE_INSTALL_PREFIX=$(DESTDIR) ../src

install:
@echo "Installing"
cd build && cmake -DCMAKE_INSTALL_PREFIX=$(DESTDIR) -G "CodeBlocks - Unix Makefiles" ../src
cd build && cmake -DCMAKE_INSTALL_PREFIX=$(DESTDIR) ../src
$(MAKE) -C src/scripts install
$(MAKE) -C build install_build
$(MAKE) -C build install

uninstall:
$(MAKE) -C src/scripts uninstall
$(MAKE) -C build uninstall_build
$(MAKE) -C build uninstall
79 changes: 35 additions & 44 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,54 +8,45 @@ include_directories(${GTK_INCLUDE_DIRS})
include_directories(${X11_INCLUDE_DIRS})

set(CMAKE_C_STANDARD 99)
set (CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD 11)

add_executable(wihotspot-gui ui/main.c ui/h_prop.c ui/h_prop.h ui/ui.c ui/ui.h ui/read_config.cpp ui/read_config.h ui/util.c ui/util.h)

target_link_libraries(${PROJECT_NAME} ${GTK_LIBRARIES} ${X11_LIBRARIES})

include_directories(/usr/include)

set (source "${CMAKE_SOURCE_DIR}/ui/glade")
set (destination "${CMAKE_CURRENT_BINARY_DIR}/glade")
set(source "${CMAKE_SOURCE_DIR}/ui/glade")
set(destination "${CMAKE_CURRENT_BINARY_DIR}/glade")

add_custom_command(
TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E create_symlink ${source} ${destination}
DEPENDS ${destination}
COMMENT "symbolic link resources folder from ${source} => ${destination}"
)

set (appdir "/usr/share")
set (appbin "/usr/bin")

add_custom_target(install_build

COMMAND mkdir -p $ENV{DESTDIR}${appdir}/${PROJECT_NAME}
COMMAND mkdir -p $ENV{DESTDIR}${appdir}/${PROJECT_NAME}/glade
COMMAND install -Dm755 ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME} $ENV{DESTDIR}${appdir}/${PROJECT_NAME}/${PROJECT_NAME}
COMMAND install -Dm755 ${CMAKE_CURRENT_BINARY_DIR}/glade/* $ENV{DESTDIR}${appdir}/${PROJECT_NAME}/glade/
COMMAND ln -rs $ENV{DESTDIR}${appdir}/${PROJECT_NAME}/${PROJECT_NAME} $ENV{DESTDIR}${appbin}/${PROJECT_NAME}

COMMAND install -Dm644 ${CMAKE_SOURCE_DIR}/desktop/hotspot.png $ENV{DESTDIR}${appdir}/${PROJECT_NAME}/hotspot.png
COMMAND install -Dm644 ${CMAKE_SOURCE_DIR}/desktop/wifihotspot.desktop $ENV{DESTDIR}${appdir}/${PROJECT_NAME}/${PROJECT_NAME}.desktop
COMMAND install -Dm644 ${CMAKE_SOURCE_DIR}/desktop/wifihotspot.desktop $ENV{DESTDIR}${appdir}/applications/${PROJECT_NAME}.desktop
DEPENDS ${PROJECT_NAME}
COMMENT Installing files...

COMMENT Remove old files if exist
COMMAND rm -rf $ENV{DESTDIR}${appdir}/wihotspot
COMMAND rm -f $ENV{DESTDIR}${appdir}/applications/wihotspot.desktop
)

add_custom_target(uninstall_build
COMMAND rm -rf $ENV{DESTDIR}${appdir}/${PROJECT_NAME}
COMMAND rm -f $ENV{DESTDIR}${appbin}/${PROJECT_NAME}
COMMAND rm -f $ENV{DESTDIR}${appdir}/applications/${PROJECT_NAME}.desktop
COMMAND rm -rf $ENV{DESTDIR}${appdir}/${PROJECT_NAME}
COMMENT Uninstalling files...

COMMENT Remove old files if exist
COMMAND rm -rf $ENV{DESTDIR}${appdir}/wihotspot
COMMAND rm -f $ENV{DESTDIR}${appdir}/applications/wihotspot.desktop
)
TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E create_symlink ${source} ${destination}
DEPENDS ${destination}
COMMENT "symbolic link resources folder from ${source} => ${destination}")

install(TARGETS ${PROJECT_NAME}
DESTINATION share/${PROJECT_NAME})
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/glade
DESTINATION share/${PROJECT_NAME})
install(CODE "execute_process( \
COMMAND ${CMAKE_COMMAND} -E create_symlink \
${CMAKE_INSTALL_PREFIX}/share/${PROJECT_NAME}/${PROJECT_NAME} \
${CMAKE_INSTALL_PREFIX}/bin/${PROJECT_NAME} \
)")
install(FILES ${CMAKE_SOURCE_DIR}/desktop/hotspot.png
DESTINATION share/${PROJECT_NAME})
install(FILES ${CMAKE_SOURCE_DIR}/desktop/wifihotspot.desktop
DESTINATION share/${PROJECT_NAME}
RENAME ${PROJECT_NAME}.desktop)
install(FILES ${CMAKE_SOURCE_DIR}/desktop/wifihotspot.desktop
DESTINATION share/applications
RENAME ${PROJECT_NAME}.desktop)

add_custom_target(uninstall
COMMAND rm -rf ${CMAKE_INSTALL_PREFIX}/share/${PROJECT_NAME}
COMMAND rm -f ${CMAKE_INSTALL_PREFIX}/bin/${PROJECT_NAME}
COMMAND rm -f ${CMAKE_INSTALL_PREFIX}/share/applications/${PROJECT_NAME}.desktop
COMMAND rm -rf ${CMAKE_INSTALL_PREFIX}/share/${PROJECT_NAME}
COMMENT Uninstalling files...
COMMENT Remove old files if exist
COMMAND rm -rf ${CMAKE_INSTALL_PREFIX}/share/wihotspot
COMMAND rm -f ${CMAKE_INSTALL_PREFIX}/share/applications/wihotspot.desktop)
60 changes: 31 additions & 29 deletions src/Makefile
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
CC=gcc
PKGCONFIG = $(shell which pkg-config)
CC?=cc
PKGCONFIG?=pkg-config

CFLAGS=`pkg-config --cflags gtk+-3.0`
LIBS=`pkg-config --libs gtk+-3.0 --libs x11` -lstdc++ -lpng -lqrencode
EXTRA_CFLAGS?=
EXTRA_LIBS?=

APP_NAME="wihotspot"
APP_GUI_BINARY="wihotspot-gui"
CFLAGS=$(shell $(PKGCONFIG) --cflags gtk+-3.0) $(EXTRA_CFLAGS)
LIBS=$(shell $(PKGCONFIG) --libs gtk+-3.0 --libs x11) -lstdc++ -lpng -lqrencode $(EXTRA_LIBS)

PREFIX=/usr
BINDIR=$(PREFIX)/bin
APP_NAME=wihotspot
APP_GUI_BINARY=wihotspot-gui

DESTDIR?=/usr

ODIR=../build

Expand Down Expand Up @@ -41,33 +43,33 @@ wihotspot-gui: $(OBJ)
$(CC) -o $(ODIR)/$@ $^ $(CFLAGS) $(LIBS)

install: $(ODIR)/wihotspot-gui
install -Dm644 desktop/icons/hotspot@64.png $(DESTDIR)$(PREFIX)/share/pixmaps/wihotspot.png
install -Dm644 desktop/icons/hotspot@48.png $(DESTDIR)$(PREFIX)/share/icons/hicolor/48x48/apps/wihotspot.png
install -Dm644 desktop/icons/hotspot@64.png $(DESTDIR)$(PREFIX)/share/icons/hicolor/64x64/apps/wihotspot.png
install -Dm644 desktop/icons/hotspot@256.png $(DESTDIR)$(PREFIX)/share/icons/hicolor/256x256/apps/wihotspot.png
install -Dm644 desktop/icons/hotspot@512.png $(DESTDIR)$(PREFIX)/share/icons/hicolor/512x512/apps/wihotspot.png
install -Dm644 desktop/icons/hotspot.svg $(DESTDIR)$(PREFIX)/share/icons/hicolor/scalable/apps/wihotspot.svg
install -Dm644 desktop/wifihotspot.desktop $(DESTDIR)$(PREFIX)/share/applications/$(APP_NAME).desktop
install -Dm644 scripts/policies/polkit.rules $(DESTDIR)$(PREFIX)/share/polkit-1/rules.d/90-org.opensuse.policykit.wihotspot.rules
install -Dm644 scripts/policies/polkit.policy $(DESTDIR)$(PREFIX)/share/polkit-1/actions/org.opensuse.policykit.wihotspot.policy
install -Dm755 $(ODIR)/wihotspot-gui $(DESTDIR)$(BINDIR)/$(APP_GUI_BINARY)
install -Dm644 desktop/icons/hotspot@64.png $(DESTDIR)/share/pixmaps/wihotspot.png
install -Dm644 desktop/icons/hotspot@48.png $(DESTDIR)/share/icons/hicolor/48x48/apps/wihotspot.png
install -Dm644 desktop/icons/hotspot@64.png $(DESTDIR)/share/icons/hicolor/64x64/apps/wihotspot.png
install -Dm644 desktop/icons/hotspot@256.png $(DESTDIR)/share/icons/hicolor/256x256/apps/wihotspot.png
install -Dm644 desktop/icons/hotspot@512.png $(DESTDIR)/share/icons/hicolor/512x512/apps/wihotspot.png
install -Dm644 desktop/icons/hotspot.svg $(DESTDIR)/share/icons/hicolor/scalable/apps/wihotspot.svg
install -Dm644 desktop/wifihotspot.desktop $(DESTDIR)/share/applications/$(APP_NAME).desktop
install -Dm644 scripts/policies/polkit.rules $(DESTDIR)/share/polkit-1/rules.d/90-org.opensuse.policykit.wihotspot.rules
install -Dm644 scripts/policies/polkit.policy $(DESTDIR)/share/polkit-1/actions/org.opensuse.policykit.wihotspot.policy
install -Dm755 $(ODIR)/wihotspot-gui $(DESTDIR)/bin/$(APP_GUI_BINARY)
cd scripts && $(MAKE) install

uninstall:
rm -f $(DESTDIR)$(PREFIX)/share/pixmaps/wihotspot.png
rm -f $(DESTDIR)$(PREFIX)/share/icons/hicolor/48x48/apps/wihotspot.png
rm -f $(DESTDIR)$(PREFIX)/share/icons/hicolor/64x64/apps/wihotspot.png
rm -f $(DESTDIR)$(PREFIX)/share/icons/hicolor/256x256/apps/wihotspot.png
rm -f $(DESTDIR)$(PREFIX)/share/icons/hicolor/512x512/apps/wihotspot.png
rm -f $(DESTDIR)$(PREFIX)/share/icons/hicolor/scalable/apps/wihotspot.svg
rm -f $(DESTDIR)$(PREFIX)/share/applications/$(APP_NAME).desktop
rm -f $(DESTDIR)$(PREFIX)/share/polkit-1/rules.d/90-org.opensuse.policykit.wihotspot.rules
rm -f $(DESTDIR)$(PREFIX)/share/polkit-1/actions/org.opensuse.policykit.wihotspot.policy
rm -f $(DESTDIR)$(BINDIR)/$(APP_GUI_BINARY)
rm -f $(DESTDIR)/share/pixmaps/wihotspot.png
rm -f $(DESTDIR)/share/icons/hicolor/48x48/apps/wihotspot.png
rm -f $(DESTDIR)/share/icons/hicolor/64x64/apps/wihotspot.png
rm -f $(DESTDIR)/share/icons/hicolor/256x256/apps/wihotspot.png
rm -f $(DESTDIR)/share/icons/hicolor/512x512/apps/wihotspot.png
rm -f $(DESTDIR)/share/icons/hicolor/scalable/apps/wihotspot.svg
rm -f $(DESTDIR)/share/applications/$(APP_NAME).desktop
rm -f $(DESTDIR)/share/polkit-1/rules.d/90-org.opensuse.policykit.wihotspot.rules
rm -f $(DESTDIR)/share/polkit-1/actions/org.opensuse.policykit.wihotspot.policy
rm -f $(DESTDIR)/bin/$(APP_GUI_BINARY)
cd scripts && $(MAKE) uninstall

clean-old:
rm -f $(DESTDIR)$(PREFIX)/share/pixmaps/wihotspot.png
rm -f $(DESTDIR)/share/pixmaps/wihotspot.png

clean:
rm -f $(ODIR)/*.o
Expand Down
32 changes: 15 additions & 17 deletions src/scripts/Makefile
Original file line number Diff line number Diff line change
@@ -1,30 +1,28 @@
PREFIX=/usr
MANDIR=$(PREFIX)/share/man
BINDIR=$(PREFIX)/bin
DESTDIR?=/usr

all:
@echo "Run 'make install' for installation."
@echo "Run 'make uninstall' for uninstallation."

install:
install -CDm755 create_ap $(DESTDIR)$(BINDIR)/create_ap
install -CDm755 create_ap $(DESTDIR)/bin/create_ap
install -CDm644 create_ap.conf $(DESTDIR)/etc/create_ap.conf
install -CDm644 create_ap.service $(DESTDIR)$(PREFIX)/lib/systemd/system/create_ap.service
install -CDm644 bash_completion $(DESTDIR)$(PREFIX)/share/bash-completion/completions/create_ap
install -CDm644 README.md $(DESTDIR)$(PREFIX)/share/doc/create_ap/README.md
install -CDm755 wihotspot $(DESTDIR)$(BINDIR)/wihotspot
install -CDm644 create_ap.service $(DESTDIR)/lib/systemd/system/create_ap.service
install -CDm644 bash_completion $(DESTDIR)/share/bash-completion/completions/create_ap
install -CDm644 README.md $(DESTDIR)/share/doc/create_ap/README.md
install -CDm755 wihotspot $(DESTDIR)/bin/wihotspot

install-cli-only:
install -CDm755 create_ap $(DESTDIR)$(BINDIR)/create_ap
install -CDm755 create_ap $(DESTDIR)/bin/create_ap
install -CDm644 create_ap.conf $(DESTDIR)/etc/create_ap.conf
install -CDm644 create_ap.service $(DESTDIR)$(PREFIX)/lib/systemd/system/create_ap.service
install -CDm644 bash_completion $(DESTDIR)$(PREFIX)/share/bash-completion/completions/create_ap
install -CDm644 README.md $(DESTDIR)$(PREFIX)/share/doc/create_ap/README.md
install -CDm644 create_ap.service $(DESTDIR)/lib/systemd/system/create_ap.service
install -CDm644 bash_completion $(DESTDIR)/share/bash-completion/completions/create_ap
install -CDm644 README.md $(DESTDIR)/share/doc/create_ap/README.md

uninstall:
rm -f $(DESTDIR)$(BINDIR)/create_ap
rm -f $(DESTDIR)/bin/create_ap
rm -f $(DESTDIR)/etc/create_ap.conf
rm -f $(DESTDIR)$(PREFIX)/lib/systemd/system/create_ap.service
rm -f $(DESTDIR)$(PREFIX)/share/bash-completion/completions/create_ap
rm -f $(DESTDIR)$(PREFIX)/share/doc/create_ap/README.md
rm -f $(DESTDIR)$(BINDIR)/wihotspot
rm -f $(DESTDIR)/lib/systemd/system/create_ap.service
rm -f $(DESTDIR)/share/bash-completion/completions/create_ap
rm -f $(DESTDIR)/share/doc/create_ap/README.md
rm -f $(DESTDIR)/bin/wihotspot