Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
mongoose
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
esp
mongoose
Commits
38cc14a1
Commit
38cc14a1
authored
Jan 03, 2013
by
Sergey Lyubka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Initial version for the Macos app bundle
parent
bde9a633
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
100 additions
and
12 deletions
+100
-12
Makefile
Makefile
+7
-10
Info.plist
build/Info.plist
+12
-2
main.c
main.c
+81
-0
No files found.
Makefile
View file @
38cc14a1
...
...
@@ -28,10 +28,7 @@ all:
LUA
=
lua-5.2.1/src
LUA_FLAGS
=
-DUSE_LUA
-I
$(LUA)
-L
$(LUA)
-llua
-lm
GCC_WARNS
=
-W
-Wall
-pedantic
CFLAGS
=
-std
=
c99
-O2
$(GCC_WARNS)
$(COPT)
MAC_SHARED
=
-flat_namespace
-bundle
-undefined
suppress
LINFLAGS
=
-ldl
-pthread
$(CFLAGS)
CFLAGS
=
-std
=
c99
-O2
-W
-Wall
-pedantic
$(COPT)
LIB
=
lib
$(PROG)
.so
$(MONGOOSE_LIB_SUFFIX)
# Make sure that the compiler flags come last in the compilation string.
...
...
@@ -39,20 +36,20 @@ LIB = lib$(PROG).so$(MONGOOSE_LIB_SUFFIX)
# "-Wl,--as-needed" turned on by default in cc command.
# Also, this is turned in many other distros in static linkage builds.
linux
:
$(CC)
mongoose.c
-shared
-fPIC
-fpic
-o
$(LIB)
-Wl
,-soname,
$(LIB)
$(LIN
FLAGS)
$(CC)
mongoose.c main.c
-o
$(PROG)
$(LIN
FLAGS)
$(CC)
mongoose.c
-shared
-fPIC
-fpic
-o
$(LIB)
-Wl
,-soname,
$(LIB)
-ldl
-pthread
$(C
FLAGS)
$(CC)
mongoose.c main.c
-o
$(PROG)
-ldl
-pthread
$(C
FLAGS)
bsd
:
$(CC)
mongoose.c
-shared
-pthread
-fpic
-fPIC
-o
$(LIB)
$(CFLAGS)
$(CC)
mongoose.c main.c
-pthread
-o
$(PROG)
$(CFLAGS)
mac
:
$(CC)
mongoose.c
-pthread
-o
$(LIB)
$(MAC_SHARED)
$(CFLAGS)
$(CC)
mongoose.c main.c
-pthread
-o
$(PROG)
$(CFLAGS)
$(CC)
mongoose.c
-pthread
-o
$(LIB)
-flat_namespace
-bundle
-undefined
suppress
$(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
:
$(CC)
mongoose.c
-pthread
-lnsl
\
-lsocket
-fpic
-fPIC
-shared
-o
$(LIB)
$(CFLAGS)
$(CC)
mongoose.c
-pthread
-lnsl
-lsocket
-fpic
-fPIC
-shared
-o
$(LIB)
$(CFLAGS)
$(CC)
mongoose.c main.c
-pthread
-lnsl
-lsocket
-o
$(PROG)
$(CFLAGS)
...
...
build/Info.plist
View file @
38cc14a1
...
...
@@ -2,7 +2,17 @@
<
!
D
O
C
TYP
E
plist
PU
B
LI
C
"-//
A
ppl
e
//
D
T
D
PLIST
1
.
0
//
E
N"
"http://www.
a
ppl
e
.
c
om/
D
T
D
s/Prop
e
rtyList-
1
.
0
.
d
t
d
"
>
<
plist
v
e
rsion="
1
.
0
"
>
<
d
i
c
t
>
<
k
e
y
>
CFBundleIconFile
<
/k
e
y
>
<
string
>
mongoose_16x16.png
<
/string
>
<
k
e
y
>
LSUIElement
<
/k
e
y
>
<
tru
e
/
>
<
k
e
y
>
CFBundleExecutable
<
/k
e
y
>
<
string
>
mongoose
<
/string
>
<
k
e
y
>
CFBundlePackageType
<
/k
e
y
>
<
string
>
APPL
<
/string
>
<
k
e
y
>
CFBundleTypeRole
<
/k
e
y
>
<
string
>
None
<
/string
>
<
k
e
y
>
CFBundleIconFiles
<
/k
e
y
>
<
a
rr
a
y
>
<
string
>
mongoose_16x16.png
<
/string
>
<
/
a
rr
a
y
>
<
k
e
y
>
LSUIElement
<
/k
e
y
>
<
tru
e
/
>
<
/
d
i
c
t
>
<
/plist
>
main.c
View file @
38cc14a1
...
...
@@ -490,6 +490,87 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR cmdline, int show) {
// Return the WM_QUIT value.
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
int
main
(
int
argc
,
char
*
argv
[])
{
init_server_name
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment