diff --git a/.github/workflows/controller.yml b/.github/workflows/controller.yml index 96dbfcf206c..7e73f429c60 100644 --- a/.github/workflows/controller.yml +++ b/.github/workflows/controller.yml @@ -51,3 +51,11 @@ jobs: needs: build if: ${{ !failure() && !cancelled() }} uses: ./.github/workflows/mysql.yml + macos_latest: + needs: build + if: ${{ !failure() && !cancelled() }} + uses: ./.github/workflows/macos_latest.yml + macos_m1: + needs: build + if: ${{ !failure() && !cancelled() }} + uses: ./.github/workflows/macos_m1.yml diff --git a/.github/workflows/macos_latest.yml b/.github/workflows/macos_latest.yml new file mode 100644 index 00000000000..02e2a86734d --- /dev/null +++ b/.github/workflows/macos_latest.yml @@ -0,0 +1,81 @@ +name: macos_latest + +on: workflow_call + +env: + MYSQL_DATABASE: 'ragnarok' + MYSQL_USER: 'ragnarok' + MYSQL_PASSWORD: 'ragnarok' + MYSQL_ALLOW_EMPTY_PASSWORD: 'yes' + MACOS_COMMON_PACKAGES: make zlib pcre mysql mysql-client mysql-connector-c + SQLHOST: 'localhost' + +jobs: + build: + runs-on: macos-latest + timeout-minutes: 60 + strategy: + matrix: + CC: [clang] + RENEWAL: ["", "--disable-renewal"] + CLIENT_TYPE: ["", "--enable-packetver-re", "--enable-packetver-zero"] + HTTPLIB: ["", "--with-http_parser=llhttp"] + SANITIZER: ["--disable-manager", "--disable-manager --enable-sanitize=full"] + PACKET_VERSION: ["--enable-packetver=20221024", "--enable-packetver=20130724"] + exclude: + - PACKET_VERSION: "--enable-packetver=20130724" + CLIENT_TYPE: "--enable-packetver-zero" + + # github.head_ref will stop previous runs in the same PR (if in a PR) + # github.run_id is a fallback when outside a PR (e.g. every merge in master will run, and previous won't stop) + concurrency: + group: macos-x64-${{ github.head_ref || github.run_id }}_${{ matrix.CC }}_${{ matrix.RENEWAL }}_${{ matrix.CLIENT_TYPE }}_${{ matrix.HTTPLIB }}_${{ matrix.SANITIZER }}_${{ matrix.PACKET_VERSION}} + cancel-in-progress: true + + env: + CC: ${{ matrix.CC }} + CONFIGURE_FLAGS: CC=${{ matrix.CC }} --enable-debug --enable-Werror --enable-buildbot ${{ matrix.RENEWAL }} ${{ matrix.HTTPLIB }} ${{ matrix.CLIENT_TYPE }} ${{ matrix.SANITIZER }} ${{ matrix.PACKET_VERSION }} + PACKET_VERSION: ${{ matrix.PACKET_VERSION }} + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 1 + + - name: info + run: | + uname -a + + - name: prepare the build environment + run: | + echo "CPPFLAGS=-I$(brew --prefix)/include" >> $GITHUB_ENV + echo "LDFLAGS=-L$(brew --prefix)/lib" >> $GITHUB_ENV + + - name: install packages + run: | + brew update || true + ./tools/ci/retry.sh brew install $MACOS_COMMON_PACKAGES + + - name: setup mysql server + run: | + brew services start mysql + ./tools/ci/retry.sh mysqladmin ping --silent + ./tools/ci/travis.sh createdb $MYSQL_DATABASE root + ./tools/ci/travis.sh adduser $MYSQL_DATABASE $MYSQL_USER $MYSQL_PASSWORD root '' $SQLHOST + ./tools/ci/travis.sh importdb $MYSQL_DATABASE root + + - name: get plugins + run: | + ./tools/ci/travis.sh getplugins || true + + - name: build + run: | + ./tools/ci/travis.sh build $CONFIGURE_FLAGS --with-mysql=$(brew --prefix mysql)/bin/mysql_config + + - name: test + run: | + ./tools/ci/travis.sh test ragnarok ragnarok ragnarok $SQLHOST + + - name: extra test + if: env.PACKET_VERSION != '--enable-packetver=20130724' + run: | + ./tools/ci/travis.sh extratest diff --git a/.github/workflows/macos_m1.yml b/.github/workflows/macos_m1.yml new file mode 100644 index 00000000000..f4dbfa29454 --- /dev/null +++ b/.github/workflows/macos_m1.yml @@ -0,0 +1,81 @@ +name: macos_m1 + +on: workflow_call + +env: + MYSQL_DATABASE: 'ragnarok' + MYSQL_USER: 'ragnarok' + MYSQL_PASSWORD: 'ragnarok' + MYSQL_ALLOW_EMPTY_PASSWORD: 'yes' + MACOS_COMMON_PACKAGES: make zlib pcre mysql mysql-client mysql-connector-c + SQLHOST: 'localhost' + +jobs: + build: + runs-on: macos-14 + timeout-minutes: 60 + strategy: + matrix: + CC: [clang] + RENEWAL: ["", "--disable-renewal"] + CLIENT_TYPE: ["", "--enable-packetver-re", "--enable-packetver-zero"] + HTTPLIB: ["", "--with-http_parser=llhttp"] + SANITIZER: ["--disable-manager", "--disable-manager --enable-sanitize=full"] + PACKET_VERSION: ["--enable-packetver=20221024", "--enable-packetver=20130724"] + exclude: + - PACKET_VERSION: "--enable-packetver=20130724" + CLIENT_TYPE: "--enable-packetver-zero" + + # github.head_ref will stop previous runs in the same PR (if in a PR) + # github.run_id is a fallback when outside a PR (e.g. every merge in master will run, and previous won't stop) + concurrency: + group: macos-arm-${{ github.head_ref || github.run_id }}_${{ matrix.CC }}_${{ matrix.RENEWAL }}_${{ matrix.CLIENT_TYPE }}_${{ matrix.HTTPLIB }}_${{ matrix.SANITIZER }}_${{ matrix.PACKET_VERSION}} + cancel-in-progress: true + + env: + CC: ${{ matrix.CC }} + CONFIGURE_FLAGS: CC=${{ matrix.CC }} --enable-debug --enable-Werror --enable-buildbot ${{ matrix.RENEWAL }} ${{ matrix.HTTPLIB }} ${{ matrix.CLIENT_TYPE }} ${{ matrix.SANITIZER }} ${{ matrix.PACKET_VERSION }} + PACKET_VERSION: ${{ matrix.PACKET_VERSION }} + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 1 + + - name: info + run: | + uname -a + + - name: prepare the build environment + run: | + echo "CPPFLAGS=-I$(brew --prefix)/include" >> $GITHUB_ENV + echo "LDFLAGS=-L$(brew --prefix)/lib" >> $GITHUB_ENV + + - name: install packages + run: | + brew update || true + ./tools/ci/retry.sh brew install $MACOS_COMMON_PACKAGES + + - name: setup mysql server + run: | + brew services start mysql + ./tools/ci/retry.sh mysqladmin ping --silent + ./tools/ci/travis.sh createdb $MYSQL_DATABASE root + ./tools/ci/travis.sh adduser $MYSQL_DATABASE $MYSQL_USER $MYSQL_PASSWORD root '' $SQLHOST + ./tools/ci/travis.sh importdb $MYSQL_DATABASE root + + - name: get plugins + run: | + ./tools/ci/travis.sh getplugins || true + + - name: build + run: | + ./tools/ci/travis.sh build $CONFIGURE_FLAGS --with-mysql=$(brew --prefix mysql)/bin/mysql_config + + - name: test + run: | + ./tools/ci/travis.sh test ragnarok ragnarok ragnarok $SQLHOST + + - name: extra test + if: env.PACKET_VERSION != '--enable-packetver=20130724' + run: | + ./tools/ci/travis.sh extratest diff --git a/configure b/configure index 67bbd3e4dc5..86dc664358d 100755 --- a/configure +++ b/configure @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.ac a16c389a2. +# From configure.ac ce12b6b8f. # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.71. # @@ -1396,38 +1396,39 @@ Optional Features: --enable-packetver-ad Sets or unsets the PACKETVER_AD define - see src/common/mmo.h (currently disabled by default) --enable-epoll use epoll(4) on Linux - --enable-debug[=ARG] Compiles extra debug code. (yes by default) + --enable-debug[=ARG] Compiles extra debug code. (yes by default) (available options: yes, no, gdb) --enable-libbacktrace[=ARG] - Compiles with libbacktrace. (no by default - + Compiles with libbacktrace. (no by default - experimental) --enable-buildbot[=ARG] (available options: yes, no) - --enable-rdtsc Uses rdtsc as timing source (disabled by default) - Enable it when you've timing issues. (For example: - in conjunction with XEN or Other Virtualization - mechanisms) Note: Please ensure that you've disabled - dynamic CPU-Frequencys, such as power saving - options. (On most modern Dedicated Servers cpufreq - is preconfigured, see your distribution's manual how - to disable it). Furthermore, If your CPU has - built-in CPU-Frequency scaling features (such as - Intel's SpeedStep(R)), do not enable this option. - Recent CPUs (Intel Core or newer) guarantee a fixed - increment rate for their TSC, so it should be safe - to use, but please doublecheck the documentation of - both your CPU and OS before enabling this option. + --enable-rdtsc Uses rdtsc as timing source (disabled by default) + Enable it when you've timing issues. (For + example: in conjunction with XEN or Other + Virtualization mechanisms) Note: Please ensure + that you've disabled dynamic CPU-Frequencys, such as + power saving options. (On most modern Dedicated + Servers cpufreq is preconfigured, see your + distribution's manual how to disable it). + Furthermore, If your CPU has built-in CPU-Frequency + scaling features (such as Intel's SpeedStep(R)), do + not enable this option. Recent CPUs (Intel Core or + newer) guarantee a fixed increment rate for their + TSC, so it should be safe to use, but please + doublecheck the documentation of both your CPU and + OS before enabling this option. --enable-profiler=ARG Profilers: no, gprof (disabled by default) - --disable-64bit Enforce 32bit output on x86_64 systems. - --enable-lto Enables or Disables Linktime Code Optimization (LTO - is disabled by default) - --enable-static Enables or Disables Statick Linking (STATIC is + --disable-64bit Enforce 32bit output on x86_64 systems. + --enable-lto Enables or Disables Linktime Code Optimization + (LTO is disabled by default) + --enable-static Enables or Disables Statick Linking (STATIC is disabled by default) - --enable-sanitize[=ARG] Enables sanitizer. (disabled by default) (available - options: yes, no, full) - --enable-Werror Enables -Werror in the compiler flags. (disabled by - default) - --disable-renewal Disable Ragnarok Renewal support (override settings - in src/config/renewal.h) + --enable-sanitize[=ARG] Enables sanitizer. (disabled by default) + (available options: yes, no, full) + --enable-Werror Enables -Werror in the compiler flags. (disabled + by default) + --disable-renewal Disable Ragnarok Renewal support (override + settings in src/config/renewal.h) Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] @@ -2540,6 +2541,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu + ac_config_files="$ac_config_files Makefile src/common/Makefile" ac_config_files="$ac_config_files 3rdparty/mt19937ar/Makefile 3rdparty/libconfig/Makefile 3rdparty/libbacktrace/Makefile 3rdparty/libbacktrace/backtrace-supported.h" @@ -5681,6 +5683,9 @@ _ACEOF if ac_fn_c_try_compile "$LINENO" then : pointers_fit_in_ints="yes" +else $as_nop + + fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext if test "$pointers_fit_in_ints" = "no" ; then @@ -5700,6 +5705,9 @@ _ACEOF if ac_fn_c_try_compile "$LINENO" then : pointers_fit_in_ints="yes (with -m32)" +else $as_nop + + fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi @@ -10488,6 +10496,103 @@ rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +case $host_os in +Darwin*) + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wno-deprecated-declarations" >&5 +printf %s "checking whether $CC supports -Wno-deprecated-declarations... " >&6; } + OLD_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -Werror -Wno-deprecated-declarations" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int foo; +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + + # Recent versions of gcc don't fail if -Wno-foo is not recognized + # (unless there are also other warnings), so we also check for -Wfoo + # which always fails if not supported + CFLAGS="$OLD_CFLAGS -Werror -Wdeprecated-declarations" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int foo; +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + CFLAGS="$OLD_CFLAGS -Wno-deprecated-declarations" + # Optionally, run a test + if test "x" != "x"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC can actually use -Wno-deprecated-declarations" >&5 +printf %s "checking whether $CC can actually use -Wno-deprecated-declarations... " >&6; } + CFLAGS="$OLD_CFLAGS -Werror -Wdeprecated-declarations" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: not needed but enabled" >&5 +printf "%s\n" "not needed but enabled" >&6; } + CFLAGS="$OLD_CFLAGS" + +else $as_nop + + CFLAGS="$OLD_CFLAGS -Werror -Wno-deprecated-declarations" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + CFLAGS="$OLD_CFLAGS -Wno-deprecated-declarations" + +else $as_nop + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + CFLAGS="$OLD_CFLAGS" + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + fi + +else $as_nop + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + CFLAGS="$OLD_CFLAGS" + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + +else $as_nop + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + CFLAGS="$OLD_CFLAGS" + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + + + ;; +esac + # Certain versions of gcc make -Wshadow completely useless by making it flood # you with unnecessary warnings # Let's check if we can really use it @@ -12608,9 +12713,17 @@ then : CFLAGS="$CFLAGS -DHAVE_EXECINFO" +else $as_nop + + + fi +else $as_nop + + + fi done diff --git a/configure.ac b/configure.ac index 03f9c468cda..c67777e9590 100644 --- a/configure.ac +++ b/configure.ac @@ -20,9 +20,10 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -AC_INIT(Hercules) +AC_INIT +AC_CONFIG_SRCDIR([Hercules]) AC_REVISION([m4_esyscmd_s([type git >/dev/null 2>&1 && git describe --always 2>/dev/null || echo '(unknown version)'])]) -AC_PREREQ([2.69]) +AC_PREREQ([2.71]) AC_CONFIG_SRCDIR([src/common/cbasetypes.h]) AC_CONFIG_FILES([Makefile src/common/Makefile]) AC_CONFIG_FILES([3rdparty/mt19937ar/Makefile 3rdparty/libconfig/Makefile 3rdparty/libbacktrace/Makefile 3rdparty/libbacktrace/backtrace-supported.h]) @@ -34,10 +35,10 @@ AC_CONFIG_FILES([src/test/Makefile]) AC_CONFIG_FILES([tools/HPMHookGen/Makefile]) AC_CONFIG_FILES([tools/doxygen/Makefile]) -dnl AC_USE_SYSTEM_EXTENSIONS requires autoconf 2.60 or newer. Fall back to AC_GNU_SOURCE otherwise. +dnl AC_USE_SYSTEM_EXTENSIONS requires autoconf 2.60 or newer. Fall back to AC_USE_SYSTEM_EXTENSIONS otherwise. m4_ifdef([AC_USE_SYSTEM_EXTENSIONS], [AC_USE_SYSTEM_EXTENSIONS], - [AC_GNU_SOURCE] + [AC_USE_SYSTEM_EXTENSIONS] ) AC_MSG_CHECKING([host OS]) @@ -144,10 +145,8 @@ AC_ARG_ENABLE( # AC_ARG_ENABLE( [old-cashshop-preview-patch], - AC_HELP_STRING( - [--enable-old-cashshop-preview-patch], - [Enable Nemo patch ExtendOldCashShopPreview.] - ), + AS_HELP_STRING([--enable-old-cashshop-preview-patch],[Enable Nemo patch ExtendOldCashShopPreview. + ]), [enable_old_cashshop_preview_patch=1], [enable_old_cashshop_preview_patch=0] ) @@ -672,10 +671,8 @@ AC_ARG_WITH( # Select http parser AC_ARG_WITH( [http_parser], - AC_HELP_STRING( - [--with-http_parser=ARG], - [select http parser. Allowed values: http-parser, llhttp)] - ), + AS_HELP_STRING([--with-http_parser=ARG],[select http parser. Allowed values: http-parser, llhttp) + ]), [ case $withval in http-parser* ) @@ -1247,6 +1244,12 @@ AC_CHECK_COMPILER_WNOFLAG(deprecated-non-prototype) # issue in clang-15 in libconfig AC_CHECK_COMPILER_WNOFLAG(unused-but-set-variable) +case $host_os in +Darwin*) + AC_CHECK_COMPILER_WNOFLAG(deprecated-declarations) + ;; +esac + # Certain versions of gcc make -Wshadow completely useless by making it flood # you with unnecessary warnings # Let's check if we can really use it diff --git a/tools/ci/travis.sh b/tools/ci/travis.sh index 2876b1d8208..82f8321cda2 100755 --- a/tools/ci/travis.sh +++ b/tools/ci/travis.sh @@ -160,10 +160,12 @@ case "$MODE" in mysql $DBUSER_ARG $DBPASS_ARG $DBHOST_ARG --execute="CREATE USER '$NEWUSER'@'$DBHOST' IDENTIFIED BY '$NEWPASS';" || true mysql $DBUSER_ARG $DBPASS_ARG $DBHOST_ARG --execute="GRANT SELECT,INSERT,UPDATE,DELETE ON $DBNAME.* TO '$NEWUSER'@'$DBHOST';" || true mysql $DBUSER_ARG $DBPASS_ARG $DBHOST_ARG --execute="ALTER USER '$NEWUSER'@'$DBHOST' IDENTIFIED BY '$NEWPASS';" || true - mysql --defaults-file=/etc/mysql/debian.cnf $DBPASS_ARG $DBHOST_ARG --execute="CREATE USER '$NEWUSER'@'$DBHOST' IDENTIFIED BY '$NEWPASS';" || true - mysql --defaults-file=/etc/mysql/debian.cnf $DBPASS_ARG $DBHOST_ARG --execute="GRANT SELECT,INSERT,UPDATE,DELETE ON $DBNAME.* TO '$NEWUSER'@'$DBHOST';" || true - mysql --defaults-file=/etc/mysql/debian.cnf $DBPASS_ARG $DBHOST_ARG --execute="ALTER USER '$NEWUSER'@'$DBHOST' IDENTIFIED BY '$NEWPASS';" || true + if [[ -n "$(uname -a | grep -i linux)" ]]; then + mysql --defaults-file=/etc/mysql/debian.cnf $DBPASS_ARG $DBHOST_ARG --execute="CREATE USER '$NEWUSER'@'$DBHOST' IDENTIFIED BY '$NEWPASS';" || true + mysql --defaults-file=/etc/mysql/debian.cnf $DBPASS_ARG $DBHOST_ARG --execute="GRANT SELECT,INSERT,UPDATE,DELETE ON $DBNAME.* TO '$NEWUSER'@'$DBHOST';" || true + mysql --defaults-file=/etc/mysql/debian.cnf $DBPASS_ARG $DBHOST_ARG --execute="ALTER USER '$NEWUSER'@'$DBHOST' IDENTIFIED BY '$NEWPASS';" || true + fi ;; build) if [[ -z "${SKIP_VALIDATE_INTERFACES}" ]]; then