Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
mongoose
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Ganil-acq
GANILinux
linux-service
library
mongoose
Commits
38cc14a1
Commit
38cc14a1
authored
12 years ago
by
Sergey Lyubka
Browse files
Options
Downloads
Patches
Plain Diff
Initial version for the Macos app bundle
parent
bde9a633
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Makefile
+7
-10
7 additions, 10 deletions
Makefile
build/Info.plist
+12
-2
12 additions, 2 deletions
build/Info.plist
main.c
+81
-0
81 additions, 0 deletions
main.c
with
100 additions
and
12 deletions
Makefile
+
7
−
10
View file @
38cc14a1
...
@@ -28,10 +28,7 @@ all:
...
@@ -28,10 +28,7 @@ all:
LUA
=
lua-5.2.1/src
LUA
=
lua-5.2.1/src
LUA_FLAGS
=
-DUSE_LUA
-I
$(
LUA
)
-L
$(
LUA
)
-llua
-lm
LUA_FLAGS
=
-DUSE_LUA
-I
$(
LUA
)
-L
$(
LUA
)
-llua
-lm
GCC_WARNS
=
-W
-Wall
-pedantic
CFLAGS
=
-std
=
c99
-O2
-W
-Wall
-pedantic
$(
COPT
)
CFLAGS
=
-std
=
c99
-O2
$(
GCC_WARNS
)
$(
COPT
)
MAC_SHARED
=
-flat_namespace
-bundle
-undefined
suppress
LINFLAGS
=
-ldl
-pthread
$(
CFLAGS
)
LIB
=
lib
$(
PROG
)
.so
$(
MONGOOSE_LIB_SUFFIX
)
LIB
=
lib
$(
PROG
)
.so
$(
MONGOOSE_LIB_SUFFIX
)
# Make sure that the compiler flags come last in the compilation string.
# Make sure that the compiler flags come last in the compilation string.
...
@@ -39,20 +36,20 @@ LIB = lib$(PROG).so$(MONGOOSE_LIB_SUFFIX)
...
@@ -39,20 +36,20 @@ LIB = lib$(PROG).so$(MONGOOSE_LIB_SUFFIX)
# "-Wl,--as-needed" turned on by default in cc command.
# "-Wl,--as-needed" turned on by default in cc command.
# Also, this is turned in many other distros in static linkage builds.
# Also, this is turned in many other distros in static linkage builds.
linux
:
linux
:
$(
CC
)
mongoose.c
-shared
-fPIC
-fpic
-o
$(
LIB
)
-Wl
,-soname,
$(
LIB
)
$(
LIN
FLAGS
)
$(
CC
)
mongoose.c
-shared
-fPIC
-fpic
-o
$(
LIB
)
-Wl
,-soname,
$(
LIB
)
-ldl
-pthread
$(
C
FLAGS
)
$(
CC
)
mongoose.c main.c
-o
$(
PROG
)
$(
LIN
FLAGS
)
$(
CC
)
mongoose.c main.c
-o
$(
PROG
)
-ldl
-pthread
$(
C
FLAGS
)
bsd
:
bsd
:
$(
CC
)
mongoose.c
-shared
-pthread
-fpic
-fPIC
-o
$(
LIB
)
$(
CFLAGS
)
$(
CC
)
mongoose.c
-shared
-pthread
-fpic
-fPIC
-o
$(
LIB
)
$(
CFLAGS
)
$(
CC
)
mongoose.c main.c
-pthread
-o
$(
PROG
)
$(
CFLAGS
)
$(
CC
)
mongoose.c main.c
-pthread
-o
$(
PROG
)
$(
CFLAGS
)
mac
:
mac
:
$(
CC
)
mongoose.c
-pthread
-o
$(
LIB
)
$(
MAC_SHARED
)
$(
CFLAGS
)
$(
CC
)
mongoose.c
-pthread
-o
$(
LIB
)
-flat_namespace
-bundle
-undefined
suppress
$(
CFLAGS
)
$(
CC
)
mongoose.c main.c
-pthread
-o
$(
PROG
)
$(
CFLAGS
)
$(
CC
)
mongoose.c main.c
-DUSE_COCOA
-pthread
$(
CFLAGS
)
-framework
Cocoa
-ObjC
-arch
i386
-arch
x86_64
-o
$(
PROG
)
V
=
`
perl
-lne
'/define\s+MONGOOSE_VERSION\s+"(\S+)"/ and print $$1'
mongoose.c
`
;
DIR
=
dmg/
$(
PROG
)
.app
&&
rm
-rf
$$
DIR
&&
mkdir
-p
$$
DIR/Contents/
{
MacOS,Resources
}
&&
install
-m
644 build/mongoose_
*
.png
$$
DIR/Contents/Resources/
&&
install
-m
644 build/Info.plist
$$
DIR/Contents/
&&
install
-m
755
$(
PROG
)
$$
DIR/Contents/MacOS/
&&
ln
-fs
/Applications dmg/
;
hdiutil create
$(
PROG
)
_
$$
V.dmg
-volname
"Mongoose
$$
V"
-srcfolder
dmg
-ov
#; rm -rf dmg
solaris
:
solaris
:
$(
CC
)
mongoose.c
-pthread
-lnsl
\
$(
CC
)
mongoose.c
-pthread
-lnsl
-lsocket
-fpic
-fPIC
-shared
-o
$(
LIB
)
$(
CFLAGS
)
-lsocket
-fpic
-fPIC
-shared
-o
$(
LIB
)
$(
CFLAGS
)
$(
CC
)
mongoose.c main.c
-pthread
-lnsl
-lsocket
-o
$(
PROG
)
$(
CFLAGS
)
$(
CC
)
mongoose.c main.c
-pthread
-lnsl
-lsocket
-o
$(
PROG
)
$(
CFLAGS
)
...
...
This diff is collapsed.
Click to expand it.
build/Info.plist
+
12
−
2
View file @
38cc14a1
...
@@ -2,7 +2,17 @@
...
@@ -2,7 +2,17 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist
version=
"1.0"
>
<plist
version=
"1.0"
>
<dict>
<dict>
<key>
CFBundleIconFile
</key>
<string>
mongoose_16x16.png
</string>
<key>
CFBundleExecutable
</key>
<key>
LSUIElement
</key>
<true/>
<string>
mongoose
</string>
<key>
CFBundlePackageType
</key>
<string>
APPL
</string>
<key>
CFBundleTypeRole
</key>
<string>
None
</string>
<key>
CFBundleIconFiles
</key>
<array>
<string>
mongoose_16x16.png
</string>
</array>
<key>
LSUIElement
</key>
<true/>
</dict>
</dict>
</plist>
</plist>
This diff is collapsed.
Click to expand it.
main.c
+
81
−
0
View file @
38cc14a1
...
@@ -490,6 +490,87 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR cmdline, int show) {
...
@@ -490,6 +490,87 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR cmdline, int show) {
// Return the WM_QUIT value.
// Return the WM_QUIT value.
return
msg
.
wParam
;
return
msg
.
wParam
;
}
}
#elif defined(USE_COCOA)
#import <Cocoa/Cocoa.h>
@
interface
Mongoose
:
NSObject
<
NSApplicationDelegate
>
-
(
void
)
openBrowser
;
-
(
void
)
shutDown
;
@
end
@
implementation
Mongoose
-
(
void
)
openBrowser
{
[[
NSWorkspace
sharedWorkspace
]
openURL:
[
NSURL
URLWithString
:
[
NSString
stringWithUTF8String
:
"http://www.yahoo.com"
]]];
}
-
(
void
)
editConfig
{
[[
NSWorkspace
sharedWorkspace
]
openFile:
@
"mongoose.conf"
withApplication
:
@
"TextEdit"
];
}
-
(
void
)
shutDown
{
[
NSApp
terminate
:
nil
];
}
@
end
int
main
(
int
argc
,
char
*
argv
[])
{
init_server_name
();
start_mongoose
(
argc
,
argv
);
[
NSAutoreleasePool
new
];
[
NSApplication
sharedApplication
];
// Add delegate to process menu item actions
Mongoose
*
myDelegate
=
[[
Mongoose
alloc
]
autorelease
];
[
NSApp
setDelegate
:
myDelegate
];
// Run this app as agent
ProcessSerialNumber
psn
=
{
0
,
kCurrentProcess
};
TransformProcessType
(
&
psn
,
kProcessTransformToBackgroundApplication
);
SetFrontProcess
(
&
psn
);
// Add status bar menu
id
menu
=
[[
NSMenu
new
]
autorelease
];
// Add version menu item
[
menu
addItem
:
[[[
NSMenuItem
alloc
]
//initWithTitle:[NSString stringWithFormat:@"%s", server_name]
initWithTitle:
[
NSString
stringWithUTF8String
:
server_name
]
action:
@
selector
(
noexist
)
keyEquivalent
:
@
""
]
autorelease
]];
// Add configuration menu item
[
menu
addItem
:
[[[
NSMenuItem
alloc
]
initWithTitle:
@
"Edit configuration"
action:
@
selector
(
editConfig
)
keyEquivalent
:
@
""
]
autorelease
]];
// Add connect menu item
[
menu
addItem
:
[[[
NSMenuItem
alloc
]
initWithTitle:
@
"Open web root in a browser"
action:
@
selector
(
openBrowser
)
keyEquivalent
:
@
""
]
autorelease
]];
// Separator
[
menu
addItem
:
[
NSMenuItem
separatorItem
]];
// Add quit menu item
[
menu
addItem
:
[[[
NSMenuItem
alloc
]
initWithTitle:
@
"Quit"
action:
@
selector
(
shutDown
)
keyEquivalent
:
@
"q"
]
autorelease
]];
// Attach menu to the status bar
id
item
=
[[[
NSStatusBar
systemStatusBar
]
statusItemWithLength:
NSVariableStatusItemLength
]
retain
];
[
item
setHighlightMode
:
YES
];
[
item
setImage
:
[
NSImage
imageNamed
:
@
"mongoose_22x22.png"
]];
[
item
setMenu
:
menu
];
// Run the app
[
NSApp
activateIgnoringOtherApps
:
YES
];
[
NSApp
run
];
mg_stop
(
ctx
);
return
EXIT_SUCCESS
;
}
#else
#else
int
main
(
int
argc
,
char
*
argv
[])
{
int
main
(
int
argc
,
char
*
argv
[])
{
init_server_name
();
init_server_name
();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment