Skip to content

Commit 191e002

Browse files
committed
fix: submodule issue
1 parent 6ddf3a4 commit 191e002

Some content is hidden

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

62 files changed

+8313
-1
lines changed

lib/minilibx

-1
This file was deleted.

lib/minilibx/LICENSE

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
BSD 2-Clause License
2+
3+
Copyright (c) 2021, Ecole 42
4+
All rights reserved.
5+
6+
Redistribution and use in source and binary forms, with or without
7+
modification, are permitted provided that the following conditions are met:
8+
9+
1. Redistributions of source code must retain the above copyright notice, this
10+
list of conditions and the following disclaimer.
11+
12+
2. Redistributions in binary form must reproduce the above copyright notice,
13+
this list of conditions and the following disclaimer in the documentation
14+
and/or other materials provided with the distribution.
15+
16+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

lib/minilibx/Makefile

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
##
2+
## Makefile for MiniLibX in /home/boulon/work/c/raytraceur/minilibx
3+
##
4+
## Made by Olivier Crouzet
5+
6+
##
7+
## Started on Tue Oct 5 15:56:43 2004 Olivier Crouzet
8+
## Last update Tue May 15 15:44:41 2007 Olivier Crouzet
9+
##
10+
11+
## Please use configure script
12+
13+
14+
all : do_configure
15+
16+
do_configure :
17+
./configure
18+
19+
clean :
20+
./configure clean
21+
22+
re : clean all

lib/minilibx/Makefile.gen

+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
INC=/usr/include
2+
##
3+
## Makefile for MiniLibX in /home/boulon/work/c/raytraceur/minilibx
4+
##
5+
## Made by Olivier Crouzet
6+
7+
##
8+
## Started on Tue Oct 5 15:56:43 2004 Olivier Crouzet
9+
## Last update Tue May 15 15:41:20 2007 Olivier Crouzet
10+
##
11+
12+
## Please use configure script
13+
14+
15+
16+
UNAME = $(shell uname)
17+
CC = gcc
18+
ifeq ($(UNAME),FreeBSD)
19+
CC = clang
20+
endif
21+
22+
NAME = libmlx.a
23+
NAME_UNAME = libmlx_$(UNAME).a
24+
25+
SRC = mlx_init.c mlx_new_window.c mlx_pixel_put.c mlx_loop.c \
26+
mlx_mouse_hook.c mlx_key_hook.c mlx_expose_hook.c mlx_loop_hook.c \
27+
mlx_int_anti_resize_win.c mlx_int_do_nothing.c \
28+
mlx_int_wait_first_expose.c mlx_int_get_visual.c \
29+
mlx_flush_event.c mlx_string_put.c mlx_set_font.c \
30+
mlx_new_image.c mlx_get_data_addr.c \
31+
mlx_put_image_to_window.c mlx_get_color_value.c mlx_clear_window.c \
32+
mlx_xpm.c mlx_int_str_to_wordtab.c mlx_destroy_window.c \
33+
mlx_int_param_event.c mlx_int_set_win_event_mask.c mlx_hook.c \
34+
mlx_rgb.c mlx_destroy_image.c mlx_mouse.c mlx_screen_size.c \
35+
mlx_destroy_display.c
36+
37+
OBJ_DIR = obj
38+
OBJ = $(addprefix $(OBJ_DIR)/,$(SRC:%.c=%.o))
39+
CFLAGS = -O3 -I$(INC)
40+
41+
all : $(NAME)
42+
43+
$(OBJ_DIR)/%.o: %.c
44+
@mkdir -p $(OBJ_DIR)
45+
$(CC) $(CFLAGS) $(IFLAGS) -c $< -o $@
46+
47+
$(NAME) : $(OBJ)
48+
ar -r $(NAME) $(OBJ)
49+
ranlib $(NAME)
50+
cp $(NAME) $(NAME_UNAME)
51+
52+
check: all
53+
@test/run_tests.sh
54+
55+
show:
56+
@printf "NAME : $(NAME)\n"
57+
@printf "NAME_UNAME : $(NAME_UNAME)\n"
58+
@printf "CC : $(CC)\n"
59+
@printf "CFLAGS : $(CFLAGS)\n"
60+
@printf "SRC :\n $(SRC)\n"
61+
@printf "OBJ :\n $(OBJ)\n"
62+
63+
clean :
64+
rm -rf $(OBJ_DIR)/ $(NAME) $(NAME_UNAME) *~ core *.core
65+
66+
.PHONY: all check show clean

lib/minilibx/Makefile.mk

+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
##
2+
## Makefile for MiniLibX in /home/boulon/work/c/raytraceur/minilibx
3+
##
4+
## Made by Olivier Crouzet
5+
6+
##
7+
## Started on Tue Oct 5 15:56:43 2004 Olivier Crouzet
8+
## Last update Tue May 15 15:41:20 2007 Olivier Crouzet
9+
##
10+
11+
## Please use configure script
12+
13+
14+
INC =%%%%
15+
16+
UNAME = $(shell uname)
17+
CC = gcc
18+
ifeq ($(UNAME),FreeBSD)
19+
CC = clang
20+
endif
21+
22+
NAME = libmlx.a
23+
NAME_UNAME = libmlx_$(UNAME).a
24+
25+
SRC = mlx_init.c mlx_new_window.c mlx_pixel_put.c mlx_loop.c \
26+
mlx_mouse_hook.c mlx_key_hook.c mlx_expose_hook.c mlx_loop_hook.c \
27+
mlx_int_anti_resize_win.c mlx_int_do_nothing.c \
28+
mlx_int_wait_first_expose.c mlx_int_get_visual.c \
29+
mlx_flush_event.c mlx_string_put.c mlx_set_font.c \
30+
mlx_new_image.c mlx_get_data_addr.c \
31+
mlx_put_image_to_window.c mlx_get_color_value.c mlx_clear_window.c \
32+
mlx_xpm.c mlx_int_str_to_wordtab.c mlx_destroy_window.c \
33+
mlx_int_param_event.c mlx_int_set_win_event_mask.c mlx_hook.c \
34+
mlx_rgb.c mlx_destroy_image.c mlx_mouse.c mlx_screen_size.c \
35+
mlx_destroy_display.c
36+
37+
OBJ_DIR = obj
38+
OBJ = $(addprefix $(OBJ_DIR)/,$(SRC:%.c=%.o))
39+
CFLAGS = -O3 -I$(INC)
40+
41+
all : $(NAME)
42+
43+
$(OBJ_DIR)/%.o: %.c
44+
@mkdir -p $(OBJ_DIR)
45+
$(CC) $(CFLAGS) $(IFLAGS) -c $< -o $@
46+
47+
$(NAME) : $(OBJ)
48+
ar -r $(NAME) $(OBJ)
49+
ranlib $(NAME)
50+
cp $(NAME) $(NAME_UNAME)
51+
52+
check: all
53+
@test/run_tests.sh
54+
55+
show:
56+
@printf "NAME : $(NAME)\n"
57+
@printf "NAME_UNAME : $(NAME_UNAME)\n"
58+
@printf "CC : $(CC)\n"
59+
@printf "CFLAGS : $(CFLAGS)\n"
60+
@printf "SRC :\n $(SRC)\n"
61+
@printf "OBJ :\n $(OBJ)\n"
62+
63+
clean :
64+
rm -rf $(OBJ_DIR)/ $(NAME) $(NAME_UNAME) *~ core *.core
65+
66+
.PHONY: all check show clean

lib/minilibx/README.md

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
[![Build](https://github.com/42Paris/minilibx-linux/actions/workflows/ci.yml/badge.svg)](https://github.com/42Paris/minilibx-linux/actions/workflows/ci.yml)
2+
3+
This is the MinilibX, a simple X-Window (X11R6) programming API
4+
in C, designed for students, suitable for X-beginners.
5+
6+
7+
Contents
8+
9+
- source code in C to create the mlx library
10+
- man pages (in man/ directory)
11+
- a test program (in test/ directory) is built
12+
with the library
13+
- a public include file mlx.h
14+
- a tiny configure script to generate an appropriate Makefile.gen
15+
16+
Requirements for Linux
17+
18+
- MinilibX only support TrueColor visual type (8,15,16,24 or 32 bits depth)
19+
- gcc
20+
- make
21+
- X11 include files (package xorg)
22+
- XShm extension must be present (package libxext-dev)
23+
- Utility functions from BSD systems - development files (package libbsd-dev)
24+
- **e.g. _sudo apt-get install gcc make xorg libxext-dev libbsd-dev_ (Debian/Ubuntu)**
25+
26+
Requirements for MacOS
27+
- [Xquartz](https://www.xquartz.org/)
28+
29+
```bash
30+
~ Brew install Xquartz
31+
~ reboot
32+
~ xeyes # run an hello world X11 app
33+
```
34+
35+
MlX Color Opacity / Transparency / Alpha (32 bits depth)
36+
- 0xFF (fully transparent) or 0x00 (fully opaque)
37+
38+
Compile MinilibX
39+
40+
- run ./configure or make
41+
both will make a few tests, create Makefile.gen
42+
and then automatically run make on this generated Makefile.gen .
43+
libmlx.a and libmlx_$(HOSTTYPE).a are created.
44+
test/mlx-test binary is also created.
45+
46+
47+
Install MinilibX
48+
49+
- no installation script is provided. You may want to install
50+
- libmlx.a and/or libmlx_$(HOSTTYPE).a in /usr/X11/lib or /usr/local/lib
51+
- mlx.h in /usr/X11/include or /usr/local/include
52+
- man/man3/mlx*.1 in /usr/X11/man/man3 or /usr/local/man/man3
53+
54+
55+
Olivier CROUZET - 2014-01-06 -

lib/minilibx/configure

+126
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
#!/usr/bin/env sh
2+
3+
set -e
4+
5+
BOLD="\033[1m"
6+
RESET="\033[0m"
7+
LIGHT_RED="\033[91m"
8+
LIGHT_GREEN="\033[92m"
9+
LIGHT_CYAN="\033[96m"
10+
11+
logging(){
12+
local type=$1; shift
13+
printf "${LIGHT_CYAN}${BOLD}configure${RESET} [%b] : %b\n" "$type" "$*"
14+
}
15+
log_info(){
16+
logging "${LIGHT_GREEN}info${RESET}" "$@"
17+
}
18+
log_error(){
19+
logging "${LIGHT_RED}error${RESET}" "$@" >&2
20+
}
21+
22+
# find and print x11 header path
23+
get_xlib_include_path(){
24+
local result=""
25+
26+
for inc in \
27+
/usr/X11/include \
28+
/usr/X11R6/include \
29+
/usr/X11R5/include \
30+
/usr/X11R4/include \
31+
\
32+
/usr/include \
33+
/usr/include/X11 \
34+
/usr/include/X11R6 \
35+
/usr/include/X11R5 \
36+
/usr/include/X11R4 \
37+
\
38+
/usr/local/X11/include \
39+
/usr/local/X11R6/include \
40+
/usr/local/X11R5/include \
41+
/usr/local/X11R4/include \
42+
\
43+
/usr/local/include/X11 \
44+
/usr/local/include/X11R6 \
45+
/usr/local/include/X11R5 \
46+
/usr/local/include/X11R4 \
47+
\
48+
/usr/X386/include \
49+
/usr/x386/include \
50+
/usr/XFree86/include/X11 \
51+
\
52+
/usr/local/include \
53+
/usr/athena/include \
54+
/usr/local/x11r5/include \
55+
/usr/lpp/Xamples/include \
56+
\
57+
/usr/openwin/include \
58+
/usr/openwin/share/include
59+
do
60+
if [ -f "$inc/X11/Xlib.h" -a -f "$inc/X11/extensions/XShm.h" ]; then
61+
result=$inc
62+
break
63+
fi
64+
done
65+
echo $result
66+
}
67+
68+
show_help(){
69+
cat <<EOF
70+
Usage :
71+
$0 Auto-configure and make MinilibX
72+
$0 clean Execute the clean rule of both Makefile.gen
73+
EOF
74+
}
75+
76+
clean(){
77+
log_info 'Execute "make clean" from "makefile.gen"'
78+
${MAKE} -f Makefile.gen clean
79+
log_info 'Execute "make clean" from "test/makefile.gen"'
80+
${MAKE} -f Makefile.gen -C test/ --no-print-directory clean
81+
}
82+
83+
parse_args(){
84+
case "$1" in
85+
--help | -h)
86+
show_help
87+
exit 0;;
88+
clean)
89+
clean
90+
exit 0;;
91+
"") return;;
92+
*)
93+
log_error "unknown command \"$1\"\nRun \"./configure --help\" for usage."
94+
exit 1;;
95+
esac
96+
}
97+
98+
main(){
99+
local xlib_inc="$(get_xlib_include_path)"
100+
101+
case $(uname) in
102+
FreeBSD) MAKE=gmake ;;
103+
*) MAKE=make ;;
104+
esac
105+
106+
parse_args "$@"
107+
if [ -z "$xlib_inc" ]; then
108+
log_error "Can't find a suitable X11 include directory."
109+
exit 1
110+
fi
111+
log_info "Found X11 include path directory: $xlib_inc"
112+
113+
log_info 'Generate "makefile.gen" from template "makefile.mk"'
114+
echo "INC=$xlib_inc" > Makefile.gen
115+
cat Makefile.mk | grep -v %%%% >> Makefile.gen
116+
log_info 'Generate "test/makefile.gen" from template "test/makefile.mk"'
117+
echo "INC=$xlib_inc" > test/Makefile.gen
118+
cat test/Makefile.mk | grep -v %%%% >> test/Makefile.gen
119+
120+
log_info 'Execute "make all" from file "makefile.gen"'
121+
${MAKE} -f Makefile.gen all
122+
log_info 'Execute "make all" from file "test/makefile.gen"'
123+
(cd test ; ${MAKE} -f Makefile.gen all )
124+
}
125+
126+
main "$@"

0 commit comments

Comments
 (0)